Equal string in array

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

Moderator: MacroQuest Developers

RudeBoy
orc pawn
orc pawn
Posts: 23
Joined: Wed Mar 24, 2004 7:04 am

Equal string in array

Post by RudeBoy » Thu Apr 29, 2004 6:07 pm

Ok can get a message through to bot, but when he is checking if the Sender is right person from a array of names. He dosent recognize when the right name comes up in Equal string. So im stomped

Code: Select all

#chat tell

Sub Main

:Loop
/doevents
/goto :Loop
/return

Sub Event_Chat(ChatType,Sender,ChatText)

/declare crazy[5] string 
/declare Officount int 
/declare ArrayCount int 
/declare crap string

/varset crazy[1] Kom
/varset crazy[2] Ten
/varset carzy[3] Baz
/varset crazy[4] Ail
/varset crazy[5] Ark
/varset ArrayCount 5

/echo ${Sender}
/for Officount 1 to ${ArrayCount} 
	[color=indigo]/if (${string[${Sender}].Equal[${crazy[${Officount}]}]})[/color] {
		 /echo found it!!
	} else {
/varset crap ${crazy[${Officount}]}
/echo ${crap}
/next Officount
}
/return

Lax
We're not worthy!
We're not worthy!
Posts: 3524
Joined: Thu Oct 17, 2002 1:01 pm
Location: ISBoxer
Contact:

Post by Lax » Thu Apr 29, 2004 6:12 pm

Sender is already a string type, so you dont need to do ${String[${Sender}]}

/if (${Sender.Equal[${crazy[${Officount}]}]}) {

however, i think what you want is
/if (${Sender.Left[3].Equal[${crazy[${Officount}]}]}) {
or
/if (${Sender.Find[${crazy[${Officount}]}]}) {
Lax Lacks
Master of MQ2 Disaster
Purveyor of premium, EULA-safe MMORPG Multiboxing Software
* Multiboxing with ISBoxer: Quick Start Video
* EQPlayNice, WinEQ 2.0

RudeBoy
orc pawn
orc pawn
Posts: 23
Joined: Wed Mar 24, 2004 7:04 am

Post by RudeBoy » Thu Apr 29, 2004 6:27 pm

First line worked - wonderfull Lax, thanks