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 ➜ General ➜ Entering commands in the midst of an alias

Entering commands in the midst of an alias

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


Posted by Penguin   (46 posts)  Bio
Date Wed 08 May 2002 02:56 AM (UTC)
Message
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?
Top

Posted by Nick Gammon   Australia  (23,173 posts)  Bio   Forum Administrator
Date Reply #1 on Wed 08 May 2002 03:46 AM (UTC)
Message
Can you explain that a bit more? How are you travelling? Typing in commands? Using a speedwalk? Half-way through a lengthy speedwalk sequence?

- Nick Gammon

www.gammon.com.au, www.mushclient.com
Top

Posted by Penguin   (46 posts)  Bio
Date Reply #2 on Wed 08 May 2002 10:57 AM (UTC)
Message
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?
Top

Posted by Nick Gammon   Australia  (23,173 posts)  Bio   Forum Administrator
Date Reply #3 on Wed 08 May 2002 09:12 PM (UTC)
Message
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.

- Nick Gammon

www.gammon.com.au, www.mushclient.com
Top

Posted by Exodus   (14 posts)  Bio
Date Reply #4 on Fri 10 May 2002 10:29 AM (UTC)
Message
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.
Top

Posted by Magnum   Canada  (580 posts)  Bio
Date Reply #5 on Fri 10 May 2002 09:23 PM (UTC)

Amended on Fri 10 May 2002 09:27 PM (UTC) by Magnum

Message
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. :)

Get my plugins here: http://www.magnumsworld.com/muds/

Constantly proving I don't know what I am doing...
Magnum.
Top

Posted by Magnum   Canada  (580 posts)  Bio
Date Reply #6 on Fri 10 May 2002 09:31 PM (UTC)
Message
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.

Get my plugins here: http://www.magnumsworld.com/muds/

Constantly proving I don't know what I am doing...
Magnum.
Top

Posted by Weston   (28 posts)  Bio
Date Reply #7 on Wed 29 Sep 2004 12:39 PM (UTC)

Amended on Tue 05 Oct 2004 01:44 AM (UTC) by Nick Gammon

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

Posted by Nick Gammon   Australia  (23,173 posts)  Bio   Forum Administrator
Date Reply #8 on Tue 05 Oct 2004 02:01 AM (UTC)
Message
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>


- Nick Gammon

www.gammon.com.au, www.mushclient.com
Top

Posted by Flannel   USA  (1,230 posts)  Bio
Date Reply #9 on Tue 05 Oct 2004 04:34 AM (UTC)
Message
http://www.gammon.com.au/forum/bbshowpost.php?bbsubject_id=4724&page=999999
Has a smaller version of how to do this.

~Flannel

Messiah of Rose
Eternity's Trials.

Clones are people two.
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.


37,348 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.