event_chat problems

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

Moderator: MacroQuest Developers

boredom
a lesser mummy
a lesser mummy
Posts: 49
Joined: Thu Jun 19, 2003 3:45 pm

event_chat problems

Post by boredom » Tue Jul 15, 2003 10:06 am

I've been modifying Grimjack's cleric bot to do a few extra things that I would like to automate. However, I've run into a snag. I added #chat group to capture group chat and changed the event_chat sub to test if chat is tell or group. this works well untill I enter the heal rotation function. This is where things get strange. if someone other than the person set as previous healer says anything, that's no problem. If the previous healer says "Healing someone, bot, you are next" that's fine too, the bot functions as it should. If the previous healer says the word "stuff" in group, EQ locks and I have to kill it with windows. Here is the relevant code (I think):

Code: Select all

#define MasterName v50 
#define CmdArrayNum v51 
#define CmdArraySize v52 
#define GroupMember v53 
#define GroupMax v54 
#define ChatInput1 v55 
#define ChatInput2 v56 
#define ChatInput3 v57 
#define SitAfterCast v58 
#define MyXLoc v59 
#define MyYLoc v60 
#define IsHealer v61 
#define countdown v62 
#define CmdList v63 
#define RangeMin v70 
#define RangeMax v71 
#define FastRange v72 
#define Combatstatus v73 
#define Fail v94 
#define DoAgain v95 
#define StartCast v96 
#define SpellSlot v97 
#define SpellName v98 
#define CastTime v99 
#define CTimer t39 

#define HealAt v49
#define Listing v48
#define Counter v47
#define LoopNum v46
#define EnrageVar v45

#define WatchNum a(3,0)
#define PrevHealer a(3,1)
#define RotType a(3,2)
#define UniqueOne a(3,3)
#define UniqueTwo a(3,4)
#define UniqueThree a(3,5)
#define UniqueFour a(3,6)
#define UniqueFive a(3,7)
#define UniqueSix a(3,8)
#define NumUnique a(3,9)
#define RotOn a(3,10)
#define MyNextHeal a(3,11)
#define ReportString a(3,12)

#chat tell 
#chat group 

Sub Main 

   /varset MasterName Someone 
   /varset IsHealer 0 
   /varset RangeMin 10 
   /varset RangeMax 12 
   /varset FastRange 15 
   /varset Combatstatus 0 
   /varset a(1,0) afk 
   /varset a(1,1) accept 
   /varset a(1,2) reject 
   /varset a(1,3) invite 
   /varset a(1,4) mana 
   /varset a(1,5) follow 
   /varset a(1,6) stop 
   /varset a(1,7) evac 
   /varset a(1,8) moveto 
   /varset a(1,9) sit 
   /varset a(1,10) stand 
   /varset a(1,11) sn 
   /varset a(1,12) camp 
   /varset a(1,13) duck 
   /varset a(1,14) run 
   /varset a(1,15) say 
   /varset a(1,16) tell 
   /varset a(1,17) group 
   /varset a(1,18) cmds 
   /varset a(1,19) autoheal 
   /varset a(1,20) target 
   /varset a(1,21) notarget 
   /varset a(1,22) assist 
   /varset a(1,23) saytarget 
   /varset a(1,24) attack 
   /varset a(1,25) noattack 
|||||||||||||||||||||||Personal Commands||||||||||||||||||||||||||||||||| 
   /varset a(1,26) hp 
   /varset a(1,27) heal 
   /varset a(1,28) ch 
   /varset a(1,29) hot 
   /varset a(1,30) dd 
   /varset a(1,31) symbol 
   /varset a(1,32) ac 
   /varset a(1,33) root 

   /varset a(1,34) addw
   /varset a(1,35) clearw
   /varset a(1,36) listw
   /varset a(1,37) healat
   /varset a(1,38) defrot
   /varset a(1,39) setrot

   /varset a(2,0) 0
   /varset HealAt 40
   /if n $p0==0 {
      /varset SitAfterCast 0
   } else {
      /varset SitAfterCast 1
   }
|||||||||||||||||||||||Personal Commands||||||||||||||||||||||||||||||||| 
   /call CountArraySize 1 
   /varset CmdArraySize $int($return) 
   /varset CmdList "$a(1,0), $a(1,1), $a(1,2), $a(1,3), $a(1,4), $a(1,5) $a(1,6), $a(1,7), $a(1,8), $a(1,9), $a(1,10), $a(1,11), $a(1,12), $a(1,13), $a(1,14), $a(1,15), $a(1,16), $a(1,17), $a(1,18), $a(1,19), $a(1,20), $a(1,21), $a(1,22), $a(1,23), $a(1,24), $a(1,25), $a(1,26), $a(1,27), $a(1,28), $a(1,29), $a(1,30), $a(1,31), $a(1,32), $a(1,33), $a(1,34),  $a(1,35), $a(1,36), $a(1,37), $a(1,38), $a(1,39), $a(1,40)" 
   /varset CmdArrayNum 0 
   :MainLoop
   /doevents
   /call CheckGroup 
   /call CheckWatch
   /call Combatcheck 
   /if $Combatstatus=="1" /call RangeSub 
|||||||||||||||||||||||Personal Commands||||||||||||||||||||||||||||||||| 
|||||||||||||||||||||||Personal Commands||||||||||||||||||||||||||||||||| 
   /doevents
   /varset CmdArrayNum 0 
   /goto :MainLoop 
/return 

Sub Event_Chat 
   /echo event chat
   /if $p0==tell {
      /varset CmdArrayNum 0 
||||||||||||||  HARDCODED  |||||||||||||||||||||
      /if "Someone"=="$p1" { 
         /varset MasterName Someone
         :ArrayTime 
         /if "$arg(1,"$p2")"=="$a(1,$CmdArrayNum)" { 
            /call Do-$a(1,$CmdArrayNum) $p2 
            /return 
         } 
         /varadd CmdArrayNum 1 
         /if n $CmdArrayNum>=$CmdArraySize /return 
         /goto :ArrayTime 
      }  
      /if "Someoneelse"=="$p1" { 
         /varset MasterName Someoneelse
         :ArrayTime 
         /if "$arg(1,"$p2")"=="$a(1,$CmdArrayNum)" { 
            /call Do-$a(1,$CmdArrayNum) $p2 
            /return 
         } 
         /varadd CmdArrayNum 1 
         /if n $CmdArrayNum>=$CmdArraySize /return 
         /goto :ArrayTime 
      }  
      /if "NoOne"=="$p1" {
         /varset MasterName NoOne
         :ArrayTime 
         /if "$arg(1,"$p2")"=="$a(1,$CmdArrayNum)" { 
            /call Do-$a(1,$CmdArrayNum) $p2 
            /return 
         } 
         /varadd CmdArrayNum 1 
         /if n $CmdArrayNum>=$CmdArraySize /return 
         /goto :ArrayTime 
      }  

      /tell $MasterName $p1 told me: $p2 
   }
   /echo passed the tell section
   /if $lcase("$p1")==$PrevHealer {
      /if n $strlen("$p2")<=0 /return
      /echo $p1 and $PrevHealer match
      /if n $RotOn==1 {
         /varset CmdArrayNum 3
         /varadd CmdArrayNum $NumUnique
         /varset LoopNum 3
         /echo looping from $LoopNum to $CmdArrayNum
         /echo looking through $p2
         :RotCheckLoop
            /echo loopnum is $LoopNum .  checking $a(3,$LoopNum)
            /if n $strlen("$p2")<$a(3,$LoopNum) /return
            /if n $instr($a(3,$LoopNum),"$p2")==-1 /return
            /varadd LoopNum 1 
            /if n $LoopNum==$CmdArrayNum /goto :ItsGood
         /goto :RotCheckLoop
         :ItsGood
         /echo that's my que
         /call do-setrot filler yours
      }
   }
/return 

Sub PctRot
   /echo in pctrot function
   :PctLoop
   /doevents
   /if n $MyNextHeal>0 {
      /varset t1 110
      /echo waiting 10 seconds then doing my thing
      :PctDelayLoop
      /doevents
      /if n $t1!=0 /goto :PctDelayLoop
      /echo done waiting.
      :InternalLoop
      /doevents
      /if n $spawn($a(2,$WatchNum),hp,pct)<=$HealAt {
         /call TankHeal $a(2,$WatchNum)
         /varsub MyNextHeal 1
         /echo Heals left $MyNextHeal
      }
      /if n $MyNextHeal>0 /goto :InternalLoop
   }
   /if n $RotOn!=1 /return
   /if "$RotType"!="pct" /return
   /goto :PctLoop
/return
I added the echos to try and debug. When the previous healer says "stuff" in group,

Code: Select all

   /echo event chat
is never reached.

any thoughts?
Last edited by boredom on Tue Jul 15, 2003 3:20 pm, edited 1 time in total.

wassup
Official Guardian and Writer of TFM
Official Guardian and Writer of TFM
Posts: 1487
Joined: Sat Oct 26, 2002 5:15 pm

Post by wassup » Tue Jul 15, 2003 12:30 pm

My eyes hurt trying to read this without indents etc...

Can you edit your thread and post the macro using Code instead of
Quote
[/quote]

User avatar
grimjack
Macro Author
Macro Author
Posts: 525
Joined: Thu Nov 07, 2002 6:51 am
Contact:

Post by grimjack » Wed Jul 16, 2003 12:46 am

What is your goal with this? I don't quite understand what you want this to do. If you want to set the bot up in a c-heal chain, I think you have made it more complicated than it needs to be. If that's not what you are wanting to do, I'm lost.


Thanks
GrimJack
When they come to me, they're in trouble, or they want some. I bust people out of prison, hunt down vampires, fight alien gods -- All the fun jobs people are too squeamish or too polite to do themselves.

Call me a mercenary. Call me an assassin. Call me a villain. I am all that and more.

My name's John Gaunt, but out on the streets of Cynosure, I am called...
GrimJack

boredom
a lesser mummy
a lesser mummy
Posts: 49
Joined: Thu Jun 19, 2003 3:45 pm

goal

Post by boredom » Wed Jul 16, 2003 12:56 am

I'm trying to get my bot to be able to go into a healing rotation with many other clerics. so I can set who is before me in the rotation, and what words to look for in their heal message to trigger my heal next. This function does the rot on a percent base rather than a time base, I have one for that too. [/quote]

User avatar
grimjack
Macro Author
Macro Author
Posts: 525
Joined: Thu Nov 07, 2002 6:51 am
Contact:

Post by grimjack » Wed Jul 16, 2003 1:06 am

I'll see what i can come up with. I don't think it needs to be this complicated.


Thanks
GrimJack
When they come to me, they're in trouble, or they want some. I bust people out of prison, hunt down vampires, fight alien gods -- All the fun jobs people are too squeamish or too polite to do themselves.

Call me a mercenary. Call me an assassin. Call me a villain. I am all that and more.

My name's John Gaunt, but out on the streets of Cynosure, I am called...
GrimJack