PtokaX forum

Development Section => Your Developing Problems => Topic started by: kepp on 30 November, 2003, 03:26:58

Title: Repeat once only..?
Post by: kepp on 30 November, 2003, 03:26:58
  function NewUserConnected(user)
      local randomPhrase = random(14)
         if randomPhrase == 1 then
      SendToAll("<[BBB]Micke> Jag Beh?ver lite h?lp h?r tack...!")
         elseif randomPhrase == 2 then
      SendToAll("<(uK)TheBiggestTwat> Sorry?")
         elseif randomPhrase == 3 then
      SendToAll("<(uK)TheBiggestTwat> Speak english so i can understand!!!")
         elseif randomPhrase == 4 then
      SendToAll("<[SwE]G?ran_1912> Ah, Shat the fack upp m? daj..")
         elseif randomPhrase == 5 then
      SendToAll(" I don't understant, i get a erorr, \"No slots Available\"")
         elseif randomPhrase == 6 then
      SendToAll("<(uK)TheBiggestTwat> Please, speak english..")
         elseif randomPhrase == 7 then
      SendToAll("<[BBB]Micke> Kan man f? lite hj?lp?")
         elseif randomPhrase == 8 then
      SendToAll("<[BBB]Micke> I need some help")
         elseif randomPhrase == 9 then
      SendToAll("<(uK)TheBiggestTwat> Hey [BBB]Micke, Can i help you m8?")
         elseif randomPhrase == 10 then
      SendToAll(" Please help me....")
         elseif randomPhrase == 11 then
      SendToAll("<[SwE]G?ran_1912> Du kan inte h?lla flabben va? J?vla n?t")
         elseif randomPhrase == 12 then
      SendToAll(" Howdy ya'll")
         elseif randomPhrase == 13 then
      SendToAll("<[SwE]G?ran_1912> ?r h?r bara s?nna Caboysare h?r eller vad ?r det fr?gan om?")
         elseif randomPhrase == 14 then
      SendToAll(" Im gunna tell ya'll a story, Whein i wos a kid, i allwuzy played mah gewtahr")
   end
end

I want to make a script for my dead main...
and therefor to get a good delay between each message im using it in NewUserConnected()

Problem is, This will look like sh*t..
i want it to send one, after one til the end, Then it's gonna end

If possible i would be very glad if you could explain how to do so.. :D

// Kepp
Title:
Post by: pHaTTy on 30 November, 2003, 10:09:36
But you can use a timer....See the thing is because then you are using a timer is can repea itslef several timers..


function Main()
SetTimer(1*60000)
end

function OnTimer()
      local randomPhrase = random(14)
         if randomPhrase == 1 then
      SendToAll("<[BBB]Micke> Jag Beh?ver lite h?lp h?r tack...!")
         elseif randomPhrase == 2 then
      SendToAll("<(uK)TheBiggestTwat> Sorry?")
         elseif randomPhrase == 3 then
      SendToAll("<(uK)TheBiggestTwat> Speak english so i can understand!!!")
         elseif randomPhrase == 4 then
      SendToAll("<[SwE]G?ran_1912> Ah, Shat the fack upp m? daj..")
         elseif randomPhrase == 5 then
      SendToAll(" I don't understant, i get a erorr, \"No slots Available\"")
         elseif randomPhrase == 6 then
      SendToAll("<(uK)TheBiggestTwat> Please, speak english..")
         elseif randomPhrase == 7 then
      SendToAll("<[BBB]Micke> Kan man f? lite hj?lp?")
         elseif randomPhrase == 8 then
      SendToAll("<[BBB]Micke> I need some help")
         elseif randomPhrase == 9 then
      SendToAll("<(uK)TheBiggestTwat> Hey [BBB]Micke, Can i help you m8?")
         elseif randomPhrase == 10 then
      SendToAll(" Please help me....")
         elseif randomPhrase == 11 then
      SendToAll("<[SwE]G?ran_1912> Du kan inte h?lla flabben va? J?vla n?t")
         elseif randomPhrase == 12 then
      SendToAll(" Howdy ya'll")
         elseif randomPhrase == 13 then
      SendToAll("<[SwE]G?ran_1912> ?r h?r bara s?nna Caboysare h?r eller vad ?r det fr?gan om?")
         elseif randomPhrase == 14 then
      SendToAll(" Im gunna tell ya'll a story, Whein i wos a kid, i allwuzy played mah gewtahr")
StopTimer()
   end

end

function NewUserConnected()
StartTimer()
end


Now this is not it, this will rpeat itsel but will go thru msgs until it randomly hits the 14th msg then it will stop, so not you need to think of a way of making sure it does 1 msg after the other, give it a shot and i can help more *bissy* but can help as much as a can

*hint* Randomiser wont work for 1 msg after the other ;)
Title:
Post by: kepp on 30 November, 2003, 16:46:24
I like the idea bout the timer :)
only problem now, been trying now alot and can't figure it out, is to get it, one after one..
anyway,
NO hurry, i will try to figure out
Title:
Post by: kepp on 01 December, 2003, 20:43:24
Do i need to store them in a table, then if that message has been sent it won't send it again?
My brain is boiling..
i know randomizer won't work as you said...
what i've been looking for is something Like random()
exept that it will, like i said, go trough one after one.
without any results