|
notoriousBOB Beginner
Joined: 18 Feb 2004 Posts: 13 Location: USA
|
Posted: Wed Apr 14, 2004 4:57 am
creating a trigger in an alias using variables |
Alright i'm sure there is somethign really really simple that will make this work :)
Basically here is my dilemma
I made an alias called target, which i want to create a set of permanent triggers and aliases. It does this by prompting for information, and then creating the triggers using the variables of the responses. The only problem is it is creating triggers with the variables themselves, instead of the contents of the variables. I have a feeling all i need to do is change some syntax :) But i've tried for a while and thought i would ask for a bit of help.
here's what i have
when i type target, the following is executed
#PR longname "Enter the long name of the NPC (A strong man)"
#PR shortname "Enter the short name of the NPC (man)"
#TRIGGER {@longname} {sh @shortname}
#TRIGGER {@shortname is in perfect shape} {kill @shortname}
what i am getting is a exactly what it says
#TRIGGER {@longname} {sh @shortname}
#TRIGGER {@shortname is in perfect shape} {kill @shortname}
but assuming @longname = a strong man, and @shortname = man
what i would want is
#TRIGGER {a strong man} {sh man}
#TRIGGER {man is in perfect shape} {kill man}
so i could use this alias over and over again to add new targets, and the triggers for the old targets would still be there
Thank you much everyone!
The Notorious BOB
www.notoriousbob.co.nr |
|
|
|
jessew Apprentice
Joined: 03 Mar 2003 Posts: 141
|
Posted: Wed Apr 14, 2004 5:24 am |
Yeah we just had this topic a bit ago, and unless im overlooking something the only way to do this is to string build the trigger
then execute it, because variables are allowed to be part of both the pattern and command.
String building will allow the variable to be expanded before #trigger is actually executed.
For example:
#alias maketrig {
#pr longname "Enter the long ..."
#pr shortname "Enter the short..."
#EXEC %concat("#TRIGGER {",@longname,"} {sh ",@shortname,"}")
}
Jesse |
|
|
|
jessew Apprentice
Joined: 03 Mar 2003 Posts: 141
|
Posted: Wed Apr 14, 2004 5:30 am |
Your other option is to write another alias that makes the trigger
like this.
#alias firstpart {
#pr longname "Enter the long ..."
#pr shortname "Enter the short..."
secondpart @longname @shortname
}
#alias secondpart {
#trigger {%1} {sh %2}
}
That works too
Jesse |
|
|
|
notoriousBOB Beginner
Joined: 18 Feb 2004 Posts: 13 Location: USA
|
Posted: Wed Apr 14, 2004 5:34 am |
Awesome!
I tried the first and it works great. I am implementing the second one... I think i blinked and you answered :)
like I said,
Awesome Jessew, Awesome.
the notorious bob |
|
|
|
LightBulb MASTER
Joined: 28 Nov 2000 Posts: 4817 Location: USA
|
Posted: Wed Apr 14, 2004 4:37 pm |
You could also use #EXEC.
#AL target {
#PR longname "Enter the long name of the NPC (A strong man)"
#PR shortname "Enter the short name of the NPC (man)"
#EXEC {
#TRIGGER {@longname} {sh @shortname}
#TRIGGER {@shortname is in perfect shape} {kill @shortname}
}} |
|
|
|
jessew Apprentice
Joined: 03 Mar 2003 Posts: 141
|
Posted: Wed Apr 14, 2004 6:08 pm |
Doh, Even Better
|
|
|
|
notoriousBOB Beginner
Joined: 18 Feb 2004 Posts: 13 Location: USA
|
Posted: Wed Apr 14, 2004 11:30 pm |
i tried it, and it didnt work unless it was spaced properly like lightbulb has it.... Just wanted to let that be known to anyone else that is using something like that :)
notorious bob,
www.notoriousbob.co.nr |
|
|
|
|
|