zmud/nexus #wait → mudlet
Posted: Tue Jul 07, 2009 12:25 pm
Some clients offer a #wait function, which will "pause" the script for a certain amount of time before allowing it to continue.
Mudlet doesn't provide that; it uses timers instead. Timers are better because they are easier to work with (they can be named/enabled/disabled), are less prone to buggy implementations (zmuds, for example, isn't great) and are more flexible.
Timers work a bit differently - instead of freezing the script for a certain amount of time, they don't freeze anything, but run a command in a certain time in the future.
So for example, a pseudocode #wait script:
with a timer, becomes
Would be the basic one-to-one translation. But since timers don't freeze the script, you can create several different ones, you can disable and enable them back - which will be a very helpful thing in the future and less code for you to write.
The syntax for using a timer is like this:
[quote]tempTimer (time to wait in seconds, [
Would be the following in Mudlet:
Since timers are created instantly, if you want two or more, or means the times for consecutive timers should be to the starting point, unlike relatives times you do with waits:
Hope that helped! Post comments/questions below.
Mudlet doesn't provide that; it uses timers instead. Timers are better because they are easier to work with (they can be named/enabled/disabled), are less prone to buggy implementations (zmuds, for example, isn't great) and are more flexible.
Timers work a bit differently - instead of freezing the script for a certain amount of time, they don't freeze anything, but run a command in a certain time in the future.
So for example, a pseudocode #wait script:
Code: Select all
do something
#wait 1000
do something2
Code: Select all
do something
set a timer for 1 second to "do something2"
The syntax for using a timer is like this:
[quote]tempTimer (time to wait in seconds, [
Code: Select all
], and optionally a name)[/quote]
So a nexus code of:
[code]#send jerk fish
#wait 1500
#send pull line
Code: Select all
send ("jerk fish")
tempTimer (1.5, [[send ("pull line")]])
Code: Select all
#send jerk fish
#wait 1500
#send pull line
#wait 500
send jump
Code: Select all
send ("jerk fish")
tempTimer (1.5, [[send ("pull line")]])
tempTimer (2, [[send ("jump")]])