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 ➜ alias inside an alias

alias inside an alias

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


Posted by Val   (27 posts)  Bio
Date Sat 03 Nov 2012 10:24 PM (UTC)

Amended on Sat 03 Nov 2012 10:30 PM (UTC) by Val

Message
Hi

I've had a look as the faq item 38 where it describes adding an alias into an alias, unfortunately I don't get it. I did try checking the send to: Execute at the bottom section of the alias box, but that did not seem to work.

I have an alias where I memorise a spell, and I want to add an alias which I have that sends out an emote of them finishing

so by typing ms fireball the alias will send "memorize fireball" then sends "closes his book and stands"

This is what I wrote

<aliases>
  <alias
   match="ms *"
   enabled="y"
   send_to="12"
   sequence="100"
  >
  <send>

Send ("memorize %1")

DoAfter (2,"emotebook")

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


Thanks as always

Val
Top

Posted by Nick Gammon   Australia  (23,165 posts)  Bio   Forum Administrator
Date Reply #1 on Sat 03 Nov 2012 10:29 PM (UTC)

Amended on Sat 03 Nov 2012 10:31 PM (UTC) by Nick Gammon

Message
You need to send "emotebook" to execute, like this:


<aliases>
  <alias
   match="ms *"
   enabled="y"
   send_to="12"
   sequence="100"
  >
  <send>

Send ("memorize %1")

DoAfterSpecial (2, "emotebook", sendto.execute)

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



Template:function=DoAfterSpecial DoAfterSpecial

The documentation for the DoAfterSpecial script function is available online. It is also in the MUSHclient help file.



"Execute" re-evaluates aliases (which I presume emotebook is) whereas Send (or DoAfter) does not evaluate aliases.

- Nick Gammon

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

Posted by Val   (27 posts)  Bio
Date Reply #2 on Sun 04 Nov 2012 07:58 AM (UTC)
Message
Thank you!

Val
Top

Posted by Val   (27 posts)  Bio
Date Reply #3 on Sun 04 Nov 2012 01:48 PM (UTC)
Message
A follow on question if you will

one of my alias has a random function, inside that I want to delay its response by a few seconds.

I can get it to work without a delay, but as the output is quick it looks strange.

Currently I have this


<aliases>
  <alias
   match="standbook"
   enabled="y"
   expand_variables="y"
   send_to="12"
   sequence="100"
  >
  <send>things = {"slowly", "stretches then stands", "picks himself up", "glances at his book before tucking it away and standing"}


colour = {"%^GREEN%^", "%^BOLD%^%^WHITE%^", "%^YELLOW%^", "%^BOLD%^%^BLUE%^", "%^BOLD%^%^CYAN%^"}

SetVariable ("colour", colour [math.random (1, #things)])

local colour = GetVariable("colour")

Send ("emote " .. colour,"places the book to one side and ", things [math.random(1, #things)], " stands")</send>
  </alias>
</aliases>


what I would like is something like this


<aliases>
  <alias
   match="standbook"
   enabled="y"
   expand_variables="y"
   send_to="12"
   sequence="100"
  >
  <send>things = {"slowly", "stretches then stands", "picks himself up", "glances at his book before tucking it away //r//n DoAfter (2, "stand slowly")"}


colour = {"%^GREEN%^", "%^BOLD%^%^WHITE%^", "%^YELLOW%^", "%^BOLD%^%^BLUE%^", "%^BOLD%^%^CYAN%^"}

SetVariable ("colour", colour [math.random (1, #things)])

local colour = GetVariable("colour")

Send ("emote " .. colour,"places the book to one side and ", things [math.random(1, #things)], " stands")</send>
  </alias>
</aliases>


In this cast the stand is a normal social emote for the mud, but I may want to add in my own alias there instead.

Can you advise me how to make it work?

Thanks

Val
Top

Posted by Nick Gammon   Australia  (23,165 posts)  Bio   Forum Administrator
Date Reply #4 on Sun 04 Nov 2012 11:57 PM (UTC)
Message
How do you want it to look? Can you just show an example? eg.


Nick places the book to one side and stretches then stands.

< 2 second pause>

Nick stands.


Is that what you mean?

- Nick Gammon

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

Posted by Val   (27 posts)  Bio
Date Reply #5 on Mon 05 Nov 2012 11:35 AM (UTC)
Message
yes

just like that

Val
Top

Posted by Nick Gammon   Australia  (23,165 posts)  Bio   Forum Administrator
Date Reply #6 on Mon 05 Nov 2012 07:16 PM (UTC)
Message
Something like what you had with DoAfter in it:


<aliases>
  <alias
   match="standbook"
   enabled="y"
   expand_variables="y"
   send_to="12"
   sequence="100"
  >
  <send>

things = {"slowly", "stretches then stands", "picks himself up", "glances at his book before tucking it away and standing"}


colour = {"%^GREEN%^", "%^BOLD%^%^WHITE%^", "%^YELLOW%^", "%^BOLD%^%^BLUE%^", "%^BOLD%^%^CYAN%^"}

SetVariable ("colour", colour [math.random (1, #things)])

local colour = GetVariable("colour")

Send ("emote " .. colour,"places the book to one side and ", things [math.random(1, #things)])

DoAfter (2, "stands")
</send>
  </alias>
</aliases>


- Nick Gammon

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

Posted by Val   (27 posts)  Bio
Date Reply #7 on Mon 05 Nov 2012 10:15 PM (UTC)
Message
Hi

The only problem I had with that was it sent 'stand' for all of them. I was hoping it may be possible to somehow have it for just one item in the list which is why I tried to place DoAfter inside the things list.

The last one in the list reads
'glances at his book before tucking it away and standing',

but should read
'glances at his book before tucking'
followed by the two second delay before 'stand' is sent.

The rest of the list is fine without sending the stand command by itself.

Hope you can follow that

Thanks

Val
Top

Posted by Nick Gammon   Australia  (23,165 posts)  Bio   Forum Administrator
Date Reply #8 on Mon 05 Nov 2012 11:03 PM (UTC)

Amended on Mon 05 Nov 2012 11:04 PM (UTC) by Nick Gammon

Message
Well, something like this then:


<aliases>
  <alias
   match="standbook"
   enabled="y"
   expand_variables="y"
   send_to="12"
   sequence="100"
  >
  <send>

things = {
   {now = "slowly"},
   {now = "stretches then stands"},
   {now = "picks himself up"},

   {now = "glances at his book before tucking it away", 
    soon = "stands"},


-- more here
  } -- end of things


colour = {"%^GREEN%^", "%^BOLD%^%^WHITE%^", "%^YELLOW%^", "%^BOLD%^%^BLUE%^", "%^BOLD%^%^CYAN%^"}

SetVariable ("colour", colour [math.random (1, #colour)])

local colour = GetVariable("colour")
local which = math.random(1, #things)
Send ("emote " .. colour,"places the book to one side and ", things [which].now)

if things [which].soon then
  DoAfter (2, things [which].soon)
end -- if
</send>
  </alias>
</aliases>



I've changed your table to have things done "now" and "soon" (a table within a table).

It does the "now" stuff first, and then after two seconds the "soon" stuff (if any).

- Nick Gammon

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

Posted by Val   (27 posts)  Bio
Date Reply #9 on Tue 06 Nov 2012 08:32 PM (UTC)
Message
Works a treat.

Thanks for your time

Val
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.


29,936 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.