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
➜ Calling an Alias from an Alias
Calling an Alias from an Alias
|
It is now over 60 days since the last post. This thread is closed.
Refresh page
Posted by
| Boca
(15 posts) Bio
|
Date
| Thu 19 Jul 2001 10:10 PM (UTC) |
Message
| Why can't I call an Alias in another alias?
Here is the first: alias lb
send look at board
and it works fine.
The second: alias grid
send goto 3070
lb
this will take me to the right room, but lb is not being translated to "look at board".
What am I doing wrong?
Thanks,
Boca
Here is the second: grid | Top |
|
Posted by
| Nick Gammon
Australia (23,133 posts) Bio
Forum Administrator |
Date
| Reply #1 on Fri 20 Jul 2001 12:55 AM (UTC) |
Message
| I didn't want to make aliases recursive (one alias call another for a couple of reasons):
- If you rename the 'lb' alias then the other one ('grid') will stop working, maybe unexpectedly
- The whole idea of aliases is to let you type things quickly in the heat of the moment. However when you are setting up the alias you hopefully have got more time on your hands, so you can just type the word in full. It also makes it easier to see what the alias does.
|
- Nick Gammon
www.gammon.com.au, www.mushclient.com | Top |
|
Posted by
| Dubthach
(47 posts) Bio
|
Date
| Reply #2 on Mon 23 Jul 2001 02:43 PM (UTC) |
Message
| I like the idea of having aliases being able to call each other. Perhaps there could be a special escape character...like the @ before a variable used in an alias or trigger?
It could be useful if you had a common activity that you used both singly and in another activity.
For instance, on a mud I play, sometimes I often have to dual my "default weapon", using an alias like this:
dwp
sec @second
But I also use area portals, which requires switching items around:
useportal *
hold %1
enter
dwp
and...there could be more, but this is the third I came up with:
useam
hold amulet
enter
dwp
If I wanted to add addition stuff to my "dwp" alias, I'd only have to change it in the one place. Without the ability to call aliases from aliases, I'd either have to script something, or change it at least three times. Changing it in three places is kind of ugly. :)
Anyway, just some thoughts. | Top |
|
Posted by
| Nick Gammon
Australia (23,133 posts) Bio
Forum Administrator |
Date
| Reply #3 on Mon 23 Jul 2001 10:23 PM (UTC) |
Message
| It is on my list of things to do. :) |
- Nick Gammon
www.gammon.com.au, www.mushclient.com | Top |
|
Posted by
| Neurowiz
(17 posts) Bio
|
Date
| Reply #4 on Sat 19 Oct 2002 08:41 PM (UTC) |
Message
| I've looked for this topic in more recent posts and the release notes, so pardon me if I've missed this.
I think this would be a valuable feature. I have combat scripts that work on the basis of aliases being resuable "chunks" of actions. Like in my world, I have to fill pipes, light pipes and empty pipes, as well have a trigger for lighting a pipe when it goes out. Usually, when I fill a pipe, I would like to light it. Rather than copy code from the light pipe alias, and have 2 sets of code to maintain, I would rather have my fill pipe alias call the light pipe alias.
Any ideas on how I could do this easily, if we can't have alias's call each other?
Regards... | Top |
|
Posted by
| Magnum
Canada (580 posts) Bio
|
Date
| Reply #5 on Sat 19 Oct 2002 09:46 PM (UTC) |
Message
| The standard way to currently do what you want is to call scripts. You don't have to be a super-talented programmer to write very simple stuff like this.
Sub Light_Pipe (AliasName, AliasLine, arrWildcards)
World.Send "light pipe"
End Sub
Sub Refill_Pipe (TriggerName, TriggerLine, arrWildcards)
World.Send "empty pipe"
World.Send "fill pipe with tobacco"
Light_Pipe TriggerName, TriggerLine, arrWildcards 'We are calling the "Light_Pipe" subroutine which expects 3 arguments.
End Sub
The last line of the subroutine "Refill_Pipe" calls the "Light_Pipe" subroutine.
Now, if you want to perform a batch of actions from several places (IE: Aliases and Triggers), then you simply call the same subroutine from those various sources.
The above example uses VisualBasicScript, which in my opinion is the easiest to learn. |
Get my plugins here: http://www.magnumsworld.com/muds/
Constantly proving I don't know what I am doing...
Magnum. | Top |
|
Posted by
| Nick Gammon
Australia (23,133 posts) Bio
Forum Administrator |
Date
| Reply #6 on Sat 19 Oct 2002 10:44 PM (UTC) |
Message
|
Quote:
Any ideas on how I could do this easily, if we can't have alias's call each other?
My standard suggestion here is to use variable expansion. eg.
Have a variable "lightpipe" which does what you need to light it, eg.
"lightpipe" =
get match
light match
put match to pipe
breath deeply
(or whatever)
Then in your "lightpipe" alias just do this:
@lightpipe
Make sure you check "expand variables".
Then in your "fillpipe" alias, do your stuff to fill the pipe, and on the last line:
@lightpipe
Now if you ever need to change how the pipe is lit you just change one spot - the variable.
|
- Nick Gammon
www.gammon.com.au, www.mushclient.com | Top |
|
Posted by
| Arana
(20 posts) Bio
|
Date
| Reply #7 on Thu 02 Sep 2010 05:39 PM (UTC) |
Message
| i dont know if execute was not present when this question was asked but i see you can achieve this using
world.
Execute ("alias1")
Execute ("alias2")
etc.
| Top |
|
Posted by
| Twisol
USA (2,257 posts) Bio
|
Date
| Reply #8 on Thu 02 Sep 2010 05:45 PM (UTC) |
Message
| Execute was added in v3.35, which was released in 2003. The latest version at the time this thread began was v3.15. :) |
'Soludra' on Achaea
Blog: http://jonathan.com/
GitHub: http://github.com/Twisol | 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.
27,538 views.
It is now over 60 days since the last post. This thread is closed.
Refresh page
top