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 ➜ MUSH Script

MUSH Script

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


Posted by Aatif Sheikh   (2 posts)  Bio
Date Fri 10 Jan 2003 05:49 AM (UTC)
Message
I'm trying to get the below script to repeat an N number of times. Specifically I want to throw a martial hook 5 times, strip the skeleton, and grab the coins. I need the delay in there for the time it takes to recover from an action. Any assistance would be much appreciated.


sub fight
world.addtimer "my_timer", 0, 0, 5, "martial hook at skeleton", 1025, "On_Timer_Fired"
world.setvariable "attack_count", 0
world.send "strip skel"
world.send "get coi"
end sub

sub On_Timer_Fired (strTimerName)
dim count
' count attacks
count = world.getvariable ("attack_count") + 1
if count >= 5 then
world.deletetimer "my_timer"
else
world.setvariable "attack_count", count
end if
end sub
Top

Posted by Rhinoa   United Kingdom  (37 posts)  Bio
Date Reply #1 on Fri 10 Jan 2003 03:17 PM (UTC)
Message
Instead of using a timer, you can do it like this.

Sub Fight (strname, trig_line, arrWildCards)
Dim Count
Do Until Count >= 5
Count = Count + 1
World.doafter 5, "strip skel"
World.doafter 5, "get coi"
Loop
End Sub


~Rhinoa~
Top

Posted by Aatif Sheikh   (2 posts)  Bio
Date Reply #2 on Sat 11 Jan 2003 06:33 AM (UTC)
Message
It didn't work. When I cut and paste, it entered "strip skel" and "get coi" in rapid succession. But it didn't do anything else
Top

Posted by Rhinoa   United Kingdom  (37 posts)  Bio
Date Reply #3 on Sat 11 Jan 2003 01:02 PM (UTC)
Message
What exactly do you mean by "it didn't do anything"?
If you were referring to no pause, then try this:

Sub Fight (strname, trig_line, arrWildCards)
Dim Count
Do Until Count >= 5
if Count = 0 then
World.doafter 5, "strip skel"
World.doafter 5, "get coi"
end if
if Count = 1 then
World.doafter 10, "strip skel"
World.doafter 10, "get coi"
end if
if Count = 2 then
World.doafter 15, "strip skel"
World.doafter 15, "get coi"
end if
if Count = 3 then
World.doafter 20, "strip skel"
World.doafter 20, "get coi"
end if
if Count = 4 then
World.doafter 25, "strip skel"
World.doafter 25, "get coi"
end if
Count = Count + 1
Loop
End Sub


That should *shivers* make it happen every 5 seconds for 25 seconds.

~Rhinoa~
Top

Posted by Nick Gammon   Australia  (23,158 posts)  Bio   Forum Administrator
Date Reply #4 on Sat 11 Jan 2003 10:03 PM (UTC)
Message
Sounds complicated Rhinoa, why not do a multiplication in your main loop? Like this:


Sub Fight (strname, trig_line, arrWildCards)
Dim Count
  For Count = 1 to 5
    world.DoAfter Count * 5, "strip skel"
    world.DoAfter Count * 5, "get coi"
  Next
End Sub

- 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.


20,571 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.