Register forum user name Search FAQ

Gammon Forum

Notice: Any messages purporting to come from this site telling you that your password has expired, or that you need to verify your details, confirm your email, resolve issues, making threats, or asking for money, are spam. We do not email users with any such messages. If you have lost your password you can obtain a new one by using the password reset link.

Due to spam on this forum, all posts now need moderator approval.

 Entire forum ➜ MUSHclient ➜ VBscript ➜ Script and waiting

Script and waiting

It is now over 60 days since the last post. This thread is closed.     Refresh page


Posted by Gore   (207 posts)  Bio
Date Wed 10 Sep 2003 12:38 PM (UTC)
Message
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

Top

Posted by Gore   (207 posts)  Bio
Date Reply #1 on Wed 10 Sep 2003 12:40 PM (UTC)
Message
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?
Top

Posted by Ked   Russia  (524 posts)  Bio
Date Reply #2 on Wed 10 Sep 2003 01:58 PM (UTC)
Message
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.
Top

Posted by Nick Gammon   Australia  (23,133 posts)  Bio   Forum Administrator
Date Reply #3 on Wed 10 Sep 2003 10:57 PM (UTC)
Message
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.

- Nick Gammon

www.gammon.com.au, www.mushclient.com
Top

The dates and times for posts above are shown in Universal Co-ordinated Time (UTC).

To show them in your local time you can join the forum, and then set the 'time correction' field in your profile to the number of hours difference between your location and UTC time.


12,149 views.

It is now over 60 days since the last post. This thread is closed.     Refresh page

Go to topic:           Search the forum


[Go to top] top

Information and images on this site are licensed under the Creative Commons Attribution 3.0 Australia License unless stated otherwise.