Ulysses
General => Developers Corner => Topic started by: AJ- on March 03, 2013, 09:18:21 PM
-
It may be simple but I really can't figure out how to do this.
I want to have an array of different messages and have a random one of them print to the chatbox every 90 seconds. I don't know where to start, if somebody can point me in the right direction I would be very grateful.
I know ULX has an advertisement built in, but I want to display random messages and Im pretty sure thats not possible without some modification.
-
Yeah, I think ULX gets its adverts sequentially. That being said, maybe it would be a good sugestion to make them display randomly.
This is an easy request, but all I have right now is my phone. Someone here should be able to whip this out for you on no time. If not, I'll do it when I get out of the hospital.
-
Yeah, I think ULX gets its adverts sequentially. That being said, maybe it would be a good sugestion to make them display randomly.
This is an easy request, but all I have right now is my phone. Someone here should be able to whip this out for you on no time. If not, I'll do it when I get out of the hospital.
Much appreciated
-
This is untested but should work in autorun
/* Made by Pazda */
// Configuration
local MSG_WAITTIME = 90 // seconds between each message
// write in some messages.
local MSG_NAMES = {"random message 1","random message 2","and so forth"}
local function RandomMsg()
local msg = table.Random(MSG_NAMES)
ChatPrint( msg )
timer.Simple(MSG_WAITTIME, RandomMsg)
end
RandomMsg()
-
This is untested but should work in autorun
/* Made by Pazda */
// Configuration
local MSG_WAITTIME = 90 // seconds between each message
// write in some messages.
local MSG_NAMES = {"random message 1","random message 2","and so forth"}
local function RandomMsg()
local msg = table.Random(MSG_NAMES)
ChatPrint( msg )
timer.Simple(MSG_WAITTIME, RandomMsg)
end
RandomMsg()
theres probably a better way to do this by having a back up table and removing the string from the table every time you print it then once the table is empty just reset it to what it started at and repeat that way EVERYTHING gets printed eventually with in a predictable time limit.