Using Group TLO and merc question.

Need help running MacroQuest2? Ask your questions about how to get things to work on your computer.

Moderator: MacroQuest Developers

dewey2461
Contributing Member
Contributing Member
Posts: 1759
Joined: Sun Apr 17, 2005 1:53 am

Using Group TLO and merc question.

Post by dewey2461 » Mon Oct 14, 2013 4:12 am

If you loop over ${Group.Member[]} you get the name of each member which is what I would expect.

/echo ${Group.Member[0]}
/echo ${Group.Member[1]}

However if you look up a name in the group structure it only works for PC's. For mercs ${Group.Member[ <merc name> ] } always returns NULL.

/echo ${Group.Member[ <my name> ]} --> returns 0
/echo ${Group.Member[ <my merc> ]} --> returns NULL

I'm guessing it will be a trivial change to make the ${Group.Member} search work for mercs. Just have to find the place to change it and since its a core TLO I'd like to get buy in that this is the desired functionality.

On the other hand there may be a good reason we can't .

iconicman
a ghoul
a ghoul
Posts: 129
Joined: Fri Jul 31, 2009 3:05 pm

Re: Using Group TLO and merc question.

Post by iconicman » Mon Oct 14, 2013 7:57 am

At the risk of sounding dumb (and I do that often), are you suggesting we can search on their display name i.e. Kaleuil to return a group spot, or their full name Kaleuil11456 ?

Not in the game but does searching for their full name still make the Group TLO fall over?

EqMule
Developer
Developer
Posts: 2697
Joined: Fri Jan 03, 2003 9:57 pm
Contact:

Re: Using Group TLO and merc question.

Post by EqMule » Mon Oct 14, 2013 8:06 am

Im pretty sure you have to send the "real" mercenary name through the tlo for it to return something other than NULL.
So tulienne163729 or whatever not just tulienne
But I can look into it today.
My status o/
If you like MQ2 and would like to contribute, please do. My goal is 25 donations per month.
So far I've received Image donations for this month's patches.

Bitcoin: 1Aq8ackjQ4f7AUvbUL7BE6oPfT8PmNP4Zq
Krono: PM me.
I can always use characters for testing, PM me if you can donate one.

dewey2461
Contributing Member
Contributing Member
Posts: 1759
Joined: Sun Apr 17, 2005 1:53 am

Re: Using Group TLO and merc question.

Post by dewey2461 » Mon Oct 14, 2013 8:17 am

Basically in the macro I'm using it likes to accept and store short names or spawn ID's.

So what I'm trying to do is figure out if the information from ${Spawn[id ${MobID} ].PctHps is valid or do I need to target it.

The PctHps field should be valid if I have it targeted, In group or on XTarget.

My code was doing ${Group.Member[ <name> ].ID} to check.

Instead I'm now looping over each ${Group.Member[ ${G} ].ID} = ${MobID} then ...

The code is a little longer but probably better now.

dencelle
orc pawn
orc pawn
Posts: 10
Joined: Sat May 24, 2008 3:12 pm

Re: Using Group TLO and merc question.

Post by dencelle » Wed Oct 16, 2013 2:10 am

Code: Select all

/declare GID int outer 0
/declare HealPct int outer 70
/declare MemGem int outer 8
/declare HealingSpell string outer "Minor Healing"
Sub Main
/Call DoGroupCheck
/return

Sub DoGroupCheck
/For GID 0 to ${Math.Calc[${Group.GroupSize}-1]} {
/target ID ${Group.Member[${GID}].ID}
/call Memspell ${HealingSpell} ${MemGem}
/delay 30s ${Me.SpellReady[${HealingSpell}
/If (${Group.Member[${GID}].PctHPs}>${HealPct}) /cast ${HealingSpell}
/delay 30s !${Me.Casting}
/target clear
}
/return

Sub MemSpell(SpellName,SpellGem)
/if (${Me.Gem["${SpellName}"]) /return
/mem ${SpellName} ${SpellGem}
/delay 20s ${Window[SpellBookWnd].Open}
/return

this was wrote while i was work... took 10 min to write... :D

working on a new macro based casting manager... along with a lot of other things since i hate using plugins and i'm attempting to rebuild the old tradeskill macros...
Last edited by dencelle on Wed Oct 16, 2013 11:09 am, edited 1 time in total.

iconicman
a ghoul
a ghoul
Posts: 129
Joined: Fri Jul 31, 2009 3:05 pm

Re: Using Group TLO and merc question.

Post by iconicman » Wed Oct 16, 2013 8:30 am

I always target using IDs rather than names

/target id ${Spawn[ID ${Group.Member[${GID}].ID}]}

Always told it was best practice to do that.

dencelle
orc pawn
orc pawn
Posts: 10
Joined: Sat May 24, 2008 3:12 pm

Re: Using Group TLO and merc question.

Post by dencelle » Wed Oct 16, 2013 11:09 am

your right... fixed that -.- idk what i was thinking... =\ lol

Maskoi

Re: Using Group TLO and merc question.

Post by Maskoi » Wed Oct 16, 2013 1:09 pm

iconicman wrote:I always target using IDs rather than names

/target id ${Spawn[ID ${Group.Member[${GID}].ID}]}

Always told it was best practice to do that.
why even bother with spawn?

Code: Select all

 /target id ${Group.Member[GID].ID}
and ${Group} = number of group members without you

Code: Select all

/For GID 0 to ${Math.Calc[${Group.GroupSize}-1]} 
could be

Code: Select all

/For GID 0 to ${Group} 
and your /for needs a /next you have it {} like a /if statement

Code: Select all

/next GID
and > should be < or it will heal when toons hps are over 70% not under

Code: Select all

/If (${Group.Member[${GID}].PctHPs}>${HealPct}) /cast ${HealingSpell}
change to

Code: Select all

/If (${Group.Member[${GID}].PctHPs}<${HealPct}) /cast ${HealingSpell}

dencelle
orc pawn
orc pawn
Posts: 10
Joined: Sat May 24, 2008 3:12 pm

Re: Using Group TLO and merc question.

Post by dencelle » Wed Oct 16, 2013 5:27 pm

Maskoi wrote:
iconicman wrote:I always target using IDs rather than names

/target id ${Spawn[ID ${Group.Member[${GID}].ID}]}

Always told it was best practice to do that.
why even bother with spawn?

Code: Select all

 /target id ${Group.Member[GID].ID}
and ${Group} = number of group members without you

Code: Select all

/For GID 0 to ${Math.Calc[${Group.GroupSize}-1]} 
could be

Code: Select all

/For GID 0 to ${Group} 
and your /for needs a /next you have it {} like a /if statement

Code: Select all

/next GID
and > should be < or it will heal when toons hps are over 70% not under

Code: Select all

/If (${Group.Member[${GID}].PctHPs}>${HealPct}) /cast ${HealingSpell}
change to

Code: Select all

/If (${Group.Member[${GID}].PctHPs}<${HealPct}) /cast ${HealingSpell}
lol thanks maskoi for ripping my macro apart :p i never tested it... like i said... i was at work...

Maskoi

Re: Using Group TLO and merc question.

Post by Maskoi » Wed Oct 16, 2013 6:54 pm

So was I lmao

dewey2461
Contributing Member
Contributing Member
Posts: 1759
Joined: Sun Apr 17, 2005 1:53 am

Re: Using Group TLO and merc question.

Post by dewey2461 » Wed Oct 16, 2013 7:00 pm

The code I inherited :roll: was written before mercs came out. I've never run with them until recently.

The code basically has to find the current HP of anything on a list and at some point falls back to targeting the mob/npc/merc and getting hp = ${Spawn[].PctHps} which in the old days was /target id ${..} , wait , get hp.

I can skip targeting *IF* mob/npc/merc
1 - pc/merc is in group
2 - pc is broadcasting over netbots.
3 - mob is on XTarget
4 - otherwise /target and get hp.

Part #1 of that WAS coded as /if ( ${Group.Member[${NAME}]}) /varset hp ${Spawn[...].PctHps}

Workaround was to write a loop which checks everyone in group. Which means the macro gets slightly slower executing an extra set of loops as a macro instead of via plugin.