Help with /if syntax

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

Moderator: MacroQuest Developers

invis
orc pawn
orc pawn
Posts: 10
Joined: Wed Sep 10, 2003 10:17 am

Help with /if syntax

Post by invis » Sun May 09, 2004 12:41 am

Hiya Folks --

Tryin to write a simple merchant checking macro, and having issues with numeric comparisons.

to test the comparison, I'm using the folowing line, after clicking on a Feather in an open merchant window.

Code: Select all

/if (${SelectedItem.ID}==${Merchant.Item[=Feather].ID}) { /echo Yes }
This returns nothing. However, if I change the /if to /echo like:

Code: Select all

/echo (${SelectedItem.ID}==${Merchant.Item[=Feather].ID}) { /echo Yes }
I get

Code: Select all

(13094==13094) {//echo Yes}


in the MQ window, which is what I'd expect to see. So, theoretically, the two IDs are equivalent. Both types come down to ints, according to the posts, if I'm reading it right.

Can anyone shed some light on why a numeric comparison isn't working?

Thanks!

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

Post by ml2517 » Sun May 09, 2004 12:45 am

Your problem is that you can't have your opening curly brace and closing one on the same line, do it like this:

Code: Select all

/if (${SelectedItem.ID}==${Merchant.Item[=Feather].ID}) {
    /echo Yes 
}

Or like this

/if (${SelectedItem.ID}==${Merchant.Item[=Feather].ID}) /echo Yes

invis
orc pawn
orc pawn
Posts: 10
Joined: Wed Sep 10, 2003 10:17 am

Post by invis » Sun May 09, 2004 12:47 am

Well, thanks for settling n00b issue #1 so quickly :oops: