Help with Debugging this cleric Auto Heal sub.

Help section from before the user variable changes that broke all macros

Moderator: MacroQuest Developers

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

Help with Debugging this cleric Auto Heal sub.

Post by Macro_Explorer » Thu Jan 23, 2003 1:44 pm

Hello all. I took Dirtface's cleric bot auto heal and incorporated it into my unibot macro. Everything in the unibot macro is working excet the autoheal portion. I did get the autoheal to work via the original macro, but I have a lot of other subs I would like to include from my main macro.

As soon as the cleric is set as the groups main healer (via tell) the cleric crashes to desktop. Since the macro calls the autoheal sub if the character is the main healer, I am guessing the problem is with autoheal.

Here is the relavent code.

Main Loop Sub

Code: Select all

Sub Main 
/zapvars 

/varset CombatInit 1
/varset CampCreated 0
/varset CharRole "NULL"
/varset ThreatState 0
/varset CharJob 1
/stand
/varset RestState 0

:Start
   /doevents 
   /if $CharRole=="MHealer" /call Autoheal
   /if $CharRole=="GWzd" /call AutoWzd
   /if $CharRole=="MnAssist" /if n $CombatInit==1 /if "$target(type)"=="NPC" /varset ThreatState 1
   /if $CharRole=="MnAssist" /if "$target(type)"!="NPC" /varset ThreatState 0
   /if $CharRole=="GBard" /if n $ThreatState==1 /call SingCombat
   /if $CharRole=="GBard" /if n $ThreatState==0 /call SingRest
   /if n $CharJob==1 /if n $ThreatState==1 /if n $CombatInit==1 /call Melee

   /delay 0

/goto :Start
/return

Auto Heal Sub

Code: Select all

|---***AUTOHEAL***---|
|
Sub AutoHeal
   /doevents
   /varcalc GroupMax $group(count)-1 
   /for GroupMember 0 to $GroupMax 
      /if "$GroupClass"=="Bard" /goto :Supportheal
      /if "$GroupClass"=="Beastlord" /goto :Supportheal
      /if "$GroupClass"=="Cleric" /goto :Supportheal
      /if "$GroupClass"=="Druid" /goto :Supportheal
      /if "$GroupClass"=="Enchanter" /goto :Casterheal
      /if "$GroupClass"=="Magician" /goto :Casterheal
      /if "$GroupClass"=="Monk" /goto :Tankheal
      /if "$GroupClass"=="Necromancer" /goto :Casterheal
      /if "$GroupClass"=="Paladin" /goto :Tankheal
      /if "$GroupClass"=="Ranger" /goto :Tankheal
      /if "$GroupClass"=="Rogue" /goto :Supportheal
      /if "$GroupClass"=="Shadow Knight" /goto :Tankheal
      /if "$GroupClass"=="Shaman" /goto :Supportheal
      /if "$GroupClass"=="Warrior" /goto :Tankheal
      /if "$GroupClass"=="Wizard" /goto :Casterheal
      /goto :SupportHeal

   :Tankheal 
	/if n $spawn($group($GroupMember),hp,pct)<35 {
	   /if n $spawn($group($GroupMember),hp,pct)<1 /goto :nextmember  
         /if n $group($GroupMember)==$char(id) /press F1 
         /if n $group($GroupMember)!=$char(id) /target id $group($GroupMember) 
         /call CStand 
         /g COMPLETE HEAL on %T in 10seconds
         /tell $vgLdr casting $char(gem,1) on %T
         /g casting "$char(gem,1)" on %T
         /varset Casttime $spell($char(gem,1),Casttime) 
         /call SpellSub 1 Casttime
         /delay 5  
         /call CSit 
         /goto :nextmember
 	 

   :Supportheal
	/if n $spawn($group($GroupMember),hp,pct)<50 {
	   /if n $spawn($group($GroupMember),hp,pct)<1 /goto :nextmember  
         /if n $group($GroupMember)==$char(id) /press F1 
         /if n $group($GroupMember)!=$char(id) /target id $group($GroupMember) 
         /call CStand 
         /g Healing %T
         /g casting $char(gem,2) on %T
         /varset Casttime $spell($char(gem,2),Casttime) 
         /call SpellSub 2 Casttime
         /delay 5 
         /call CSit
         /goto :nextmember  
	
   :Casterheal
     /if n $spawn($group($GroupMember),hp,pct)<80 {
	   /if n $spawn($group($GroupMember),hp,pct)<1 /goto :nextmember   
         /if n $group($GroupMember)==$char(id) /press F1 
         /if n $group($GroupMember)!=$char(id) /target id $group($GroupMember) 
     	 /call CStand 
     	 /g Healing %T
         /g casting $char(gem,2) on %T
         /varset Casttime $spell($char(gem,2),Casttime) 
         /call SpellSub 2 Casttime
         /delay 5 
         /call CSit
         /goto :nextmember
	
    :nextmember 
         } 
      /doevents
      /next GroupMember 
/return
Now the Chat event (tell) that sets the character to be the main healer

Code: Select all

|---***Set Main Healer***---
/if "$p2"=="You are the main healer" {  
      /varset vgMnH "$Char(Name)"
	/varset CharRole "MHealer"
	/varset CharJob 2
	/g My role is $CharRole
	/g I am the main healer
/return
}

Again as soon as the character is set to be the Main Healer, it starts up the Autoheal sub. At that point EQ crashes to desktop. I am thinking there is a loop that is not being closed. Can anyone suggest some things to change in the code?

Thanks.

Macro_Explorer

insanitywiz
a hill giant
a hill giant
Posts: 250
Joined: Mon Jul 08, 2002 7:50 am

Post by insanitywiz » Thu Jan 23, 2003 6:23 pm

I think I see your problem, but I want to test it out when I get home before posting it.

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

I look forward...

Post by Macro_Explorer » Fri Jan 24, 2003 12:18 am

... to any errors you point out. Please update this post as soon as you have any more information, even if your idea did not work. Let us know what you were thinking.

THanks and I appreciate looking at my little problem :-)

M_E

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

I worked on this today...

Post by Macro_Explorer » Sat Jan 25, 2003 5:45 pm

I do not know the cause of the problem, but I know how to prevent to problem. When i take the macro off of #turbo it runs as expected. If the macro is in #turbo mode, as soon as I call the AutoHeal loop EQ kicks me to desktop.

Can someone please help me making a loop to be #turbo friendly? I looked at the documentation but it just states under #turbo "Runs commands as fast as Possible. (Loops must be specially written for #turbo, 'see below')". There is no other mention in the manual 'below'.

Now I know what the problem is.

M_E

Dirtface
a lesser mummy
a lesser mummy
Posts: 39
Joined: Tue Nov 12, 2002 2:43 am

Post by Dirtface » Sun Jan 26, 2003 4:41 am

I think Macro-Explorer is Gonezo.

Considering your just ripping my code and conforming it to your own, perhaps it might be better to explain where you want to evolve from my code.

Ariain
a ghoul
a ghoul
Posts: 88
Joined: Fri Oct 11, 2002 10:35 am

...

Post by Ariain » Sun Jan 26, 2003 9:34 pm

about #turbo might wanna toss some really short delays into your loops. Might help.

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

Hello Dirtface...

Post by Macro_Explorer » Mon Jan 27, 2003 1:55 pm

who or what is Gonezo? I just starting this scripting stuff two weeks ago. I like the way the cleric heal scanned through the party members. So I made it a sub into the 'master' script I am running.

Where I want to go with this? I play 6 accounts at the same time. Level 51-56. I just started EQ again after 1.5 years. Before MacroQuest I could handle 3 accounts easy. Now with Macro Quest I can log my friend 3 accounts and play an entire group. I just need a macro to help with the basics. Since the computers playing the accounts will not always play the same account, it is easier for me to make one master 'unibot' macro instead of 6 different class macros. I changed your auto heal to determine what class is hurt and heal different classes at different times. I also created an auto Wizard sub, and used Hunter.mac for the melee sub.

I set a few /dealy 0 and /delay 1 in the auto heal sub, and kept the #turbo. That helped things a lot, but the cleric computer is a little choppy. I am guessing because PC usage is at 100%.

So far now, I have the cleric, wizard, and tank subs working without a hitch. I still need to debug the auto bard, and maybe create an auto enchanter (my main is an enchanter). Once I get to that point, I want to have a good hate list sub made, and then it will be like I have 5 pets as I play my main.

Anyway that is where I am going with this macro. If you like I can email you what I have. It is a large macro (35k). I plan on posting the entire macro here once it works with no bugs.

Thanks Arian. I did put some /delay 0 , /delay 1 in the macro and it helped a lot. It runs choppy but at least it is playable and does not crash :-). I would like to keep #turbo because there are so many other things the macro is doing besides healing.

M_E