Entering commands in the midst of an alias

Posted by Penguin on Wed 08 May 2002 02:56 AM — 10 posts, 39,407 views.

#0
Let's say I was traveling from one place to another.. and I wish to disrupt traveling and do a command. Is there anyway to do that without the use of speedwalk?

Also.. after the disruption.. is there anyway I can get finish up my traveling and get to my destination?
Australia Forum Administrator #1
Can you explain that a bit more? How are you travelling? Typing in commands? Using a speedwalk? Half-way through a lengthy speedwalk sequence?
#2
Ok.. if I used an alias to travel.. and in the midst of travelling.. someone attacks me and I have to stop to heal.
Is there anyway of stopping to heal then resuming my path?
Australia Forum Administrator #3
I presume you mean travelling with a speedwalk and a time-delay, otherwise the commands would already have been sent.

Someone else was asking about this, and as a result there is a new scripting function World.GetQueue. This gets the queue into an array. So, with a small amount of scripting you could:

  1. Make an alias "interrupt" (for example) that:
    • Gets the queue using World.GetQueue
    • Discards the queue using World.DiscardQueue
  2. Do your fighting
  3. Make a second alias "resume" that:
    • Uses the previously-saved queue
    • Requeus it using World.Queue


That should do the trick.
#4
While we're on this subject of doing commands while speedwalking and resuming, i would like to ask if its possible to speedwalk, and have a trigger to do a command halfway when you see something.

For example, to stop automatically at A fiery dragon when you see it along your path, then continue on your way after you have killed it.
Canada #5
Typically, No.

Once you start "speedwalking", any new commands are added to the end of the speedwalk stack. Even a scripted "send" will append the text to the end of the speedwalk.

I have witnessed triggers fire while I am speedwalking, but the text they have commanded be sent to the mud do not get sent until the speedwalk is delayed.

You could, of course, write your own script to workaround this. You script would prabably parse a string of multiple commands, and send each one after a timer had fired.

Sub MySpeedWalk
  'build an array with the list of commands to send to the mud.
  'make a MySpeedWalkTimer to fire after a delay.

Sub OnMySpeedWalk  '<- Called by the timer.
  'Send the next command.
  'Is there another command to be sent?
    'Yes? Make another MySpeedWalkTimer.
    'No? Do nothing

That's the basic psuedocode... You could then build "flags" into it, to shut off when an event (trigger) occurs. You might check for the flag before "Send the next command", and abort if need be.

The downside to this is you can only make timers with a whole number of seconds, so you can't set the delay to a fraction of a second... Almost anything is possible via scripting, so you may even be able to work around that. :)
Amended on Fri 10 May 2002 09:27 PM by Magnum
Canada #6
Hmm... I'm a bit of a dolt. Nick provided you with the answer.

Instead of an alias, use would use a trigger to halt the speedwalk.
#7
How, specifically would I do as Nick suggests?

  1. Make an alias "interrupt" (for example) that:
    • Gets the queue using World.GetQueue
    • Discards the queue using World.DiscardQueue
  2. Do your fighting
  3. Make a second alias "resume" that:
    • Uses the previously-saved queue
    • Request it using World.Queue




The best I could do was:

dim speedwalkQueue
dim iCount

speedwalkQueue = World.GetQueue

If Not IsEmpty (speedwalkQueue) Then
for iCount = lbound (speedwalkQueue) to ubound (speedwalkQueue)
world.addalias "", "resume", speedwalkQueue (iCount), eEnabled or eAliasSpeedWalk, ""
discardqueue
next
End If


The problem is that instead of getting one alias named 'resume' with ten directions, I end up with ten different aliases named 'resume' each having only one direction apiece.
Amended on Tue 05 Oct 2004 01:44 AM by Nick Gammon
Australia Forum Administrator #8
I didn't mean to create an alias for each speedwalk, I meant to save them all in a variable, and then have a single alias to restore that. This should work:


<aliases>
  <alias
   match="interrupt"
   enabled="y"
   send_to="12"
   sequence="100"
  >
  <send>speedwalkQueue = World.GetQueue

If IsEmpty (speedwalkQueue) Then
  SetVariable "interrupted_commands", ""
Else
  oldqueue = GetVariable ("interrupted_commands")
  If oldqueue &lt;&gt; "" Then
    oldqueue = oldqueue &amp; "~"
  End If
  SetVariable "interrupted_commands", oldqueue &amp; Join (speedwalkQueue, "~")
  ColourNote "white", "blue", CStr (UBound (speedwalkQueue) + 1) &amp; " speedwalk(s) now saved."

End If

DiscardQueue


</send>
  </alias>
  <alias
   match="restore"
   enabled="y"
   send_to="12"
   sequence="100"
  >
  <send>commands_list = GetVariable ("interrupted_commands")

If commands_list &lt;&gt; "" Then
  commands = Split (commands_list, "~")
  For Each item In commands
     world.Queue item, vbTrue
  Next
  ColourNote "white", "blue", CStr (UBound (commands) + 1) &amp; " speedwalk(s) restored."
   SetVariable "interrupted_commands", ""
Else
  ColourNote "white", "blue", "No saved speedwalks."
End If

</send>
  </alias>
</aliases>

USA #9
http://www.gammon.com.au/forum/bbshowpost.php?bbsubject_id=4724&page=999999
Has a smaller version of how to do this.