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.
 Entire forum ➜ MUSHclient ➜ Tips and tricks ➜ Aliases and "label, script, group, variable"

Aliases and "label, script, group, variable"

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


Posted by ErockMahan   (81 posts)  Bio
Date Thu 22 Jul 2004 06:03 PM (UTC)
Message
I'm just starting to get the hang of scripting, and I've already mastered the alias and think it's quite nifty. There are still some things that I do not quite understand.

When I create an alias, at the bottom of the box there are four areas called "label, script, group, and variable" that I don't know what they are for.

It is my hope that I will be able to use an alias to perform a certain function (like k Bob sends "kill bob") and then I'll be able to have it simultaneously access a script that will save Bob as my 'latest conquest' or something like that. I'm lazy, and I don't want to create two alisases to do it, so I'm hoping that the "script" part of the macro list does that.

Does anyone know?
Top

Posted by Shadowfyr   USA  (1,788 posts)  Bio
Date Reply #1 on Thu 22 Jul 2004 07:36 PM (UTC)
Message
Label - is a name for the alias, so you can use scripting to activate/deactivate it.

Script - is just what you think, it is the name of the script subroutine that is called when the alias is matched.

Group - is like name, except you can give a collection of related timers, aliases and triggers the same 'group', thus allowing you to enable/disable them all at once from in the script.

Variable - this is used to take the value of %1 and store it directly in a Mushclient variable. This only happens if you select 'send to variable'.

In any case, yes, you can both send commands and call a script to do other things in the same alias. If what you are trying to do is simple, then you can even set the alias to 'send to script', in which case you would do something like:

send "kill %1"
setvariable "last kill", "%1"

by placing that in the 'send' field instead. The 'send to script' option basically overrides the normal sending and instead feeds the contents to the script engine, where it is interpretted. That is why you have to use 'send' for the commands, instead of just using 'kill %1'.

It also makes creating plugins a bit easier, since the script for the trigger, alias, etc. is automatically copied into the plugin when created. Normally you would have to manually select which lines of your script need to be copied into the new plugin. However, for normal use, it is a matter of personal choice. It is sometimes easier to work on complex scripts that interconnect to each other, especially if you have an alias that just executes different functions. For example, a plugin I made uses a single alias to call a half dozen or more different functions, depending on what follows the main command. Exa: potions:list, potions:add, etc. In such a case it isn't practical (or maybe even possible) to have the whole script inside the alias, so editing it in the main script file is easier. For what you need though, it is just a matter of which one you are more comfortable using.
Top

Posted by Nick Gammon   Australia  (23,100 posts)  Bio   Forum Administrator
Date Reply #2 on Thu 22 Jul 2004 10:27 PM (UTC)
Message
When you are viewing the "edit alias" dialog box press F1 to see the help for aliases. It will explain all that.

The same information is on this web page:

http://www.gammon.com.au/scripts/doc.php?dialog=IDD_EDIT_ALIAS

- Nick Gammon

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

Posted by ErockMahan   (81 posts)  Bio
Date Reply #3 on Thu 11 Aug 2005 04:37 PM (UTC)
Message
Thank you for that information. As you can guess by my tardy response, it was very helpful.

Right now, I am trying to develop a fool-proof (me-proof) blinding spell.

My alias:

blind *

send "cast 'blind' %1"
setvariable "target", "%1"




But I'd like to use the "variable" thingy at the bottom (which is part of what this post was originally about). My alias works just fine, but I'd like to expand my knowledge and use what has been provided for me. I tried putting "target" in the "variable" thingy at the bottom, but it didn't seem to work unless I was sending it to variable. But then it wouldn't execute the "cast 'blind %1" command. How would I do this?
Top

Posted by Flannel   USA  (1,230 posts)  Bio
Date Reply #4 on Thu 11 Aug 2005 08:15 PM (UTC)
Message
Just as you're doing it currently, with a script in your send box, and sending to script.

Triggers/Aliases can do one thing (send to world, send to output, send to variable) unless you're sending to script. And then you can do all of those things, and then some.

Those other things are provided for people who don't want to use scripting. You get much more flexibility with sending to script.

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


21,339 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.