Register to post in forums, or Log in to your existing account
 

Play RetroMUD
Post new topic  Reply to topic     Home » Forums » zMUD General Discussion
nazradin
Apprentice


Joined: 23 Mar 2003
Posts: 114
Location: New Zealand

PostPosted: Fri Dec 26, 2003 2:58 pm   

trigger question
 

is it possible to get #if to work in triggers

example below is basic of what i want to achieve , I would like to combine them into 1 trigger and there are a couple of other variables that I would like add


#CLASS {SpellupMaster|Spellsearch}
#TRIGGER {{@deathtext}} {#if (@rt =0) {
search @monster
}}
#TRIGGER {You search (*).} {#T- {Spellsearch}}
#TRIGGER "rtsearch" {{@deathtext}} {#if (@rt >0) {#TEMP {Roundtime: (%d) sec} {#ALA RT +%%1 {search @monster}}}}
#CLASS 0

cheers Naz
Reply with quote
LightBulb
MASTER


Joined: 28 Nov 2000
Posts: 4817
Location: USA

PostPosted: Fri Dec 26, 2003 3:29 pm   
 
#IF does work in triggers.
Triggers which use the same pattern can be combined, so go ahead.
You can add as many variables as you want.

Your example has three triggers with two different patterns and it doesn't look like the two patterns would occur on the same line. You can easily combine the two with identical patterns but you probably can't put all three into a single trigger.

Cheers.
Reply with quote
nazradin
Apprentice


Joined: 23 Mar 2003
Posts: 114
Location: New Zealand

PostPosted: Fri Dec 26, 2003 5:45 pm   
 
ok I combined the 2 triggers but it seems to be ignoring the ifs

#TRIGGER "rtsearch" {{@deathtext}} {#if (@rt =0) {
search @monster
} {#if (@rt >0) {#TEMP {Roundtime: (%d) sec} {#ALA RT +%%1 {search @monster}}}}}


what i want it to do is wait untill i come out of RT if it is induced untill i search. is it something to do with the @rt variable itself?

> prep 702
stance advance
channel at first niirsha
You trace an intricate sign that contorts in the air while forcefully invoking Mana Disruption...
Your spell is ready.
> stance defensive
You are now in an advancing stance.
> You channel at a niirsha.
CS: +123 - TD: +84 + CvA: +25 + d100 roll: +89 == +153 Advantage 64
Warding failed!
A devastating hit.
The niirsha falls to the ground motionless.
search niirsha
Cast Roundtime 3 Seconds.
Roundtime: 3 sec.
...wait 2 seconds.
> ...wait 2 seconds.
stance defensive
You are now in a defensive stance.


the spell is cast off this button just incase it is something there that is wrong

#BUTTON 210 {MD} {#if (@castRT <= 1 and @mana > 1 and @RT <= 1) {#if (@spellskin = "on") {#T+ {Spellsearch}} {#T- {Spellsearch}};#T+ {MDdamage};prep 702;@combatstance;@caster at @thatone @monster;#TEMP {Roundtime: (%d) sec} {#ALA RT +%%1 {stance defensive;#T- {MDdamage}}}}} {} {} {} {} {} {Size} {60} {17} {Pos} {34} {170} {} {} {} {} "" {} {} {} {2}



Naz
Reply with quote
Anabasis
Wanderer


Joined: 26 Jan 2001
Posts: 74

PostPosted: Fri Dec 26, 2003 6:11 pm   
 
I'd try it the other way around.

#TRIGGER "rtsearch" {{@deathtext}} {#if (@rt >0) {#TEMP {Roundtime: (%d) sec} {#ALA RT +%%1 {search @monster}}} {search @monster}}

That way, you only have one if statement to worry about.

Ana
Reply with quote
LightBulb
MASTER


Joined: 28 Nov 2000
Posts: 4817
Location: USA

PostPosted: Fri Dec 26, 2003 10:16 pm   
 
There is nothing in your transcript to indicate that any #IF is being ignored. You haven't given us the values of any of the variables but the transcript does make some educated guesses possible.

In particular, we can easily guess that @rt (or @RT) is 0. The first #IF in the button requires, among other things, that @RT <= 1, and 0 is certainly less than 1, so we can expect the button to work sending several commands and creating a #TEMP trigger.

The first #IF in the "rtsearch" trigger requires that @rt = 0, and 0 certainly equals 0, so we can expect an immediate search when the death text is received. The second #IF in the "rtsearch" trigger requires that @rt > 0, and 0 is not greater than 0, so we can expect that the "rtsearch" trigger won't create a #TEMP trigger.

At this point then, there should be one #TEMP trigger from the button so when the Roundtime message appears we can expect a one-time alarm which sends "stance defensive" to be created. This should be a 3-second alarm and it appears from your transcript that "stance defensive" was sent approximately 3 seconds later.

Since everything appears to work exactly as expected, what is the problem?
Reply with quote
nazradin
Apprentice


Joined: 23 Mar 2003
Posts: 114
Location: New Zealand

PostPosted: Sat Dec 27, 2003 6:29 am   
 

the #if's on the button set the conditions that a spell can be cast

@rt and @castrt =0
and @mana enough mana for a spell

then @spellskin wether or not to search by turning on/off the folder containing the search trigger {@deathtext}, once turned on by the button the search triiger remains active untill i actually search a monster and it turned of by searching messaging.

so assuming that the conditions are met and search trigger is on

I prep and cast a spell at a @monster

this has a number of possible results from missing to outright killing the critter to doing damage that will kill it in the next few minutes

casting a spell also changes @castrt to usually 3 seconds countdown to 0 and has the possibilty to change @rt as well although not always, castrt is soft and i can do other actions rt is hard and i have to wait untill it returns to 0 before i can search or do other actions.

> prep 702
stance advance
channel at first niirsha
You trace an intricate sign that contorts in the air while forcefully invoking Mana Disruption...
Your spell is ready.
> stance defensive
You are now in an advancing stance.
> You channel at a niirsha.
CS: +123 - TD: +84 + CvA: +25 + d100 roll: +89 == +153 Advantage 64
Warding failed!
A devastating hit.
The niirsha falls to the ground motionless.
search niirsha
Cast Roundtime 3 Seconds.
Roundtime: 3 sec.
...wait 2 seconds.
> ...wait 2 seconds.
stance defensive
You are now in a defensive stance.

this cast kills the niirsha, the @deathtext includes "to the ground montionless" and I have generated 3 seconds @rt and @castrt, I am trying to get it to waituntil the hard @rt drops to 0 before it searches otherwise the search action does not work.

does that make my goal clearer?

Naz
Reply with quote
LightBulb
MASTER


Joined: 28 Nov 2000
Posts: 4817
Location: USA

PostPosted: Sat Dec 27, 2003 7:11 am   
 
The problem is not in these triggers. It's in whatever triggers/buttons/aliases/other settings you use to change @rt. You can't change @rt to 3 AFTER the #IF and then complain that the #IF ignored @rt. You need to make the change BEFORE the #IF.
Reply with quote
nazradin
Apprentice


Joined: 23 Mar 2003
Posts: 114
Location: New Zealand

PostPosted: Sat Dec 27, 2003 12:46 pm   
 
quote:
Originally posted by LightBulb

The problem is not in these triggers. It's in whatever triggers/buttons/aliases/other settings you use to change @rt. You can't change @rt to 3 AFTER the #IF and then complain that the #IF ignored @rt. You need to make the change BEFORE the #IF.



@rt is defined by gsl code, when the {@deathtext} trigger is triggered in the example it is 3 , yet it doesn't trigger the temp alarm to pause it 3 seconds before searching


********* @rt =0 *******************
> prep 702
stance advance
channel at first niirsha
You trace an intricate sign that contorts in the air while forcefully invoking Mana Disruption...
Your spell is ready.
> stance defensive
You are now in an advancing stance.
> You channel at a niirsha.
CS: +123 - TD: +84 + CvA: +25 + d100 roll: +89 == +153 Advantage 64
Warding failed!
A devastating hit.
The niirsha falls to the ground motionless.
search niirsha
Cast Roundtime 3 Seconds.
Roundtime: 3 sec.
**************** the above info comes back from game in 1 packet @rt =3 and the text for killing the niirsha that triggers {@deathtext} *****
...wait 2 seconds.
> ...wait 2 seconds.
stance defensive
You are now in a defensive stance.


I understand what you are saying but I dont see how it applies as if @rt is greater than 0 it is at the same time as the trigger for seaching is activated.

Naz
Reply with quote
nazradin
Apprentice


Joined: 23 Mar 2003
Posts: 114
Location: New Zealand

PostPosted: Sat Dec 27, 2003 2:15 pm   
 
well I got it to work by seperating the trigger again and putting them in different folders and adding another folder switch to my cast button.

#CLASS {Loot|Spellsearch}
#TRIGGER {You search (*).} {#T- {Spellsearch}}
#TRIGGER "rtsearch" {{@deathtext}} {search @monster}
#CLASS 0

#CLASS {Loot|RTsearcher}
#TRIGGER {{@deathtext}} {#TEMP {Roundtime: (%d) sec} {#ALA RT +%%1 {search @monster}}}
#TRIGGER {You search (*).} {#T- {RTsearcher}}
#CLASS 0


button text:
#if (@castRT <= 1 and @mana > 1 and @RT <= 1) {
#if (@spellskin = "on" and @caster = cast) {#T+ {Spellsearch}} {#if (@spellskin = "on" and @caster = channel) {#T+ {RTsearcher}}} {
#T- {Spellsearch}
#T- {RTsearcher}
}
#T+ {Character|Alakhi|spells|Spellbuttons|MDdamage}
prep 702
@combatstance
@caster at @thatone @monster
#TEMP {Roundtime: (%d) sec} {#ALA RT +%%1 {
stance defensive
#T- {Character|Alakhi|spells|Spellbuttons|MDdamage}
}}
}

why i couldnt put them in the same folder even though they are the same i dont know.


Naz
Reply with quote
LightBulb
MASTER


Joined: 28 Nov 2000
Posts: 4817
Location: USA

PostPosted: Sat Dec 27, 2003 8:51 pm   
 
Despite your perception that roundtime should be 3, the action of the trigger makes it clear that in your original script @rt was still 0. This is a timing issue and depends entirely on whether the trigger goes off before or after @rt is updated.

If there will always be a roundtime (or at least a roundtime message) with the death message then you should include that in your trigger to ensure that you get the proper timing. This can be done with a multi-state trigger.
#TR "rtsearch" {{@deathtext}}
#COND {^Roundtime: (%d)} {#IF (%1 > 0) {#ALA RT +%1 {search @monster}} {search @monster}}

You should note that since you gave the same ID to this alarm and the alarm from the button, one of them will overwrite the other and you will only get one of the two commands. I can't be certain which command will be overwritten, but I think it's most likely that you'll always get the "stance" command and never get the "search" command. Since that's probably not what you want, you should remove the #TEMP trigger from the button script.
Reply with quote
Display posts from previous:   
Post new topic   Reply to topic     Home » Forums » zMUD General Discussion All times are GMT
Page 1 of 1

 
Jump to:  
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

© 2009 Zugg Software. Hosted by Wolfpaw.net