|
gerry_d98 Beginner
Joined: 05 Sep 2008 Posts: 20
|
Posted: Fri Sep 12, 2008 7:44 am
simple alias question |
I am looking to make an alias for a spell that can have anywhere from one to six targets. What I have currently clearly doesnt work and I am not sure why? This is the XML export of the way I tried to do it right now:
<alias name="vit">
<value>say VITTING %-1 %-2 %-3 %-4 %-5
cast 'vit' %-1
cast 'vit' %-2
cast 'vit' %-3
cast 'vit' %-4
what I would like is to be able to cast vitality on one person, or spell up a whole group with a SAY of who I am spelling up, and if I just want to cast it on one person, it would ignore the other 5 places. for instance:
in the command line here I would be entering "vit Joe Bob Bily Ray Mike Sue"
say VITTING Joe Bob Billy Ray Mike Sue
cast 'vit' Joe
cast 'vit' Bob
cast 'vit' Billy
cast 'vit' Ray
cast 'vit' Mike
cast 'vit' Sue |
|
|
|
gerry_d98 Beginner
Joined: 05 Sep 2008 Posts: 20
|
Posted: Fri Sep 12, 2008 7:52 am |
another thing I cant seem to get right is an autogrouper.
<trigger priority="670">
<pattern>%-1 has just given you</pattern>
<value>group %-1</value>
<trigger priority="440">
<pattern>%-1 is in another group</pattern>
<value>tell %-1 your in another group jackass!</value>
What I am looking for this to do is when cmud receives the string "Gerry has just given you his consent" is for the trigger to group Gerry, and if Gerry is already in a group to send him a tell saying so. In zmud this is exactly how I had the triggers set up but it isnt pulling the name from the begining of the string and placing it in the command? |
|
|
|
gerry_d98 Beginner
Joined: 05 Sep 2008 Posts: 20
|
Posted: Fri Sep 12, 2008 8:29 am |
If I am to understand now, I should be using:
#trigger {^%w has just given you} {group %1}
instead? and then also:
#trigger {^%w is already grouped} {tell %1 You are already grouped!}
is that correct? |
|
|
|
Vijilante SubAdmin
Joined: 18 Nov 2001 Posts: 5182
|
Posted: Fri Sep 12, 2008 10:05 am |
You forgot the parenthesis needed to make a capture. The %w wildcard will match word like characters, but the pattern still needs to know what you want captured. For example you can do captures like this:
^(((%w) is already) grou)ped
which results in
%1=%w is already grou
%2=%w is already
%3=%w
The corrected triggers
Code: |
#trigger {^(%w) has just given you} {group %1}
#trigger {^(%w) is already grouped} {tell %1 You are already grouped!} |
You vit alias is a bit more complex. For this you need to use a loop
Code: |
<alias name="vit">
<value>say VITTING %-1
#LOOP 1,%numparam {cast 'vit' %param(%i)}</value>
</alias? |
The %-1 will have the full parameter list "Joe Bob Billy Ray Mike Sue". The function %numparam has a count of how many parameters were passed. Using the function %param we get each value, this is equivalent to %1, %2, etc. We have to use the function because we want to access a different parameter with each pass of the #LOOP. Make sure you have noticed the difference between %1 and %-1 you can look at the help Predefined Variables and Intorduction to Aliases for some more information. |
|
_________________ The only good questions are the ones we have never answered before.
Search the Forums |
|
|
|
gerry_d98 Beginner
Joined: 05 Sep 2008 Posts: 20
|
Posted: Fri Sep 12, 2008 4:00 pm |
ok thanks a ton. I never understood the %param stuff. This actually helps me with a bunch of other things I want to set up too. So in effect the %param stores every value entered after the alias, then the %i on each instance of the command counts up one position, or one position to the right of the previous value?
and the %numparam is what makes it alias work with any number of paramaters I define , or append to the end of the alias when entering text?
I've looked in the helps and actually now I cant find %-1 explained, and I am not sure why I started using that in the first place. In the past I have always just used %1 but I think when I looked at a script a guildmember sent me he had used %-1 so I tried it not knowing what it was for, and so far it has just sowkred out for me
your help is massively appriciated! |
|
|
|
Rahab Wizard
Joined: 22 Mar 2007 Posts: 2320
|
Posted: Mon Sep 15, 2008 1:11 pm |
#loop 1,n {myloop}
Means repeat myloop, and each time through %i will be the next number in the sequence from 1 to n.
%numparam is the number of parameters following an alias or function.
%param(n) means the nth parameter. %1 is a shorthand for %param(1), etc. |
|
|
|
|
|