Alias questions

Posted by Woodspiral on Mon 05 Jul 2021 09:00 AM — 3 posts, 14,199 views.

#0
Hi,

I'm very new to MUSH so please be gentle if I've overlooked something in the documentation. I'm coming from MUDlet where things are similar but very different :-)

First question - how to use an alias inside another one? For example suppose I have an alias pg * which expands to 'open pocket; get %1 from pocket; close pocket'. I now want to define another alias mlg which expands to 'pg mirror; enter mirror'. (This is from CthulhuMUD where I'm entering the Mirror of Leng - believe me it is possible :-)

Second question - how to introduce a small delay in an alias. The FAQ says "3. For aliases, you can check "queue command" which will make the alias output be sent at the speedwalk delay." Where is that checkbox? I don't see it in the alias GUI panel.

Cheers,
Woodspiral.
Australia Forum Administrator #1
Hello and welcome!

Quote:

how to use an alias inside another one?


In the alias dialog set "send to" to "Execute" and then the output of the alias is sent back to the command processor. In other words, an alias can call another alias.




Quote:

how to introduce a small delay in an alias.


That sounds like a documentation error. There is an option to send to "World (speedwalk delay)" in the Send box. That could introduce a delay.

Alternatively you could send to "script" and use a script like DoAfter.

For example:


Send ("quaff potion")        -- do this now
DoAfter (2, "bandage self")  -- do this after 2 seconds


There are more sophisticated ways of adding delays, see http://www.gammon.com.au/forum/?id=4956

A simple example, using "send to script" could be:


require "wait"

wait.make (function ()  --- coroutine below here

  Send ("quaff potion")  -- do this now
  wait.time (2)          -- wait 2 seconds
  Send ("bandage self")  -- do this after 2 seconds
  wait.time (1)          -- wait another second
  Send ("slap self")     -- now send this

end)  -- end of coroutine
Amended on Mon 05 Jul 2021 11:15 AM by Nick Gammon
#2
Most excellent, thank you. I opted for send to script and DoAfter.

Cheers,
Woody