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
Murdlih
Beginner


Joined: 17 Dec 2001
Posts: 24
Location: USA

PostPosted: Thu Dec 20, 2001 5:15 am   

Breaking from a trigger (or other option)
 
here is my deal. when a skill fails for me, I get a message that says so. chances are I am doing one of two things. if I am not, i want to repeat the last command. so I have a trigger that goes off of "Your skill fails"
here is what i tried before I realized it won't work.

#if (@hiding = 1) {hide}
#if (@dissecting =1) {dissect corpse} {!!}

obviously the reason it doesn't work is regardless of hiding, in the dissecting check it will still repeat the last command. Is there a way for me to fix this?
Reply with quote
Murdlih
Beginner


Joined: 17 Dec 2001
Posts: 24
Location: USA

PostPosted: Thu Dec 20, 2001 6:16 am   
 
Also, what is the syntax for executing multiple commands in an if statement, i.e.

#if (@isflag = 1) {int, get all from corpse, dissect corpse}
Reply with quote
Murdlih
Beginner


Joined: 17 Dec 2001
Posts: 24
Location: USA

PostPosted: Thu Dec 20, 2001 7:49 am   
 
once again I am stuck somewhere...
brief description of what I am trying to do: attack target if I have enough CP (action points)

HP: ~[(%d)/(%d)~] CONC: ~[(%d)/(%d)~] //trigger
#VAR curhp %1 // This is all reading my HP and CP
#VAR maxhp %2
#VAR curcp %3
#VAR maxcp %4
#if (@curcp > @mincp OR @curcp = @mincp)
{lowcp = 0} {lowcp = 1} //determines if I have enough cp

#if (@lowcp = 0 //enough action points
AND @isflag = 1 //I have a target in mind
AND @hiding = 0 //I am not already trying to hide
AND @hidden = 0 //I am not currently hidden
AND @combat = 0) //I am not currently in combat
{edih} //My alias to start off the attacking

I have this under my HP and Action point reader so that if I flag someone, but don't have enough CP, it will wait for this trigger to start attacking. the only thing is it never gets called, even when I verify the variables. If anyone can help point me in the right direction, I would appreciate it. thanks.
Reply with quote
Acaila
Apprentice


Joined: 30 Aug 2001
Posts: 187
Location: Netherlands

PostPosted: Thu Dec 20, 2001 9:12 am   
 
quote:
HP: ~[(%d)/(%d)~] CONC: ~[(%d)/(%d)~] //trigger
#VAR curhp %1 // This is all reading my HP and CP
#VAR maxhp %2
#VAR curcp %3
#VAR maxcp %4
#if (@curcp > @mincp OR @curcp = @mincp)
{lowcp = 0} {lowcp = 1} //determines if I have enough cp


Looks like you made a typo:
#if (@curcp > @maxcp OR @curcp = @maxcp)

Which could be shortened to:
#if (@curcp >= @maxcp)

If it was intentional and not a typo, then be sure to define mincp somewhere.
Otherwise the code looks sound to me.

Acaila
Reply with quote
Crymson4
Novice


Joined: 20 Nov 2001
Posts: 35
Location: USA

PostPosted: Thu Dec 20, 2001 5:03 pm   
 
quote:
#if (@curcp > @mincp OR @curcp = @mincp)

to which you replied Acalia

#if (@curcp > @maxcp OR @curcp = @maxcp)



I would think your reply is wrong Acalia. He wants to do the action if his current CP is greater than or equal to his minimum value, not his maximum value. If that were the case, the trigger would only fire if his CP were maxed. Personally, I wouldn't attack at 0CP, so I would simply shorten the trigger to
#IF (@CurCP>MinCP) {do true stuff} {do false stuff if any}

That way, you won't attack at 0 CP (though you will attack at 1)

Hope this helps.

-=Crymson

Reality is the effect of alcohol deficiency
Reply with quote
Troubadour
GURU


Joined: 14 Oct 2000
Posts: 556
Location: USA

PostPosted: Thu Dec 20, 2001 6:19 pm   
 
quote:

here is my deal. when a skill fails for me, I get a message that says so. chances are I am doing one of two things. if I am not, i want to repeat the last command. so I have a trigger that goes off of "Your skill fails"
here is what i tried before I realized it won't work.

#if (@hiding = 1) {hide}
#if (@dissecting =1) {dissect corpse} {!!}

obviously the reason it doesn't work is regardless of hiding, in the dissecting check it will still repeat the last command. Is there a way for me to fix this?



Nest the two statements.
#IF @hiding {hide} {#IF @dissecting {dissect corpse} {!!}}

quote:

Also, what is the syntax for executing multiple commands in an if statement, i.e.

#if (@isflag = 1) {int, get all from corpse, dissect corpse}



Separate the commands with semi-colons.
#IF (@isflag = 1) {int; get all from corpse; dissect corpse}

With regard to your problem with action points, where does the variable @mincp come from? If you wanted, you could choose to set your minimum cp as 10% of maximum cp. In this case your statement could be:

#IF (@curcp >= %eval(@maxcp/10)) {#VAR lowcp 1} {#VAR lowcp 0}



Troubadour
Reply with quote
Murdlih
Beginner


Joined: 17 Dec 2001
Posts: 24
Location: USA

PostPosted: Thu Dec 20, 2001 6:30 pm   
 
Thanks for trying to help guys, but I have no problem setting that part (and you are correct, if I set mincp based on whatever I am trying to kill, and if I have enough cp to kill it, then lowcp is false) The problem is with the last part of the code, the part that should start fighting when lowcp is changed from true to false. I suppose I can live without it. I am not going to cut and paste all my triggers, the problem is probably somewhere where I have variables/other triggers set wrong. Thanks for trying though...

Also, what is the syntax for performing more than one action in an if? I.E.

#if (@blah = 1) {tupper = 1, say I changed tupper to @tupper} {tupper = 0, say I changed tupper to @tupper}

oops, never mind, I think i figured it out. semicolons, right?

Anyone have any input on my first question?

I want three possible outcomes, if hiding is true, hide, if hiding is not true, but dissecting is, dissect, if neither hiding or dissecting is true, then !! (repeat last command)
Reply with quote
Troubadour
GURU


Joined: 14 Oct 2000
Posts: 556
Location: USA

PostPosted: Thu Dec 20, 2001 6:56 pm   
 
Re-read my post.

Troubadour
Reply with quote
LightBulb
MASTER


Joined: 28 Nov 2000
Posts: 4817
Location: USA

PostPosted: Thu Dec 20, 2001 7:05 pm   
 
Troubadour answered your first two questions.

HP: ~[(%d)/(%d)~] CONC: ~[(%d)/(%d)~] //trigger

#VAR curhp %1 // This is all reading my HP and CP
#VAR maxhp %2
#VAR curcp %3
#VAR maxcp %4
#if (%3 > @mincp OR %3 = @mincp)
{lowcp = 0} {lowcp = 1}
#if ((%3 >= @mincp) AND (@isflag = 1) AND (@hiding = 0) AND (@hidden = 0) AND (@combat = 0)) {edih}

I took out all the comments, it didn't seem like a good idea having them in the middle of your #IF condition. I also switched to a direct test of the current CP (from the prompt via %3) rather than depending on a variable that's being altered by the same trigger.

LightBulb
Reply with quote
Murdlih
Beginner


Joined: 17 Dec 2001
Posts: 24
Location: USA

PostPosted: Thu Dec 20, 2001 7:11 pm   
 
thanks guys! Troub, you answered as i was asking.

You guys are such a big help to little guys like me with silly problems.

Thanks alot. It is now accomplishing everything that I want!
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