decreasing seconds in a timer crashes mushclient

Posted by Faolong on Thu 31 Oct 2002 02:57 PM — 9 posts, 28,131 views.

USA #0
i pinned down the problem to the fact that if i used AddTimer and had it on replaced option to decrease the seconds, it would crash mushclient, i also tried the new SetTimerOption("name", "seconds", "5") from 16 seconds to 5 seconds and it would just crash... oh yeah, i am calling the function from the same timer and the function is the one that is changing the seconds of the timer, but it doesn't crash if i increase the seconds though... weird
Australia Forum Administrator #1
It is:

SetTimerOption "name", "second", "5"

("second" not "seconds").

I can't reproduce that. My test keeps working, and a check of the code doesn't reveal why it should crash. Do you have more than one timer?

I don't understand this bit "used AddTimer and had it on replaced option to decrease the seconds".

What did you do exactly?
USA #2
Yeah i did the "second" one i just mistyped it... you know when you AddTimer there is a flag to replace the timer and i think it was 1024 so i used that with that flag plus temporary + oneshot + enabled. i put the replace there just in case it was still there, it would replace it...

i'll clarify the process more:
first i have this timer called "auction_countdown" with a 16 second time which calls a script called auction_countdown... in the script i have
world.AddTimer("auction_countdown", 0, 0, 3, "", 17409, "auction_countdown"); which decreases the seconds from 16 to 3... and then it would just crash. i also tried world.SetTimerOption("auction_countdown", "second", "3"); instead of the AddTimer and it would just crash.
USA #3
okay, i found the problem if i named the timer "auction_countdown1" it doesn't crash and if i named it "auction_countdown" it crashed... maybe because the script function is also called "auction_countdown"....
USA #4
okay this is some weird stuff, but if i named the timer "auction_countdown_timer" it will crash... seems like any other naming method works except that one and the "auction_countdown" one....
Australia Forum Administrator #5
What I think is probably happening here is that MUSHclient is "walking" a list of timers to fire.

The timer calls a script, the script replaces the timer, effectively deleting and re-adding an entry in the timer list.

Depending on the name of the timer, ie. whether it has already passed it in the list, it now processes a deleted timer.

I suggest you use the settimeroption, rather than the "delete myself" approach.
USA #6
i actually tried both and they both seem to crash on me having the timer name "auction_countdown" and "auction_countdown_timer"... now i am just using SetTimerOption("auction_countdown1", "second", 3);
Australia Forum Administrator #7
Are you saying you are using SetTimerOption, and it works, or it doesn't work?
USA #8
SetTimerOption("auction_countdown", "second", 3); <--- doesn't work
SetTimerOption("auction_countdown_timer", "second", 3); <--- doesn't work
SetTimerOption("auction_countdown1", "second", 3); <--- works

the only difference is in the naming, and a lot of other ones work... it's just those two, that i have found, that doesn't work