Author Topic: Simple request  (Read 3149 times)

0 Members and 1 Guest are viewing this topic.

Offline AJ-

  • Newbie
  • *
  • Posts: 4
  • Karma: 0
Simple request
« 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.
« Last Edit: March 03, 2013, 09:21:00 PM by AJ- »

Offline MrPresident

  • Ulysses Team Member
  • Hero Member
  • *****
  • Posts: 2728
  • Karma: 430
    • |G4P| Gman4President
Re: Simple request
« Reply #1 on: March 04, 2013, 12:06:29 AM »
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.

Offline AJ-

  • Newbie
  • *
  • Posts: 4
  • Karma: 0
Re: Simple request
« Reply #2 on: March 05, 2013, 05:28:46 PM »
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

Offline pazda

  • Newbie
  • *
  • Posts: 10
  • Karma: 1
Re: Simple request
« Reply #3 on: March 07, 2013, 01:11:46 PM »
This is untested but should work in autorun

Code: [Select]
/* 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()

Offline nathan736

  • Full Member
  • ***
  • Posts: 143
  • Karma: 4
Re: Simple request
« Reply #4 on: March 08, 2013, 07:18:07 AM »
This is untested but should work in autorun

Code: [Select]
/* 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.
a person asked me how to code lua and i said this " its like building a rocket up side down then  realizing you did it all wrong."