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
➜ Pausing
It is now over 60 days since the last post. This thread is closed.
Refresh page
| Posted by
| James Friel
(1 post) Bio
|
| Date
| Tue 10 Apr 2001 09:06 PM (UTC) |
| Message
| Now that i finally got into the forums i want to find out how to put a pause into your script file. I have a simple script to attack a target over and over, but i need a 5 second pause inbetween each attack to match up with the built in 5 second pause of the game.
my basic script is like this
sub fight
dim icounter
for icounter=1 to 500
world.send "attack target"
next
end sub
not this lets me attack the target 500 times in a row, but i need a pause after the world.send line, but i don't know how to put pauses into the script. i looked about alot, but didn't find any in-script commands to do this.
help! he he . thanks. | | Top |
|
| Posted by
| Nick Gammon
Australia (23,165 posts) Bio
Forum Administrator |
| Date
| Reply #1 on Tue 10 Apr 2001 10:20 PM (UTC) Amended on Tue 10 Apr 2001 10:21 PM (UTC) by Nick Gammon
|
| Message
| You can't easily pause a script as such, because scripts are supposed to run as fast as possible, otherwise the whole program would slow down.
However what you can do is do it a bit differently. A simple solution is to use a timer.
sub fight
world.addtimer "my_timer", 0, 0, 5, "attack target", 1025, "On_Timer_Fired"
world.setvariable "attack_count", 0
end sub
What this code will do is add a timer called "my_timer" that fires every 5 seconds. When it fires it sends "attack target". Also when it fires it calls "On_Timer_Fired". This counts up to 500 for you.
sub On_Timer_Fired (strTimerName)
dim count
' count attacks
count = world.getvariable ("attack_count") + 1
if count >= 500 then
world.deletetimer "my_timer"
else
world.setvariable "attack_count", count
end if
end sub
This script counts the number of times the timer fired, and when it reaches 500 deletes it. You could also make another trigger which matches on when your target is killed, which calls a trigger script that deletes the timer also, something like this:
sub On_Target_Dead (strTriggerName, strTriggerLine, aryWildcards)
world.deletetimer "my_timer"
end sub
|
- Nick Gammon
www.gammon.com.au, www.mushclient.com | | Top |
|
| Posted by
| Buji
(4 posts) Bio
|
| Date
| Reply #2 on Tue 26 Feb 2002 01:17 AM (UTC) |
| Message
| |
| Posted by
| Neurowiz
(17 posts) Bio
|
| Date
| Reply #3 on Fri 25 Oct 2002 02:35 PM (UTC) |
| Message
| No offense, but that seems like an awful lot of work when all I may want is just a simple pause in a script before moving on.
Take for instance, Achaea - you have "balances" where you can't slam potions one after another. You have to wait. Now if I'm writing a fighting alias, I may want to do something like this:
take a potion
(pause for 2 seconds to wait for balance)
take the 2nd potion
rub some salve
eat something
Now to make 3 functions, and one timer, to do just a pause in an alias or even a script, just seems like overkill. No offense meant.
I guess I would suggest that we have something similar to Zmud where we could do that. Sure, we can use scripting, but it would be nice to just stick that in the alias itself... or have a simple "pause/wait" that would be stuck in the script or alias.
Regards,
Neurowiz | | Top |
|
| Posted by
| Nick Gammon
Australia (23,165 posts) Bio
Forum Administrator |
| Date
| Reply #4 on Sat 26 Oct 2002 12:03 AM (UTC) Amended on Sat 26 Oct 2002 12:04 AM (UTC) by Nick Gammon
|
| Message
| Sure, you can do a simple thing like that, simply ... :)
Have the alias call a small script like this:
sub MyAliasScript (a, b, c)
world.send "take a potion"
world.doafter 2, "take the 2nd potion"
world.doafter 3, "rub some salve"
world.doafter 3, "eat something"
end sub
What this does is immediately take the potion, wait 2 seconds, and take the second one, wait a further second (a total of 3 seconds) rub the salve and immediately eat something.
This isn't very complex.
The alias needs 3 arguments, since we aren't using them I am calling them "a", "b" and "c" to save typing. |
- 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.
31,705 views.
It is now over 60 days since the last post. This thread is closed.
Refresh page
top