inc.mac works!(Thanks Lax)

Need some help with that macro you're working on or aren't quite sure how to get your macro to do something? Ask here!

Moderator: MacroQuest Developers

Dr. Blunderpants
orc pawn
orc pawn
Posts: 25
Joined: Fri Dec 19, 2003 5:29 pm

inc.mac works!(Thanks Lax)

Post by Dr. Blunderpants » Sun Apr 25, 2004 5:11 am

inc.mac

Code: Select all

Sub main()
/declare index global
/declare casters global
/declare npcid global
/varset index 1
/varset casters 0
:mainloop
/varcalc npcid ${Target.NearestSpawn[@index,npc radius @Param0].ID}
/if (${Spawn[@npcid].Speed}<71.44) {
/if (${String[${Spawn[@npcid].Class}].Equal[Shaman]}) /varset casters @casters+1
/if (${String[${Spawn[@npcid].Class}].Equal[Cleric]}) /varset casters @casters+1
/if (${String[${Spawn[@npcid].Class}].Equal[Druid]}) /varset casters @casters+1
/if (${String[${Spawn[@npcid].Class}].Equal[Enchanter]}) /varset casters @casters+1
/if (${String[${Spawn[@npcid].Class}].Equal[Wizard]}) /varset casters @casters+1
/if (${String[${Spawn[@npcid].Class}].Equal[Necromancer]}) /varset casters @casters+1
/if (${String[${Spawn[@npcid].Class}].Equal[Magician]}) /varset casters @casters+1
/if (${String[${Spawn[@npcid].Class}].Equal[Beastlord]}) /varset casters @casters+1
/if (${String[${Spawn[@npcid].Class}].Equal[Paladin]}) /varset casters @casters+1
/if (${String[${Spawn[@npcid].Class}].Equal[Shadowknight]}) /varset casters @casters+1
/if (${String[${Spawn[@npcid].Class}].Equal[Ranger]}) /varset casters @casters+1
/goto :skip
}
/if (${String[${Spawn[@npcid].ID}].Equal[${Target.ID}]}) {
/chat #@Param1 [${Int[@index]}] - Incoming -> ${Spawn[@npcid].CleanName} <-- TARGET
/goto :skip
}
/chat #@Param1 [${Int[@index]}] - Incoming -> ${Spawn[@npcid].CleanName}
:skip
/varcalc index @index+1
/if (${String[${Target.NearestSpawn[@index,npc radius @Param0].ID}].Equal[NULL]}) /goto :end
/goto :mainloop
:end
/if (@index>0) /chat #@Param1 Total incoming: ${Int[@index]} mob(s).
/endmacro
Results are:
[1] - Incoming -> an orc centurion <-- TARGET
[2] - Incoming -> an orc centurion
[3] - Incoming -> an orc centurion
Total incoming: 3 mob(s).
Last edited by Dr. Blunderpants on Sun Apr 25, 2004 5:51 pm, edited 4 times in total.
You're ugly.

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 » Sun Apr 25, 2004 2:20 pm

Yikes. I knew this would happen

One of the problem is.. you're doing NearestSpawn a billion times. This operation is actually slow. Do it once, and store the ID of the returned spawn. Then use ${Spawn[@id].Class} and such.

As far as the actual CTD, you'll have to help debug it (after making sure you have the zip where changes.txt says

Code: Select all

25 Apr 2004 by Lax (more):
- Fixed spawn.NearestSpawn
- Changed buff.ID so that it gives the song # or buff # instead of the spell's ID
Lax Lacks
Master of MQ2 Disaster
Purveyor of premium, EULA-safe MMORPG Multiboxing Software
* Multiboxing with ISBoxer: Quick Start Video
* EQPlayNice, WinEQ 2.0