MUSH Script

Posted by Aatif Sheikh on Fri 10 Jan 2003 05:49 AM — 5 posts, 24,574 views.

#0
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
United Kingdom #1
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~
#2
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
United Kingdom #3
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~
Australia Forum Administrator #4
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