|
murklin Newbie
Joined: 01 Apr 2009 Posts: 7
|
Posted: Tue May 05, 2009 9:57 am
Wondering how to do this |
I'm trying to make leveling a bit easier by adding stuff that I come across to a variable, which I can then attack with a simple numpad macro instead of having to type out 'kill bla blah'
I figured out how to do it with #additem target monster , but it's a bit cumbersome having to make 50 triggers for each one, so I was attempting to use data string to get it to work so I could just make a huge list of possible targets stored in an array then have it add the ones that are present to a targets variable, and remove them as they die or when I move.
Being inexperienced, I can't seem to figure out how to get them from the possible targets variable into the targets variable.
Here's what I have just as an example: for possible targets it's
Code: |
#var possibletargs {A small bird here, eating seeds.=a small bird|A squirrel is here, scurrying about.=a small squirrel|A pigeon flutters past your head.=a pigeon}
|
that possibletargs is set to data record to separate what keywords it would use when actually attacking.
So I just need help with the trigger that will add the @possibletargs in the room to @target
Code: |
#TRIGGER {^({@possibletargs})$} {
target=%additem( %db( @possibletargs, %1), @target)
#SUB {%1 %ansi(red)(target: %db( @possibletargs, %1))}
} "" {disable}
|
With that trigger what happens when I see, say, a squirrel is:
A squirrel is here, scurrying about. (target: ) but it doesn't actually add the mob to the @target variable :/
I also have this to remove the target from my @target :
Code: |
#TRIGGER {^Your blood freezes as you hear (*)'s death cry.$} {#DELN target %ismember( %1, @target)} |
|
|
|
|
murklin Newbie
Joined: 01 Apr 2009 Posts: 7
|
Posted: Tue May 05, 2009 11:05 am |
apparently it was as simple as adding quotes around %1
sigh
Which will lead me to my next question, how does one use wildcards in an array?
For example, {A %1 chipmunk is here.=A %1 chipmunk}
is that possible? |
|
|
|
MattLofton GURU
Joined: 23 Dec 2000 Posts: 4834 Location: USA
|
Posted: Tue May 05, 2009 9:44 pm |
First, make sure the appropriate preference is turned on. I believe it's in the Scripting/Parsing section, and says something like "Used wildcards in stringlists".
Second, you just use the wildcard in the appropriate place. Most of the same rules as trigger wildcards apply, though you can't use the [range] or the {stringlist} constructs within stringlists. See the Pattern matching helpfile for proper use and meaning of wildcards.
Third, A %1 chipmunk is here.=A %1 chipmunk is not valid. This is what you see in the script view for a datarecord variable, but in the actual data the equal sign is an unprintable ascii character. If you insert A %1 chipmunk is here.=A %1 chipmunk into your target variable, the variable will contain that exact string instead of just the stuff to the left or right.
What I would do in this case is to use #LOOPDB and the pattern-matching operator (=~):
#loopdb @Possibletargs {#if ("%key" = "whatever you want to match") {stuff to do if it matches} {stuff to do if it doesn't match, probably left blank or omitted}} |
|
_________________ EDIT: I didn't like my old signature |
|
|
|
|
|
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum
|
|