Script and waiting

Posted by Gore on Wed 10 Sep 2003 12:38 PM — 4 posts, 16,019 views.

#0
Hey what's up, in ZMud there's a command called
#WAIT, or #WA and what it does is "pauses" the alias or macro that it's in by the number following it, for instance

if I had an alias called k, and it would do

kill person
#wa 5000
kill nonperson

it would send kill person, wait 5 seconds, and then send kill nonperson to the mud

for my mud, I'm trying to script an auto-milking script, (so I can milk venoms into vials, heh..) Anyway

Here's my first trigger,

Trig: You have recovered balance on all limbs.
Script: Auto_Milk


Sub Auto_Milk (a,b,c)

varVenom = World.GetVariable("Venom")
world.send "milk venom into vial"
'<---- Here I need a 2 second Wait, or Timeout if you will
world.send "secrete " & varVenom

End sub

I tried making a sub like I would in VB, but I pretty much just copied my Timeout sub from one of my VB Programs and tried to convert it to MUSHClient's VBScript, heh

Sub timeout (a,b,duration)

starttime = Timer
Do While Timer - starttime < duration
x = DoEvents()
Loop

End Sub

but apparently that doesn't work, heh

help! :P

#1
Also, Nick can you tell me if you plan to change the macro system so you can macro any key on the keyboard? like alt+ keypad keys, F1, F6?
Russia #2
You can do that using the World.DoAfter callback:


sub Auto_milk (name, output, wildcs)
 dim varVenom
 varVenom = world.getvariable("Venom")

 world.send "milk venom into vial"
 world.DoAfter 2, "secrete " & varVenom
end sub


And the second sub (timeout) won't work indeed, though there's a way to make a scripted timer - it involves using Mushclient timers to check for expiration of a time period set in a script, I use those quite a bit myself. A time loop like the one you tried using will just hang the program.

Concerning the F6 and CTRL-F6 macro: that question was already answered, look back in the recent posts and you'll see it.
Australia Forum Administrator #3
Ked is right about the timers. Good example.

As for the key mapping, I started doing that and it was a lot more complex that it initially looked. For instance, changing the key mappings as you swapped worlds, or changed to the notepad. Storing them somewhere. Changing the menus to reflect the key mapping. Allowing editing. Having defaults. It goes on and on. So, not in the near future. Sorry.