help me fix this weird anomaly with this Cleric Rotation Mac

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

Moderator: MacroQuest Developers

VesperKnight
orc pawn
orc pawn
Posts: 29
Joined: Tue Jul 29, 2003 5:37 am

help me fix this weird anomaly with this Cleric Rotation Mac

Post by VesperKnight » Mon Aug 11, 2003 3:52 pm

First of all here is the macro in question. It was built by many other members on another thread but that thread was getting messy and I decided to start a fresh one.

Code: Select all

#chat chat 

Sub Main 
   /if "$p0"=="" { 
      /echo Syntax: /macro ch <"channel-to-look-in"> <"string-to-look-for"> <delay-in-tenth-of-a-second> 
      /echo Example: /macro ch "chhain" "888 CH on" 15 
      /echo Will trigger on ex: Cleric_001 tells chhain: 888 CH on MainTank_004 CH 888 
      /endmacro 
   } 
   /varset a(2,0) "$p0" 
   /varset a(2,1) "$p1" 
   /varset a(2,2) $p2 
   :loop 
      /doevents 
   /goto :loop 
/return 

Sub Event_Chat 
   /if "$p0"~~"$a(2,0)" /if "$p2"~~"$a(2,1)" { 
      /delay $int($a(2,2)) 
      /press 1 
   } 
/return
It works really well, almost perfect.

There's only one pretty important anomaly.

Let's say I start it up with this command : /macro chchat "testcleric" "3 3 3" 20

It will correctly /press 1 2 seconds after it sees 3 3 3 in the testcleric channel. Only problem is once the spell is done casting.. It will wait a second or two and cast it again! Thus ruining the sync of the rotation.

It will cast again even if there is no new mention of 3s or anything that could trigger it. My assumption is that the macro is not only looking for new entries in the channel it's monitoring.. but it might be keeping a chat buffer and looking in there? Meaning as soon as there's been one "3 3 3" in the channel.. then everytime there's anything said in the channel it will put the two together and cast again?

I know it sounds weird.. that's not the way it should be working.. but this is what it's doing right now.. Really weird.. my assumption might be wrong too.. but something's not working right and I'm hoping one of you geniuses can figure it out! ;-)

thanks in advance

User avatar
dont_know_at_all
Developer
Developer
Posts: 5450
Joined: Sun Dec 01, 2002 4:15 am
Location: Florida, USA
Contact:

Post by dont_know_at_all » Mon Aug 11, 2003 5:22 pm

What are $p0 $p1 $p2 in Sub Event_Chat when the second trigger happens?

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

You can try this... it's how my event looks...

Post by wassup » Tue Aug 12, 2003 1:59 am

I am somewhat certain that the syntax should be

Code: Select all

Sub Event_Chat
    /if $p1=="Cleric_001" {
        /if "$arg(1,"$p2")"=="<string-to-look-for>" { 
            /delay $a(2,2)
            /press 1
        }
    }
/return

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

Post by L124RD » Tue Aug 12, 2003 11:38 am

Salutations,
Wassup, You are correct. The $p0 variable is for the mode of transportation for the message... ooc/tell etc.

VesperKnight
orc pawn
orc pawn
Posts: 29
Joined: Tue Jul 29, 2003 5:37 am

Post by VesperKnight » Tue Aug 12, 2003 11:56 pm

Ok guys I'm a little bit confused by the above replies.

One reply did make me notice something pretty important though.

this piece of code

Code: Select all

/if "$p2"~~"$a(2,1)
seemed miss-linked or something? mixing 2,1 with $p2 ? is that normal? Also although $p1 was /varset up there it was never used in the sub event_chat?

Anyway... you said this should be the right way :

Code: Select all

Sub Event_Chat 
    /if $p1=="Cleric_001" { 
        /if "$arg(1,"$p2")"=="<string-to-look-for>" { 
            /delay $a(2,2) 
            /press 1 
        } 
    } 
/return 
the only problem I have with that is the /if $p1=="Cleric_001" { ... Cleric_001 (or the name of the cleric preceeding you in the rotation) was never a variable.

The 3 variables were the "channel to look in", "the string to look for" and the delay to wait before casting.

Are you saying that this is wrong? that the channel to look in shouldn't be a variable?

Could you by any chance just modify the above macro and write it with the working code? also is

Code: Select all

Sub Event_Chat 
    /if $p1=="Cleric_001" { 
        /if "$arg(1,"$p2")"=="<string-to-look-for>" { 
            /delay $a(2,2) 
            /press 1 
        } 
    } 
/return 
the actual correct code? ie /if "$arg(1,"$p2")"=="<string-to-look-for>" is this correct? or should there be something in stead of the "<string-to-look-for> .. ? sorry but im not very good with coding and what may seem like obvious to you may not seem so easy to me.

Oh and DKAA... again excuse my cluelessness but how would I go about seeing what the $p0 $p1 $p2 were when the second trigger happened? I have to turn on a /log for that?

Again thanks to everyone that's helping make this macro work perfectly.

User avatar
dont_know_at_all
Developer
Developer
Posts: 5450
Joined: Sun Dec 01, 2002 4:15 am
Location: Florida, USA
Contact:

Post by dont_know_at_all » Wed Aug 13, 2003 12:20 am

VesperKnight wrote:Oh and DKAA... again excuse my cluelessness but how would I go about seeing what the $p0 $p1 $p2 were when the second trigger happened? I have to turn on a /log for that?

/echo in event_chat $p0 $p1 $p2

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 » Wed Aug 13, 2003 12:21 am

My reason for using Cleric_001 is that you don't want to start your cast on any cleric, you want it to be triggered by the cleric before you.

So, instead of your parameters I would do something like

/macro chrot <cleric_name> <string-to-look-for> <delay>

ie...

/macro chrot p0 p1 p2

p0=<cleric_name> is for the cleric before you
p1=<string-to-look-for> to trigger your cast
p2=<delay> for the delay before you cast

to make it easier to read...

Code: Select all

#chat Chat

|Assign names to variables
#define ClericName v40
#define TheString v41
#define CastDelay v42

Sub Main
    |Set ClericName as parameter p0 from /macro chrot 
    /varset ClericName $p0

    |Set the trigger string as p1 from /macro chrot 
     /varset TheString $p1

    |Set the cast delay from /macro chrot
    /varset CastDelay $p2

    :MainLoop
    /doevents chat
    /goto :MainLoop
/return

Sub Event_Chat
    |Does the Cleric announcing match the cleric you are waiting for
    |This p1 is not the p1 from /macro chrot, its the parameter p1 from the event.
    /if "$p1"=="$ClericName" {

        |Did the cleric announce the trigger string
        /if "$arg(1,"$p2")"=="$TheString" {

            |Initiate the delay then cast Complete Heal
            /delay $CastDelay
            /cast "Complete Heal"
        }
    }
/return

Something along those lines might be easier to understand. If anyone spots a mistake I may have made please feel free to correct me :)

VesperKnight
orc pawn
orc pawn
Posts: 29
Joined: Tue Jul 29, 2003 5:37 am

Post by VesperKnight » Wed Aug 13, 2003 3:02 am

ah so the #chat Chat line will basically monitor any and all chat channels?

and instead of making the trigger go off when it saw "8 8 8" in xxchannel, it would now go off when it saw "8 8 8" said by cleric_01 in any channel?

of course #chat Chat will only monitor chat channels right? not other channels such as /guild or /ooc or /shout ?

Well I guess this should work the same as it did before.. I'll try it out.. and adding an /echo will help me solve my first problem. But I don't see how this new macro will fix my problem as the old trigger was also looking for "8 8 8" and it went off repeatedly without having "8 8 8" show up anywhere...

slimjim
a ghoul
a ghoul
Posts: 94
Joined: Thu Oct 17, 2002 4:05 pm

Post by slimjim » Wed Aug 13, 2003 3:03 am

|Initiate the delay then cast Complete Heal
/delay $CastDelay
/cast "Complete Heal"
do you need a $int($CastDelay) after /delay? i'm not sure, just seen some people do this. Other than that question it looks like it would work to me

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 » Wed Aug 13, 2003 3:55 am

VesperKnight wrote:ah so the #chat Chat line will basically monitor any and all chat channels?

of course #chat Chat will only monitor chat channels right? not other channels such as /guild or /ooc or /shout ?
From the documentation that comes in the CVS:

#chat <channel>
Declares where Event_Chat channels you want to handle can be: say, ooc, shout, tell, group, auc,chat

...instead of making the trigger go off when it saw "8 8 8" in xxchannel, it would now go off when it saw "8 8 8" said by cleric_01 in any channel?
Correct... it will only trigger if the cleric you are waiting for gives the trigger string in the chat channel, not any other channel since you declared #chat Chat. It won't trigger if it is in ooc, say, tell, shout, group, or auction.
Well I guess this should work the same as it did before.. I'll try it out.. and adding an /echo will help me solve my first problem. But I don't see how this new macro will fix my problem as the old trigger was also looking for "8 8 8" and it went off repeatedly without having "8 8 8" show up anywhere...
The only thing I can see happening is a problem with 8 8 8, but I don't think it will. When you use the /macro chrot <clericname> <string> <delay> make sure you surround the string with " ", I think that will prevent any difficulties. If I had a cleric I could test it. I don't think what I posted will require very much, if any tweaking to get working.

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 » Wed Aug 13, 2003 3:57 am

slimjim wrote:
|Initiate the delay then cast Complete Heal
/delay $CastDelay
/cast "Complete Heal"
do you need a $int($CastDelay) after /delay? i'm not sure, just seen some people do this. Other than that question it looks like it would work to me
Not if you give the delay as an integer... there wouldn't be a reason for it.

Not trying to be funny, but I don't remember a ch rotation using 2.5, 3.5, or 4.5second rotation. They are usually 2, 3 or 4 seconds, which would be 20, 30, or 40 as a delay respectively.

VesperKnight
orc pawn
orc pawn
Posts: 29
Joined: Tue Jul 29, 2003 5:37 am

Post by VesperKnight » Wed Aug 13, 2003 4:04 am

well wassup I tried your code. It didn't work at first. So i played around with it and changed a couple of things to make it in line with the chchat.mac and I couldn't get anything to make it work.

What I did at the end is I changed the chchat.mac very slightly to this

Code: Select all

#chat chat 

Sub Main 

   /varset a(2,0) "$p0" 
   /varset a(2,1) "$p1" 
   /varset a(2,2) "$p2"
   :loop 
      /doevents 
   /goto :loop 
/return 

Sub Event_Chat 
   /if "$p1"~~"$a(2,0)" /if "$p2"~~"$a(2,1)" { 
      /delay $int($a(2,2)) 
      /echo $p0 $p1 $p2
      /press 1 
   } 
/return
I basically only changed /if "$p0"~~"$a(2,0)" to /if "$p1"~~"$a(2,0)"

... probably won't make a difference. However I figured this macro was already set up so I could use the cleric's name instead of the channel and indeed when I started using the format /macro chchat "name_of_cleric" "string" delay it did continue working.

What was odd is i ran a simulation prior to making these changes. Basically I made 10 hot keys that represented each number of a cycle and ran them in order to try to reproduce the anomaly I had seen before and as usual during my "testing" period the macro ran flawlessly. But in the past it was the same thing and once I was on a raid then it started going off unexpectedly so *shrug* I don't know if it's fixed now.

I put in the /echo line as suggested and when the trigger went off instead of just showing "channel name" "string" delay the line /echo $p0 $p1 $p2 showed the full line (example : testcleric Rybia 3 3 3 CH on --( target --) 3 3 3

even when I changed the format to /macro chchat "Rybia" "3 3 3" 10
it still went ahead and showed testcleric Rybia 3 3 3 CH on --( target --) 3 3 3

bit odd but I don't really know what to make of this

VesperKnight
orc pawn
orc pawn
Posts: 29
Joined: Tue Jul 29, 2003 5:37 am

Post by VesperKnight » Wed Aug 13, 2003 4:13 am

If I had a cleric I could test it
oh note that you dont have to be a cleric to test this :p any two lvl 1 classes can test it. Basically you just wanna make sure it does /press 1 when it's supposed to. and /press 1 can be a hot key that says any kind of text in a chat channel

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 » Wed Aug 13, 2003 12:37 pm

I don't know what you mean about chchat, is this a macro someone did?

I still think the one I made should work. It's probably some small glitch in the macro stopping it from working corrrectly. I'lls ee if I can figure it out.

VesperKnight
orc pawn
orc pawn
Posts: 29
Joined: Tue Jul 29, 2003 5:37 am

Post by VesperKnight » Wed Aug 13, 2003 1:47 pm

yes chchat.mac is the name of the macro i posted in the first post. sorry for the confusion