AND / OR

Need some help with that macro you're working on or aren't quite sure how to get your macro to do something? Ask here!

Moderator: MacroQuest Developers

RDPidb
a lesser mummy
a lesser mummy
Posts: 69
Joined: Mon Dec 15, 2003 1:14 am

AND / OR

Post by RDPidb » Mon Feb 02, 2004 2:39 pm

Can I combien these two statements into one?
Like an OR statement?
/if n $char(buff,"Pact of Hate")==0 /call cast "Pact of Hate"
/if n $char(buff,"Pact of Hate"), duration < 40 /call cast "Pact of Hate"

or is it better the way it is ?
Want to recast the buff is it is gone, OR, if the duration is less than 4 minuts remaining ( 40 ticks ?)

Thanks
-Ryan

wassup
Official Guardian and Writer of TFM
Official Guardian and Writer of TFM
Posts: 1487
Joined: Sat Oct 26, 2002 5:15 pm

Post by wassup » Mon Feb 02, 2004 3:20 pm


ml2517
a grimling bloodguard
a grimling bloodguard
Posts: 1216
Joined: Wed Nov 12, 2003 1:12 am

Post by ml2517 » Mon Feb 02, 2004 3:57 pm

I'm guessing your subject isn't exactly what you are looking for. Is this what you had in mind?

Code: Select all

/if n $char(buff,"Pact of Hate")==0 {
    /call cast "Pact of Hate"
} else {
    /if n $char(buff,$char(buff,"Pact of Hate"),duration)<=40 /call cast "Pact of Hate"
}

RDPidb
a lesser mummy
a lesser mummy
Posts: 69
Joined: Mon Dec 15, 2003 1:14 am

oh

Post by RDPidb » Mon Feb 02, 2004 4:55 pm

Thanks ml2517 I didn't have my duration check set up right, I guess it needs to be nested like you did.
its $char(buff, $char(buff, "Pact of Hate"), duration)
and not $char(buff, "Pact of Hate"), duration

so wassup the link you posted loosk a little different than the things Im tryign to use, I am new to this keep in mind and im not 100% sure what im doing, but im learning.

So is this what im lookign for:

/if (n $char(buff, "Pact of Hate") == 0 || n $char(buff, $char(buff, "Pact of Hate"), duration) <=40 ) {
/call cast "Pact of Hate"
}

or is it redundant to even check for the buff to == False when im also checkign if the durration is <= 40, because if the durration = 0 , isnt that essentialy the same as just the buff == FALSE ?

Sorry for the newb questions, just tryign to write this more elegantly that what I got atm.

ml2517
a grimling bloodguard
a grimling bloodguard
Posts: 1216
Joined: Wed Nov 12, 2003 1:12 am

Post by ml2517 » Mon Feb 02, 2004 5:38 pm

You need to do it exactly like I have it shown or you will end up crashing your script on occasion. When you nest the $char(buff's if you dont' have the buff on you it would generate a 0 and then cause the preceding $char(buff to puke.

Doing it the way I have it listed would say.

Do I have the buff? If no rebuff. If yes then, does the buff have less than 4 minutes left on it? If so, rebuff. If I have the buff and it has more than 4 minutes left on it, then do nothing.

RDPidb
a lesser mummy
a lesser mummy
Posts: 69
Joined: Mon Dec 15, 2003 1:14 am

Post by RDPidb » Mon Feb 02, 2004 5:44 pm

OH didnt even think about it like that.
OK, thanks I have an unrelated question Ill start a new thread for it tho.