timers problem

Posted by Avariel on Mon 09 Jun 2003 02:07 AM — 7 posts, 28,192 views.

Portugal #0
i need some help with some timers...

i try to use some timers in a script...
first i tried to addtimer but im getting an error, this is my function

world.addtimer ( "Name", 0, 0, 3, "",  eEnabled | eReplace , "OnTest" );


but it wont do anything. i tried the OnTest function in an alias and it worked fine.

then i tried to add something to send in the timer and i did

world.addtimer ( "Name", 0, 0, 3, "send this",  eEnabled | eReplace , "OnTest" );


and it send "send this" in every 3 secs... so i cant understand what is wrong. after that i tried a diferent thing and make a permanent timer that i would enable/disable


  <timer 
   name="Name" 
   script="OnTest" 
   second="3" 
  >
  </timer>


the problem is that when i enable the timer it fires 1 sec later and only after that it fires 3 in 3 secs..

any sugestion?

thank you


Canada #1
I really have no clue what it is you are trying to do the problem that I see which may not be a problem with

world.addtimer ( "Name", 0, 0, 3, "", eEnabled | eReplace , "OnTest" );

Is that where you put the data to be sent you may need to have " " as there is nothing being sent there.
and you said it worked when you put send this

I don't understand what the problem is to be honest so I will just shutup now but you said it worked fine with the "Send This" so I am not sure what the problem is

bleh ok just ignore me

Wish I could help,
WRTIII
Greece #2
OK, i didn't read the whole post, but VBscript is "Or", not "|" :)
Russia #3
Don't think that's vbscript. No parenthesis around arguments or ; at the end of statement there either :P
Canada #4
I would change the | to a + .

When a timer calls a subroutine, it only passes one argument to the subroutine, which is the name of the timer that fired. If your subroutine does not expect exactly ONE argument, a runtime error will occur in your script.

For example, your subroutine might look like this:

Sub onTimerFired (TimerName)
  World.Note "The timer, " & TimerName & " has fired."
End Sub

(That being a Visual Basic Script example).
Portugal #5
ok! thank you to everyone... i think my post was a LOT confusing *blush* im sorry. i finnaly figure out what was happening.

for some reason an alias/trigger/timer created via script needs that the world have enable script on to call a script, although the other alias/trigger/timer dont. i dont know if its a bug or its ment to be like that.


thank you again for your help..


Amended on Mon 16 Jun 2003 03:39 PM by Avariel
Australia Forum Administrator #6
If you are planning to script then "enable script" needs to be set, yes.