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

Gammon Forum

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

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

MUSH Script

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


Posted by Aatif Sheikh   (2 posts)  [Biography] 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
[Go to top] top

Posted by Rhinoa   United Kingdom  (37 posts)  [Biography] 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~
[Go to top] top

Posted by Aatif Sheikh   (2 posts)  [Biography] 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
[Go to top] top

Posted by Rhinoa   United Kingdom  (37 posts)  [Biography] 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~
[Go to top] top

Posted by Nick Gammon   Australia  (21,322 posts)  [Biography] 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
[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.


6,742 views.

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

Go to topic:           Search the forum


[Go to top] top

Quick links: MUSHclient. MUSHclient help. Forum shortcuts. Posting templates. Lua modules. Lua documentation.

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

[Home]


Written by Nick Gammon - 5K   profile for Nick Gammon on Stack Exchange, a network of free, community-driven Q&A sites   Marriage equality

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

[Best viewed with any browser - 2K]    [Hosted at FutureQuest]