|
Tvesh Newbie
Joined: 13 May 2002 Posts: 6 Location: Belgium
|
Posted: Mon May 13, 2002 11:31 pm
Scripting Question |
#TRIGGER {Affects : &temp} {
#if !%null( item.affect1) {
item.affect1 = @temp
}; #abort 1
#if !%null( item.affect2) {
item.affect2 = @temp
}; abort 1
#if !%null( item.affect3) {
item.affect3 = @temp
}; abort 1
}
What's wrong with this trigger? The thing i'm trying to get is that the value of the temp variable is given to &item.affect1 if &item.affect1 doesn't have a value yet. Otherwise it should be given to &item.affect2 if that's still empty. Failing that it should be given to &item.affect3. The thing is that this trigger will launch up to 3 times, and each time the output of the mud is different and needs to be put into a different record.
I hope i'm making sense here. (see my other post a little down from here...i'm still trying to capture the Affects lines from an identify and store them into 3 fields, affect 1-3) |
|
|
|
LightBulb MASTER
Joined: 28 Nov 2000 Posts: 4817 Location: USA
|
Posted: Tue May 14, 2002 12:46 am |
You have it backwards then. !%null(item.affect1) is true if there IS something in affect1. You need to remove the ! from all your #IF conditions.
The way you have it now, the trigger will stop when it reaches the first #ABORT 1 command, since it's not part of the preceding #IF command. Personally, I don't like the #ABORT command and I'd go with nested #IFs instead, but it's your script so I've done it the way you prefer.
#TRIGGER {Affects : &temp} {#if (%null( item.affect1)) {item.affect1 = @temp;#abort 1};#if (%null( item.affect2)) {item.affect2 = @temp;#abort 1};#if (%null( item.affect3)) {item.affect3 = @temp;#abort 1}}
It's not a good idea to start a new topic and then refer immediately to your previous topic. If we need to see your previous topic to understand this one, it would be much easier if you'd just done a reply to the original topic.
LightBulb
Vague questions get vague answers |
|
|
|
Tvesh Newbie
Joined: 13 May 2002 Posts: 6 Location: Belgium
|
Posted: Tue May 14, 2002 1:00 am |
Sorry for starting a new thread, i didn't mean to break nettiquette or anything.
Anyway, i finally got a way around it. All i need now is a way to capture the line following a triggerline.
For instance:
Contains Level 4 spell of:
Cure Critic
--> Here i can only trigger on the first line, but isn't there a way to then capture the 2nd line? (I'm thinking i'll need $, but i can't figure out how it works.)
Thanks for all your support anyway, sorry to be such a nuissance :( |
|
|
|
LightBulb MASTER
Joined: 28 Nov 2000 Posts: 4817 Location: USA
|
Posted: Tue May 14, 2002 5:16 am |
You're not a nuisance. In fact, your questions show that you're actively trying to understand.
You're right about the $ sign. It's used to make multi-line triggers. In this case you'll want to use it to mark the end of the first line, then have your wildcard, then use it again to indicate the wildcard should capture the whole line.
#TR {Contains Level %d spell of:$(*)$} {#VAR spell {%1}}
LightBulb
Vague questions get vague answers |
|
|
|
Tvesh Newbie
Joined: 13 May 2002 Posts: 6 Location: Belgium
|
Posted: Tue May 14, 2002 11:43 am |
Thanks! That did the trick! There's only one thing i don't really understand about this. How come %1 in this trigger has the value of * (the second line), while actually the first variable you capture is %d (the level of the spell)? I would have expected something more along the lines of:
#var level %1
#var spell %2 |
|
|
|
Kjata GURU
Joined: 10 Oct 2000 Posts: 4379 Location: USA
|
Posted: Tue May 14, 2002 3:19 pm |
You don't capture %d. Notice that %d is not surrounded by parenthesis, but * is.
Kjata |
|
|
|
|
|