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

Play RetroMUD
Post new topic  Reply to topic     Home » Forums » CMUD General Discussion
Ggoss
Apprentice


Joined: 01 Nov 2006
Posts: 114

PostPosted: Wed May 28, 2008 9:39 pm   

Need help with this trigger
 
basically after i take a certain amount of dmg, i get berserked, and if I flee, i will attack the person/mob in the next room, i want to set it so that if i'm berserked and i flee, that i immediatly kneel.

was thinking something like a yes no variable.
#tr {Your instincts force you into a BloodLust!} {#var berserked "yes"}
#tr {Your blood cools, and you no longer see targets everywhere.} {#var berserked "no"}

that part i'm not sure how to get it to do is the if then statement off the variable berseked =yes or =no
#tr {You flee (%w)!} {#if (@berserked=yes) (kneel)}

Does this seem like it would work? I'm trying to write this for a friend, so can't actually test it in the mud cuz i don't have a character that can do this.
Reply with quote
charneus
Wizard


Joined: 19 Jun 2005
Posts: 1876
Location: California

PostPosted: Wed May 28, 2008 9:46 pm   
 
If you would do it correctly, yes.

But to clean up your code a bit...

#TRIGGER {Your instincts force you into a Bloodlust!} {#var berserked 1}
#TRIGGER {Your blood cools, and you no longer see targets everywhere.} {#var berserked ""}
#TRIGGER {You flee %w!} {#IF @berserked {kneel}}

The changes I've made: As long as something populates the berserked variable, then it'll always fire "true" (or in your case, yes). Therefore, there's no need for it to equal yes or no. You're not capturing the direction, so no need for parentheses around the %w. You're only using it as a wildcard. All #IF statements are formatted like so: #IF (expression) {true} {false}. The {false} doesn't need to be there if you don't have any actions associated with it. But in your example, you had kneel enclosed in parentheses, not brackets.

Hope this helps.

Charneus
Reply with quote
Toxic
Adept


Joined: 27 May 2008
Posts: 299

PostPosted: Wed May 28, 2008 9:46 pm   
 
Code:

#TR {Your instincts force you into a BloodLust!$} {#VAR berserked 1}
#TR {Your blood cools, and you no longer see targets everywhere.$} {#VAR berserked 0}
#TR {You flee %w!$} {#IF (@berserked) {kneel}}
Reply with quote
Toxic
Adept


Joined: 27 May 2008
Posts: 299

PostPosted: Wed May 28, 2008 9:49 pm   
 
charneus wrote:
If you would do it correctly, yes.

#TRIGGER {You flee %w!} {#IF @berserked {kneel}}

All #IF statements are formatted like so: #IF (expression) {true} {false}.

Charneus


Laff.
Reply with quote
charneus
Wizard


Joined: 19 Jun 2005
Posts: 1876
Location: California

PostPosted: Wed May 28, 2008 9:58 pm   
 
Not sure what you're "laffing" at. ;) The @berserked doesn't need to be in parentheses. It doesn't hurt to have it that way, but it'll work just fine the way I have it. ;)

Charneus
Reply with quote
Toxic
Adept


Joined: 27 May 2008
Posts: 299

PostPosted: Wed May 28, 2008 10:04 pm   
 
I know, just thought it comical that you stated ALL #IF statements, then totally did something else in your code. I know it will work, but if the person needing help caught it it could be confusing to him.
Reply with quote
Ggoss
Apprentice


Joined: 01 Nov 2006
Posts: 114

PostPosted: Wed May 28, 2008 10:13 pm   
 
thanks guys, the if statement help files aren't very clear on it, but this works great now.
Reply with quote
Display posts from previous:   
Post new topic   Reply to topic     Home » Forums » CMUD 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