-
LUA help?
I'm jsut trying to make a script in Super Duper Macro that will select a random message from a list and send it.
This code returns no errors, but also does nothing. The code check tools i could find say nothing is wrong with it. Anyone know what i'm doing wrong?
Thanks!
Code:
-- Seed the random number generator
math.randomseed(os.time())
-- List of messages
list1 = {
"Call1",
"call2"
}
-- Number of messages
-- Updated to reflect the actual number of messages in list1
listnum = #list1
-- Random Message Choice
function messagenum()
-- Generate a random index between 1 and listnum
local randomIndex = math.random(1, listnum)
-- Access the message from list1 using the random index
local selectedMessage = list1[randomIndex]
-- Send the selected message
-- SendChatMessage("Hello", "PARTY")
SendChatMessage(selectedMessage, "PARTY")
end
-
Neither math.randomseed nor os exist in the Lua version of the game. So it's impossible that code is returning no errors.
Code:
local list = {"Call 1", "Call 2"}
local idx = math.random(#list)
SendChatMessage(list[idx], "PARTY")
-
Well, I mean Super Duper Macro might have been blocking some errors, but I didn;t come look for help until it stopped giving me errors. In discord someone pointed out that I was not calling my function.
This is awesomely clean and simple, thank you so much! :D