|
Nariel Newbie
Joined: 24 Jan 2006 Posts: 7 Location: USA
|
Posted: Tue Jan 24, 2006 6:31 pm
an alias and a variable/trigger question |
I have two pretty basic questions, which is why it irks me that I can't figure it out on my own. I recently switched over and am getting used to the system. First question:
Through my alias adventures, I found that if the input part of it has more than one word it wouldn't translate it. I tried surrounding the alias in ( and {, but neither would work. Here's a rough example of what I'm doing:
#ALIAS kick me {say kick me!}
Second question is about variables. I wanted a variable that would choose any object inside the expansion, but I don't think I have it right. This would be like:
#VAR person {Joe|Mary|James}
I also substituted the | with commas and "or"
The trigger's pattern is set to
@person is dead
But under the test section it substitutes the @person for whatever I entered in brackets for my variable's definition, and when I substitute that for any one of their names, such as "Joe is dead" it won't match.
Thanks to anyone who answers this, and hopefully this will be a fun transition. |
|
|
|
Larkin Wizard
Joined: 25 Mar 2003 Posts: 1113 Location: USA
|
Posted: Tue Jan 24, 2006 8:30 pm |
For the alias, you need to code the alias as the first word in the command and then check parameters internally. (Or build a command input trigger, which I almost never recommend.)
Code: |
#ALIAS kick {#if (%1 == me) {say Kick me!} {~kick %-1}} |
If you want to use a string list variable in a pattern of a trigger, you'll need to turn on "Allow wildcards in trigger patterns" in your preferences and then enclose the list in curly braces.
Code: |
#VAR person {Joe|Mary|James}
#TRIGGER {{@person} is dead} {say Someone I know is dead} |
|
|
|
|
Nariel Newbie
Joined: 24 Jan 2006 Posts: 7 Location: USA
|
Posted: Tue Jan 24, 2006 10:01 pm |
My trigger is firing perfectly now, thanks a lot.
I picked a bad example for my alias though. An emote with a LIV inherent was bad on my part. What I'm looking for is a way to just set the input of my alias as two words. I use that mostly for speedwalks, and when the area names are more than one word, I like to keep them that way. A more suitable example would be #ALIAS {new area} {(directions)}, where directions will be substituted for actual directional aliases. I also need this for various setting changes on my character, so learning how to make a speedwalk the way zMUD wants me to wouldn't solve my problem.
Thanks again for answering my question and keep up the good work. |
|
|
|
MattLofton GURU
Joined: 23 Dec 2000 Posts: 4834 Location: USA
|
Posted: Tue Jan 24, 2006 10:40 pm |
Quote: |
If you want to use a string list variable in a pattern of a trigger, you'll need to turn on "Allow wildcards in trigger patterns" in your preferences and then enclose the list in curly braces.
|
Actually, no. For a variable, {@variable} works regardless of this preference. This setting is only if you want to include actual wildcards in your stringlist, like so:
{%w arrives|%w leaves|%w begs for mercy}
As for the alias question, use %-1 to refer to the entire commandline. %1...%99 will match to any one-word items separated by whitespace, whereas %-1...%-99 will match that word position as well as everything after:
SomeAlias This is "a test"
%1 = This
%2 = is
%3 = a test
%-1 = This is a test
%-2 = is a test |
|
_________________ EDIT: I didn't like my old signature |
|
|
|
Nariel Newbie
Joined: 24 Jan 2006 Posts: 7 Location: USA
|
Posted: Tue Jan 24, 2006 11:49 pm |
I believe your variables have a good place in various triggers and cases that I will most likely end up making later, but as far as I know I wouldn't need to refer to something if I'm only making an alias. The %# and %-# variables only work if you are using them in the context of a script, not mearly defining an alias. What I'm looking for is how to define the input for my alias to recognize both words. If I enter the id of the alias as "new area", when I enter "new area" into the command box it only recognizes "new" and then procedes to yell at me because it doesn't know what the word "new" means. I have tried to contain the command using "new area", (new area), and {new area}, but none of these would work. If it's more difficult than I first thought with my experiments then I might just have to give up and just name my alias "newarea".
|
|
|
|
Nariel Newbie
Joined: 24 Jan 2006 Posts: 7 Location: USA
|
Posted: Wed Jan 25, 2006 4:20 am |
I'm sorry everyone, I know what you meant now. Larkin, in your alias code I automatically thought you were assigning a target variable inside of the alias, instead of setting a condition if another word comes behind the alias. I guess it just took me a whole day devoted to researching and practicing coding to realize what you were doing. Sorry I wasted your time. But at least I learned about %1 and %-1 because of it.
|
|
|
|
MattLofton GURU
Joined: 23 Dec 2000 Posts: 4834 Location: USA
|
Posted: Wed Jan 25, 2006 10:53 pm |
Another interesting little tidbit with aliases is that if you have more words in your alias line than you have defined parameters the extra words are sent to the mud along with whatever command you do:
#alias boo {say %item("You suck|Go back to the minors|Get your eyes checked",%random(1,3)), }
>boo ref!
You suck, ref!
You exclaim, "You suck, ref!" |
|
_________________ EDIT: I didn't like my old signature |
|
|
|
|
|