Setting Main tank, Main assist, and Main puller snippet

freewilly

Lifetimer
Joined
Sep 20, 2006
Messages
191
Reaction score
23
Points
18
What would be the code you would use to add into a macro that would automatically assign the toon running that macro as Main Tank, Main assist, and Main puller?

My apologies to Pete for asking the same question in his MQ2Bot thread.
 
Per bot.mac:

Code:
#define MyIni Bot_${Me.CleanName}_${Me.Class}.ini

Sub SetRolesLoad
/if (${SetRolesLoaded}) /return
/if (!${Defined[SetRolesLoaded]}) /declare SetRolesLoaded int outer 1
    /declare SetRoles bool outer ${Ini[MyIni,Roles,SetRoles,FALSE]}
    /declare GroupLeader string outer ${Ini[MyIni,Roles,GroupLeader]}
    /declare GroupMainTank string outer ${Ini[MyIni,Roles,GroupMainTank]}
    /declare GroupMainAssist string outer ${Ini[MyIni,Roles,GroupMainAssist]}
    /declare GroupPuller string outer ${Ini[MyIni,Roles,GroupPuller]}
    /declare GroupXTarget1 string outer ${Ini[MyIni,Roles,GroupXTarget1]}
    /declare RaidXTarget1 string outer ${Ini[MyIni,Roles,RaidXTarget1]}
    /declare RaidCheck int outer
    /declare GroupCheck int outer
    /if (${Spawn[group mercenary ${GroupMainTank}].ID}) /varset GroupMainTank ${Spawn[group mercenary ${GroupMainTank}]}
    /if (${Spawn[group mercenary ${GroupMainAssist}].ID}) /varset GroupMainAssist ${Spawn[group mercenary ${GroupMainAssist}]}
/if (${NeedLoad} && !${SetRoles}) {
    /mmoini "MyIni" "Roles" "SetRoles" "FALSE"
    /mmoini "MyIni" "Roles" "GroupLeader" ${Group.Leader}
    /mmoini "MyIni" "Roles" "GroupMainTank" ${Group.MainTank}
    /mmoini "MyIni" "Roles" "GroupMainAssist" ${Group.MainAssist}
    /mmoini "MyIni" "Roles" "GroupPuller" ${Group.Puller}
    /mmoini "MyIni" "Roles" "GroupXTarget1" "Group Assist Target"
    /mmoini "MyIni" "Roles" "RaidXTarget1" "Raid Assist 1 Target"

/echo Loading Roles Info to MyIni
}

/return

Sub SetRoles
/if (!${Defined[SetRolesLoaded]}) /call SetRolesLoad
/if (!${SetRoles}) /return
/if (!${Raid.Members} && !${Me.XTarget[1].TargetType.Equal[${GroupXTarget1}]} && ${Group.MainTank.ID}!=${Me.ID} && !${GroupCheck}) {
        /xtarget set 1 ${GroupXTarget1.Replace[ ,]}
        /varset GroupCheck 1
        /xtarget set 1 ${GroupXTarget1.Replace[ ,]}
        }
/if (${Raid.Members} && !${Me.XTarget[1].TargetType.Equal[${RaidXTarget1}]} && !${RaidCheck}) {
            /xtarget set 1 ${RaidXTarget1.Replace[ ,]}
            /varset RaidCheck 1
            /xtarget set 1 ${RaidXTarget1.Replace[ ,]}
            }
|/if (!${Raid.Members} && !${Me.XTarget[1].TargetType.Equal[Auto Hater]} && ${Group.MainTank.ID}==${Me.ID}) /setrole 1 "Auto Hater"
/if (!${Raid.Members} && !${Me.XTarget[1].TargetType.Equal[Auto Hater]} && ${Group.MainTank.ID}==${Me.ID}) /xtarget set 1 AutoHater
/if (${Group.Leader.ID}!=${Me.ID}) /return
/if (${Spawn[group ${GroupMainAssist}].ID} && ${Group.MainAssist.ID}!=${Spawn[group ${GroupMainAssist}].ID}) /grouproles set "${GroupMainAssist}" 2
/if (${Spawn[group ${GroupMainTank}].ID} && ${Group.MainTank.ID}!=${Spawn[group ${GroupMainTank}].ID}) /grouproles set "${GroupMainTank}" 1
/if (${Spawn[group ${GroupPuller}].ID} && ${Group.Puller.ID}!=${Spawn[group ${GroupPuller}].ID}) /grouproles set "${GroupPuller}" 3
/if (${Spawn[group ${GroupLeader}].ID} && ${Group.Leader.ID}!=${Spawn[group ${GroupLeader}].ID}) /makeleader ${GroupLeader}
/return
/call SetRoles

Then the ini looks like:
Code:
[Roles]
SetRoles=TRUE
GroupLeader=Cheo
GroupMainTank=${Me.Mercenary}
GroupMainAssist=Chotur
GroupPuller=Kitrix
GroupXTarget1=Group Assist Target
RaidXTarget1=Raid Assist 1 Target
 
Last edited:
Thanks Pete. I'm trying to avoid .ini's for what I am doing. Was hoping there was a single line command that would set the toon you are on as main tank, MA, MP. Or if it took three lines to set that. Kinda like if I wanted to set a toon as anonymous it's a as simple as "/anon on" in a macro. Is there a switch that simply does that or does it require more depth to set as you have provided?
 
Thanks Pete. I'm trying to avoid .ini's for what I am doing. Was hoping there was a single line command that would set the toon you are on as main tank, MA, MP. Or if it took three lines to set that. Kinda like if I wanted to set a toon as anonymous it's a as simple as "/anon on" in a macro. Is there a switch that simply does that or does it require more depth to set as you have provided?
Read the code dude!

Code:
/if (${Spawn[group ${GroupMainAssist}].ID} && ${Group.MainAssist.ID}!=${Spawn[group ${GroupMainAssist}].ID}) /grouproles set "${GroupMainAssist}" 2
/if (${Spawn[group ${GroupMainTank}].ID} && ${Group.MainTank.ID}!=${Spawn[group ${GroupMainTank}].ID}) /grouproles set "${GroupMainTank}" 1
/if (${Spawn[group ${GroupPuller}].ID} && ${Group.Puller.ID}!=${Spawn[group ${GroupPuller}].ID}) /grouproles set "${GroupPuller}" 3
/if (${Spawn[group ${GroupLeader}].ID} && ${Group.Leader.ID}!=${Spawn[group ${GroupLeader}].ID}) /makeleader ${GroupLeader}
 
/grouproles set CHARNAME 3

3 is puller, 1 is main tank, 2 is main assist.

For example:

/grouproles set freewilly 3
/grouproles set freewilly 2
/grouproles set freewilly 1