Object.KillTimer Event Not Working
Wednesday, August 6, 2003 by deleted | Discussion: Skinning
----------------
'Called when the script is executed
Sub Object_OnScriptEnter
TimerExecuted=0
End Sub
'Called when the script is terminated
Sub Object_OnScriptExit
End Sub
'Called when the object state is changed
Sub Object_OnStateChange(State)
If Object.State = "Command executed" Then
Object.SetTimer 1, 5.6
End If
End Sub
Sub Object_OnTimer1
Script.MsgBox "This should only display once if Timer 1 is being killed."
Object.KillTimer1
End Sub
----------------
Unless my coding is flawed (which is very possible) it appears that the KillTimer even is not working. Why is it not working? Thanks!!
Reply #2 Saturday, August 9, 2003 1:08 PM
Reply #3 Sunday, August 10, 2003 6:20 PM
Could someone else please test the above posted code? It would be very much appreciated. Thanks!Reply #4 Monday, August 11, 2003 6:50 AM
You need:
Object.KillTimer 1
not
Object.KillTimer1
Of course you may have that and just mistyped into the messageboard.
Reply #5 Monday, August 11, 2003 6:57 AM
The problem is that you are showing a msgbox before killing the timer. This basically halts that part of the script until it is responded to. In the meantime there is the potential for another ontimer event to be fired and get to the same point no matter what interval you use.
You just need to move the msgbox bit after the killtimer line so that it kills the timer and then shows the message.
Sub Object_OnTimer1
Object.KillTimer 1
Script.MsgBox "This should only display once if Timer 1 is being killed."
End Sub
Please login to comment and/or vote for this skin.
Welcome Guest! Please take the time to register with us.
There are many great features available to you once you register, including:
- Richer content, access to many features that are disabled for guests like commenting on the forums and downloading skins.
- Access to a great community, with a massive database of many, many areas of interest.
- Access to contests & subscription offers like exclusive emails.
- It's simple, and FREE!







Reply #1 Friday, August 8, 2003 5:19 AM