Converting string data to boolean?

Need help with a macro you are writing? Ask here!

Moderator: MacroQuest Developers

overnuker2323
orc pawn
orc pawn
Posts: 18
Joined: Sat Sep 25, 2004 2:06 am

Converting string data to boolean?

Post by overnuker2323 » Sun Sep 26, 2004 8:39 pm

I want to check to see if I have a buff on, and if not... cast it...

I know that ${Me.Buff[Call of Bones]} will return NULL if it's not up, and "Call of Bones" if it is. How do I change this to a boolean value so I can use it in /if commands? I've searched through the help file and am lost atm...

If anyone can point me inthe direction of some more example of how to write /if commands and how to convert string data to boolean (etc) I'd really appreciate it.

Also, is there a way to remove a buff other than clicking on it? I can write the /mouseto and /click left if I really need to, was just wondering if there's an easier way to do it.. Thanks!

-S

SlimFastForYou
a hill giant
a hill giant
Posts: 174
Joined: Sat Jan 24, 2004 1:38 am

Post by SlimFastForYou » Sun Sep 26, 2004 8:57 pm

This should work:

Code: Select all

/if (${Me.Buff["Call of Bones"]}) {
    /echo I have that buff
} else {
    /echo I need that buff
}
An if statement should evaluate to be true if it is non-zero if I'm not mistaken.

User avatar
blueninja
a grimling bloodguard
a grimling bloodguard
Posts: 541
Joined: Thu Aug 28, 2003 7:03 am
Location: Göteborg, Sweden

Post by blueninja » Sun Sep 26, 2004 9:01 pm

${Me.Buff[call of bones].ID}

overnuker2323
orc pawn
orc pawn
Posts: 18
Joined: Sat Sep 25, 2004 2:06 am

Woot!

Post by overnuker2323 » Sun Sep 26, 2004 9:14 pm

Blueninja wins the prize! :) Thanks again, folks!

SlimFastForYou
a hill giant
a hill giant
Posts: 174
Joined: Sat Jan 24, 2004 1:38 am

Post by SlimFastForYou » Mon Sep 27, 2004 3:58 am

Oops, forgot the ID part. My way might have still worked but his was better.