The reason for this is that if you have two players with names that contain the same string, for example you have a toon Joe and a second toon Joey and you want to target Joe. Typing '/target joe' will target joey if he happens to be closer to you. These will match Joe no matter what.
Code: Select all
Sub FindExactSpawnID(string Name)
/declare CurrentID int local
/declare FirstID int local
/declare Counter int local 1
/varset CurrentID ${Spawn[${Name}].ID}
:FESI_FindNext
/if (!${CurrentID} || ${Spawn[id ${CurrentID}].CleanName.Equal[${Name}]}) /return ${CurrentID}
/varset CurrentID ${Spawn[id ${Me.ID}].NearestSpawn[${Counter},${Name}].ID}
/varcalc Counter ${Counter}+1
/goto :FESI_FindNext
/return 0
Code: Select all
Sub TargetExact(string Name)
/declare CurrentID int local
/declare FirstID int local
/declare Counter int local 1
/varset CurrentID ${Spawn[${Name}].ID}
:TE_FindNext
/if (!${CurrentID}) /return 0
/if (${Spawn[id ${CurrentID}].CleanName.Equal[${Name}]}) {
/target id ${CurrentID}
/return
}
/varset CurrentID ${Spawn[id ${Me.ID}].NearestSpawn[${Counter},${Name}].ID}
/varcalc Counter ${Counter}+1
/goto :TE_FindNext
/return

