[Home] [Downloads] [Search] [Help/forum]

Gammon Software Solutions forum

See www.mushclient.com/spam for dealing with forum spam. Please read the MUSHclient FAQ!

[Folder]  Entire forum
-> [Folder]  MUSHclient
. -> [Folder]  VBscript
. . -> [Subject]  Script and waiting
Home  |  Users  |  Search  |  FAQ
Username:
Register forum user name
Password:
Forgotten password?

Script and waiting

[Reply to this subject]  Reply to this subject   [New subject]  Start a new subject   [Refresh] Refresh page


Posted by Gore   (207 posts)  [Biography] bio
Date Wed 10 Sep 2003 12:38 PM (UTC)  quote  ]
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

[Go to top] top

Posted by Gore   (207 posts)  [Biography] bio
Date Reply #1 on Wed 10 Sep 2003 12:40 PM (UTC)  quote  ]
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?
[Go to top] top

Posted by Ked   Russia  (524 posts)  [Biography] bio
Date Reply #2 on Wed 10 Sep 2003 01:58 PM (UTC)  quote  ]
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.
[Go to top] top

Posted by Nick Gammon   Australia  (19,188 posts)  [Biography] bio   Forum Administrator
Date Reply #3 on Wed 10 Sep 2003 10:57 PM (UTC)  quote  ]
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
[Go to top] 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.


3,019 views.

[Reply to this subject]  Reply to this subject   [New subject]  Start a new subject   [Refresh] Refresh page

Go to topic:           Search the forum


[Go to top] top

[Home]

Written by Nick Gammon - 5K

Comments to: Gammon Software support
[RH click to get RSS URL] Forum RSS feed ( http://www.gammon.com.au/rss/forum.xml )

[Best viewed with any browser - 2K]    [Internet Contents Rating Association (ICRA) - 2K]    [Web site powered by FutureQuest.Net]