Debugging logic to determine Master Assist.

Need help running MacroQuest 1? Too bad! Use MQ2.

Moderator: MacroQuest Developers

Macro_Explorer
orc pawn
orc pawn
Posts: 12
Joined: Mon Jan 13, 2003 11:38 am

Debugging logic to determine Master Assist.

Post by Macro_Explorer » Thu Jan 16, 2003 3:55 pm

Hello all. I am creating a bard macro. I want the bard to play songs depending on the situation. If the group is in combat I want the bard to play combat songs. If the group is out of combat, I want resting and traveling songs played.

I figured the easiest way to determine if the group is in combat is to have the bard to assist the main assist. If the main assist has an NPC targeted the bard goes into combat mode. Well here is my first attempt for a script to determine who in the party is the main assist. I do not know how to assign a group member to a varible, so I am stuck.

Code: Select all

|--Proper Defines are made up here. This is only part of the entire macro.

Sub MADetermine
   /for GroupMember 0 to $calc($group(count)-1) 
      /doevents
      | MAValue 1 = Main Tank
      | Will determine the first 'qualified' tank, does not factor in levels
      /varset MAValue 0
      /if "$GroupClass"=="Warrior" /varset MAValue 1 /goto :DetermineComplete
      /if "$GroupClass"=="Shadow Knight" /varset MAValue 1 /goto :DetermineComplete
      /if "$GroupClass"=="Paladin" /varset MAValue 1 /goto :DetermineComplete
   /next GroupMember
      /call MAContDetermine
   :DetermineComplete
	/if n $MAValue==1 /varset MATank |--***not sure how to target group member***
/return 

Sub MAContDetermine
   /for GroupMember 0 to $calc($group(count)-1) 
      /if "$GroupClass"=="Monk" /varset MAValue 1 /goto :DetermineComplete
      /if "$GroupClass"=="Ranger" /varset MAValue 1 /goto :DetermineComplete
   /next GroupMember
      /call MAContDetermine2
   :DetermineComplete
	/if n $MAValue==1 /varset MATank |--***not sure how to target group member***
/return

Sub MAContDetermine2
   /for GroupMember 0 to $calc($group(count)-1) 
      /if "$GroupClass"=="Cleric" /varset MAValue 1 /goto :DetermineComplete
      /if "$GroupClass"=="Shaman" /varset MAValue 1 /goto :DetermineComplete
      /if "$GroupClass"=="Beastlord" /varset MAValue 1 /goto :DetermineComplete
      /if "$GroupClass"=="Druid" /varset MAValue 1 /goto :DetermineComplete
   /next GroupMember
   :DetermineComplete
	/if n $MAValue==1 /varset MATank |--***not sure how to target group member***
      /if n $MAValue==0 /1 Unable to determine Main Assist, sticking to non-combat mode.
/return
Last edited by Macro_Explorer on Fri Jan 17, 2003 1:18 am, edited 1 time in total.

User avatar
L124RD
Site Admin
Site Admin
Posts: 1343
Joined: Fri Jun 14, 2002 12:15 am
Location: Cyberspace
Contact:

Post by L124RD » Thu Jan 16, 2003 11:37 pm

Salutations,
If you are going to use variables that are NOT v#,p#,l# or bunny variables, you need to use defines.

here is a simple combat macro I wrote for me rogue:

Code: Select all

#chat tell

sub main
 /varset a(1,0) $char(exp)
 /varset a(1,1) $char(exp)
 /varset a(2,0) $char(level)
 /varset a(4,1) 0
 /varset a(4,2) 0
 /varset a(3,0) 0

 :loop
  /if $combat==TRUE {
   /if n $char(ability,"Backstab")>0 /doability "Backstab"
   /if n $char(ability,"Pick Pockets)>0 {
    /attack off
    /doability "Pick Pockets"
    /attack on
   }
   /if n $char(ability,"Intimidation")>0 /doability "Intimidation"
   /if n $char(ability,"Disarm")>0 /doability "Disarm"
  }

  /if n $char(buff,"Shield of Thorns")!=0 /varset a(4,0) $calc($rand(4)+1)
  /if n $char(buff,"Shield of Thorns")==0 {
   /if n $a(4,0)!=0 {
    /echo THORNS GONE!
    /g thorns dropped...
    /varsub a(4,0) 1
   }
  }

  /if n $char(buff,"Chloroplast")!=0 /varset a(4,1) $calc($rand(4)+1)
  /if n $char(buff,"Chloroplast")==0 {
   /if n $a(4,1)!=0 {
    /echo CHLORO GONE!
    /g Chloroplast dropped...
    /varsub a(4,1) 1
   }
  }

  /doevents
  /if n $char(exp)!=$a(1,1) {
   /if n $char(level)==$a(2,0) {
    /if n $char(exp)>$a(1,1) {
     /varset a(1,6) gained
    } else {
     /varset a(1,6) lost
    }
    /varcalc a(1,2) $char(exp)-$a(1,0)
    /varcalc a(1,5) $abs($calc($char(exp)-$a(1,1)))
    /varset a(1,1) $char(exp)
    /varcalc a(1,3) $a(1,2)/$calc($running/60)
    /varcalc a(1,4) $calc(100-$char(exp))/$a(1,3)
    /echo $char(name) has $a(1,6) $a(1,5) exp, Char is gaining $a(1,3) exp per minute and will level in $a(1,4) minutes (leveling for $calc($running/60) minutes). 
    /mqlog $char(name) has gained exp, Char is gaining $a(1,3) exp per minute and will level in $a(1,4) minutes (leveling for $calc($running/60) minutes).
   } else /if n $char(level)!=$a(2,0) {
    /echo $char(name) has gained a level. MacroQuest is going to reset the averaging mechanism (will be updated to include old one later)
    /mqlog $char(name) has gained a level. MacroQuest is going to reset the averaging mechanism (will be updated to include old one later)
    /varset a(1,0) $char(exp)
    /varset a(1,1) $char(exp)
    /varset a(2,0) $char(level)
   }
  }
 /goto :loop
/return

sub event_chat
 /if $combat==TRUE {
  /msgbox $p1 told you, "$p2"
 }
/return
basically... it calcs xp (dum dum dum.... no use for any of you right?) and does actions based on combat/no combat... dunno about using it for spell castng but, whatever... this was useful for me...[/code]

Macro_Explorer
orc pawn
orc pawn
Posts: 12
Joined: Mon Jan 13, 2003 11:38 am

Interesting XP function.

Post by Macro_Explorer » Fri Jan 17, 2003 1:26 am

The problem I am having is I do not know how to pass information to a character if it discovers a group member that is Main Assist. For example, I can easily do a loop and check each group member if they meet certainb criteria. THis case if they are warrior, Paladin, SK etc. If they are a value is assigned. At the end if the value is still 0 it will go into and select a 'lessor' main assist "bard, rogue, cleric, etc".

If none of those classes exists it will continue and look for the bottom of the barrel for main assist (except bard because this is for bard and do not want MA to be the bard, since the macro does not work for that for the bard).

Now the Sub determined that big beefy warrior will make a good MA. So it assigns a value and stops the search. What I do not know how to do, is pass that warrior information to the Bard so the bard can target the warrior and /assist. Maybe get the ID or Name of warrior, but I am not totally familar with ehat commands are needed.

The value in this is for a group setting. I will have a complete group of 6. If something bad happens to the main tank, I want the secondary tank to take over. If the main tank is dead, no one will be able to assist unless a new main tank is identified.

I am trying to automate 5 and 6 box playing as much as possible :-) I want to target a mob and say attack, and watch the entire group work its magic, while I handle adds. I have been 3 boxing for a while, then I discovered MQ! This will make it so much easier.

Anyone else have a 5-6 box setup that works well? :-)

User avatar
Fippy
a snow griffon
a snow griffon
Posts: 499
Joined: Tue Jul 16, 2002 10:42 am

Post by Fippy » Fri Jan 17, 2003 3:55 am

Not entierly sure if this is what you want but i am sure it will help.

Code: Select all


| MADetermine
|    Sets MATank to be the spawnid of the most likely MA in the group.
|
Sub MADetermine 

   /for GroupMember 0 to $calc($group(count)-1) 
      /doevents 

      | $group($GroupMember) returns the spawnid of the group member
      | you are currently checking
      /if "$spawn($group($GroupMember),class)"=="Warrior" {
         | Set MATank to be the spawnid of the MA you can later target him
         | with /target id $MATank  
         /varset MATank $group($GroupMember)
         /goto :DetermineComplete
      }
 
      /if "$spawn($group($GroupMember),class)"=="Paladin" {
         /varset MATank $group($GroupMember)
         /goto :DetermineComplete
      }
 
      /if "$spawn($group($GroupMember),class)"=="Shadow Knight" {
         /varset MATank $group($GroupMember)
         /goto :DetermineComplete
      }

      /if "$spawn($group($GroupMember),class)"=="Monk" {
         /varset MATank $group($GroupMember)
         /goto :DetermineComplete
      }

      /if "$spawn($group($GroupMember),class)"=="Ranger" {
         /varset MATank $group($GroupMember)
         /goto :DetermineComplete
      }

      /if "$spawn($group($GroupMember),class)"=="Cleric" {
         /varset MATank $group($GroupMember)
         /goto :DetermineComplete
      }

      /if "$spawn($group($GroupMember),class)"=="Shaman" {
         /varset MATank $group($GroupMember)
         /goto :DetermineComplete
      }

      /if "$spawn($group($GroupMember),class)"=="Beastlord" {
         /varset MATank $group($GroupMember)
         /goto :DetermineComplete
      }

      /if "$spawn($group($GroupMember),class)"=="Druid" {
         /varset MATank $group($GroupMember)
         /goto :DetermineComplete
      }

   /next GroupMember
 :DetermineComplete
 
/return

Fippy

This is my girl. But Rizwank had her first :-)
[img]http://www.btinternet.com/~artanor/images/fairy_bounce09.gif[/img]

Macro_Explorer
orc pawn
orc pawn
Posts: 12
Joined: Mon Jan 13, 2003 11:38 am

Close..

Post by Macro_Explorer » Fri Jan 17, 2003 11:16 am

That is close, and that is similar to how I had my original code. However it will determine the Main Tank to be ther very first group member scanned, no matter the class, and it will never check the second group member.

Seeing your code gave me the missing information I needed to complete the logic loop. I will post a finished version if I complete the macro. I know what syntax to use.

Thanks.

I eventually want to expand this to have each group member auto determine their best role in the group(main tank, main healer, support caster, nuker etc). Reason is because I do not play the same characters each day, and the groups always change. It will be nice to send one command and each group member knows thier and the other group members function.

User avatar
SingleServing
a hill giant
a hill giant
Posts: 195
Joined: Tue Dec 17, 2002 11:00 pm

Fippy =)

Post by SingleServing » Fri Jan 17, 2003 10:16 pm

Sorry I had to laugh when I saw that you had

Cleric and Shaman > Tanks < Beastlord

I don't play with many BL are you really THAT bad?

:lol: :lol: :lol: :lol:

Rather than just totally base MT off of class I would do

a MT Modifier

War 1.3
Shad 1.2
Pal 1.2
Rog 1.1
Monk 1.1
Beastlord 1.1
else 0.8

/varcalc MainA (MT Mod * Level)

So if you get 2 wars in the group the higher level one will be the MA, where as if you get a 60 necro in a group with a 45 war the necro will be main tank /shrug

Probly better ways to do that but just an idea
[color=DarkBlue]Everything,[/color] [color=DarkBlue][b]is[/b][/color] [color=black]black[/color] [color=DarkBlue]and[/color] [color=white]white[/color][color=DarkBlue], when you zoom out it looks[/color] [color=gray]grey[/color][color=DarkBlue].[/color]

User avatar
Fippy
a snow griffon
a snow griffon
Posts: 499
Joined: Tue Jul 16, 2002 10:42 am

Post by Fippy » Sat Jan 18, 2003 3:32 pm

If that is the case ME then there must be a bug. I cant get near EQ this weekend but if you try this code and see if you get the output you expect.

Code: Select all

/echo $spawn($group(0),class)ABCD
you should see it echo

WarriorABCD (if your a Warrior of course)

It possible youll see WarriorBCD instead (missing A)

If thats the case then you need to bug it as the output is eating a character so when its evaluated in your /if one of the = signs is being eaten and screwing up the logic.
Fippy

This is my girl. But Rizwank had her first :-)
[img]http://www.btinternet.com/~artanor/images/fairy_bounce09.gif[/img]

User avatar
SingleServing
a hill giant
a hill giant
Posts: 195
Joined: Tue Dec 17, 2002 11:00 pm

Post by SingleServing » Sat Jan 18, 2003 5:40 pm

Fippy wrote:If that is the case ME then there must be a bug. I cant get near EQ this weekend but if you try this code and see if you get the output you expect.

Code: Select all

/echo $spawn($group(0),class)ABCD
you should see it echo

WarriorABCD (if your a Warrior of course)

It possible youll see WarriorBCD instead (missing A)

If thats the case then you need to bug it as the output is eating a character so when its evaluated in your /if one of the = signs is being eaten and screwing up the logic.
just tried

/echo $target(name)ABCD and it came out fine...FatMunkyABCD

oh just tried /echo $spawn($group(0),class)ABCD

got ShamanABCD
[color=DarkBlue]Everything,[/color] [color=DarkBlue][b]is[/b][/color] [color=black]black[/color] [color=DarkBlue]and[/color] [color=white]white[/color][color=DarkBlue], when you zoom out it looks[/color] [color=gray]grey[/color][color=DarkBlue].[/color]