Page 1 of 1

comparing strings ....

Posted: Sat Apr 24, 2004 12:16 pm
by eqjoe
The old way of comparing strings does not work. So, how would one rewrite this using MQ2Data?

Code: Select all

/newif (${Me.Buff[1]}=="Seduction of Saryrn") {
			/click left 995 130
	}
Basicly I am checking for lich in buffslot 1 and clicking it off....

The post by Lax in announcements seem to say that :

Code: Select all

/newif (${Me.Buff[1].Equal[Seduction of Saryrn]}) {
			/click left 995 130
	}
Is what I am looking for. But this dosnt work.

Any ideas?



[/code]

Posted: Sat Apr 24, 2004 12:36 pm
by Preocts
Well. Reading the posts Lax worked so hard on in the announcement forums:
Lax wrote: character
...buff Buff[slot]: The buff in this slot (1-15)
...buff Buff[name]: Finds buff with this name
buff
...int ID: Spell ID
...int Level: Level
...spell Spell: Spell
...float Mod: Bard song modifier
...ticks Duration: Duration
- To String: Same as Spell.Name
If Buff[name] is of type buff that means we can do Buff[name].ID which returns an int. Ints work in numarical comparisons so I guess we could just do this:

Code: Select all

/if (${Me.Buff["Seduction of Saryrn"].ID}) /click whatever
btw, you might also want to read the changes.txt and look for information concerning /click

Posted: Sat Apr 24, 2004 12:39 pm
by eqjoe
Ok.. figured this out...

Code: Select all

${Me.Buff[1]}
Returns the name of the buff in slot one.

Code: Select all

${Me.Buff[1].Name}
Does the same damn thing

So

Code: Select all

${Me.Buff[1].Name.Equal[Seduction of Sayrn]}

Is what I am looking for.

Posted: Sat Apr 24, 2004 12:42 pm
by eqjoe
k in numarical comparisons so I guess we could just do this:

Code: Select all

/if (${Me.Buff["Seduction of Saryrn"].ID}) /click whatever
How would that identify the buff in slot 1?

Posted: Sat Apr 24, 2004 12:42 pm
by Preocts
We're cross posting and hopefully you read my edited-non-bitch post not the first one :wink:

Code: Select all

${Me.Buff[1].Equal["whatever"]
will give you the same results as

Code: Select all

${Me.Buff[name].ID}
Since if that buff is there ID will not equal 0 or NULL and the if statement will be TRUE. If the buff isn't there ID will equal 0 or NULL making the if statement FALSE. This is the beauty of the new system.

Edit Yet again: Okay, I see your reason for the string compare. The spell TLO doesn't have a .slot member which I, for some reason, thought it did. :oops: