Really basic cleric CH cycle macro

Macro requests 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

Really basic cleric CH cycle macro

Post by VesperKnight » Tue Jul 29, 2003 6:06 am

Hello. I'm relatively new to MQ, I've used it a long time ago then had stopped and now am back again. I really wish to learn how to make a macro of my own eventually. But to be honest I've accomplished great programming (well great for someone's who never studied it much) by looking at someone else's code and learning from it.

So I'm hoping that whoever answers me plea to make this macro will at the same time help me understand the basics of making them.

That said, here is what I'm looking for. It seems simple enough

I'm a cleric in a high level guild and for as long as I can remember we have killed things by having a certain number of clerics cast CH in a chain every certain ammount of seconds.

And we still do this. For a 6 minutes fight like most fights are I can live with counting 2 seconds every time the number before mine goes.

But for fights, such as the Xegony encounter, where you have to cycle for 50 minutes to an hour... I would so love to have a macro do it for me instead.

So what I'm looking for is a macro that will know when the number prior to mine is spoken in our chat channel

Example :

/1 222 CH on %T 222
/1 2-2-2 CH on %T 2-2-2
/1 2 2 2 CH on %T 2 2 2
/1 TEN TEN TEN CH on %T TEN TEN TEN

where /1 is our cleric channel

and then x ammount of seconds later, will cast a Complete Heal and advertise in the cleric channel your own number (the one following the one the macro caught)

The macro would also have to re-cast the spell immediately if it fizzled. It'a also best to include a /sit off in the macro. To make sure it doesn't take any time to realize the spell fizzled (can't waste any milli seconds here) it's best to simply have the spell /casted a few times.

This macro would have to be able to understand that 2-2-2 is the same as 2 2 2 or TWO or just 2 2.

It would also be neat if you could specify the numbers of seconds to wait by typing it in the command

Example /chcycle <your number> <delay>

If someone makes me the macro for one number only I could then make 10 other macros for 10 other numbers with it. But what would be even better is if just one macro could be suited for any number.

You could add a function that stops the macro if it doesn't catch the number it's looking for for say 1 minute.

Well this macro could be very very basic if it needed editing prior to each cycle (ie manually changing the number it's looking for and delay every time) but if someone wants to make the PERFECT CH Cycle Macro.. then I hope my guidelines will help you do just that!

I'll be looking forward to any replies and macros :)

Thanks in advance!

YKW-28983
a hill giant
a hill giant
Posts: 252
Joined: Sun Dec 01, 2002 11:37 pm

Post by YKW-28983 » Tue Jul 29, 2003 11:42 am

I think I'm getting the idea of what you want to do, so here goes.
CHChat.mac Code

Code: Select all

|**USAGE: /macro CHCHat [channelname] [mynumber] [delayinseconds]
|**#chat defines the channel that you want.**|
|**In this case the chat channel is the channel to**| 
|**trigger Event_Chat**|
#chat chat
#include SpellCast.mac
|**This will loop and be watching for any events**|
|**Thus, it will be waiting for a chat channel to become active**|
Sub Main
/varset a(2,0) $p0
/varset a(2,1) $p1
/varset a(2,2) $p2
:loop
  /doevents
  /delay 0
  /goto :loop
/return

|**This is our Chat event sub. it is triggered evrey time**|
|**someone uses a chat channel, any chat channel**|
Sub Event_Chat
/if $p0~~$a(2,0) /if $p2~~$a(2,1) {
  /delay $a(2,2)s
  /sit off
  /call cast "Complete Heal"
  /sit on
/return
Syntax Example
/macro CHChat RZRaidClerics 222 1

This will monitor RZRaidClerics chat channel for any text involving 222 in it, when it sees that it will delay 1 second and then cast Complete Heal. I'm sure with this code you can figure out the rest of the stuff needed to make it work better.

ReadMe

Spellcast.mac Code

Code: Select all

|Plazmic + 1 line change by Imperfect 
|** SpellCast.mac 
** This will cast a spell reliably for you... 
** Usage: 
** /call Cast "spellname" 
** It will return the following values: 
** CAST_SUCCESS 
** CAST_UNKNOWNSPELL 
** CAST_OUTOFMANA 
** CAST_OUTOFRANGE 
** CAST_CANNOTSEE 
** CAST_STUNNED 
** CAST_RESISTED 
**| 

#event Fizzle "Your spell fizzles!" 
#event Interrupt "Your casting has been interrupted!" 
#event Interrupt "Your spell is interrupted." 
#event Recover "You haven't recovered yet..." 
#event Recover "Spell recovery time not yet met." 
#event Resisted "You target resisted the " 
#event OutOfMana "Insufficient Mana to cast this spell!" 
#event OutOfRange "Your target is out of range, get closer!" 
#event NoLOS "You cannot see your target." 
#event Stunned "You cannot cast while stunned" 
#event Standing "You must be standing to cast a spell" 
#event Collapse "Your gate is too unstable, and collapses." 

#define CastStatus v59 
#define CastTimer t7 

#define CAST_SUCCESS 0 
#define CAST_UNKNOWNSPELL 1 
#define CAST_RESTART 2 
#define CAST_OUTOFMANA 3 
#define CAST_OUTOFRANGE 4 
#define CAST_CANNOTSEE 5 
#define CAST_STUNNED 6 
#define CAST_RESISTED 7 

Sub Cast 
  /if n $char(gem,"$p0")==0 /return CAST_UNKNOWNSPELL 
  :StartCast 
  /if n $char(gem,"$p0")<0 /call WaitForRefresh "$p0" 
  /cast "$p0" 
  /varset CastTimer $int($spell("$p0",casttime)*10+$spell("$p0",recoverytime)*10) 
  /varset CastStatus CAST_SUCCESS 
  :WaitCast 
     /doevents Fizzle 
     /doevents Interrupt 
     /doevents Recover 
     /doevents Standing 
     /doevents OutOfRange 
     /doevents OutOfMana 
     /doevents NoLOS 
     /doevents Resisted 
     /if n $CastStatus==CAST_RESTART /goto :StartCast 
     /if n $CastStatus>=CAST_RESTART /return $CastStatus 
  /if n $CastTimer>0 /goto :WaitCast 
  /varset CastTimer 0 
/return CAST_SUCCESS 

Sub WaitForRefresh 
   :LoopWaitForRefresh 
      /delay 0 
   /if n $char(gem,"$p0")<0 /goto :LoopWaitForRefresh 
/return 

Sub Event_Fizzle 
   /varset CastStatus CAST_RESTART 
/return 

Sub Event_Interrupt 
   /varset CastStatus CAST_RESTART 
/return 

Sub Event_Recover 
   /varset CastStatus CAST_RESTART 
   /delay 5 
/return 

Sub Event_Standing 
   /varset CastStatus CAST_RESTART 
   /stand 
/return 

Sub Event_Collapse 
   /varset CastStatus CAST_RESTART 
/return 

Sub Event_OutOfMana 
   /varset CastStatus CAST_OUTOFMANA 
/return 

Sub Event_OutOfRange 
   /varset CastStatus CAST_OUTOFRANGE 
/return 

Sub Event_NoLOS 
   /varset CastStatus CAST_CANNOTSEE 
/return 

Sub Event_Stunned 
   /varset CastStatus CAST_STUNNED 
/return 

Sub Event_Resisted 
   /varset CastStatus CAST_RESISTED 
/return 

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

Post by VesperKnight » Tue Jul 29, 2003 2:11 pm

Thanks for the quick reply! I'm sure your macro will work but... I sort of got stunned right off the bat when I tried to use it..

after copying the above text to a file called CHChat.mac and putting that in my /Macroquest/Macros folder

When I ran it by typing /macro CHChat chcleric 2-2-2 2

and I tried other syntax too

it immediately says in red
Ending Macro: Subroutine main wasn't found

Any help with that? is there a little something missing in the above text? Looks good to me ..

EDIT : I removed the lines that had |** and **| in them and that seemed to fix the problem above.

However now it says "The current macro has ended" as soon as I start it as if it's not looping correctly.

Valerian
a grimling bloodguard
a grimling bloodguard
Posts: 709
Joined: Sun Jul 28, 2002 3:29 am

Post by Valerian » Tue Jul 29, 2003 6:08 pm

haha... forgot to put a main in there? put this in anywhere outside another sub...

Code: Select all

Sub Main
   :Loop
   /doevents
   /goto :Loop
/return

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

Post by VesperKnight » Tue Jul 29, 2003 6:50 pm

I'm sorry.. you mean the Spellcast.mac was missing the main ? or the CHChat one had a sub main but wasn't written right? Keep in mind I'm still new to this..

If anyone wants to design a macro that has the added features that I mentioned in my first post, such as mod rod usage etc. Please feel free to do so too :)

Valerian
a grimling bloodguard
a grimling bloodguard
Posts: 709
Joined: Sun Jul 28, 2002 3:29 am

Post by Valerian » Tue Jul 29, 2003 8:07 pm

doh, my bad... lol didn't scroll up enough. problem is in the block comments. here's the way it should be...

Code: Select all

| USAGE: /macro CHCHat [channelname] [mynumber] [delayinseconds] 
| #chat defines the channel that you want.
| In this case the chat channel is the channel to
| trigger Event_Chat
#chat chat 
#include SpellCast.mac 
| This will loop and be watching for any events
| Thus, it will be waiting for a chat channel to become active
Sub Main 
/varset a(2,0) $p0 
/varset a(2,1) $p1 
/varset a(2,2) $p2 
:loop 
  /doevents 
  /delay 0 
  /goto :loop 
/return 

| This is our Chat event sub. it is triggered evrey time
| someone uses a chat channel, any chat channel
Sub Event_Chat 
/if $p0~~$a(2,0) /if $p2~~$a(2,1) { 
  /delay $a(2,2)s 
  /sit off 
  /call cast "Complete Heal" 
  /sit on 
/return 
NOTE for YKW-28983: Block quotes are a bit weird... the |** and **| need to be the first thing on the line -- or at least that's my interpretation of the source. They are not nestable. It is still much easier to simply use the single-line comment |.

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

Post by VesperKnight » Tue Jul 29, 2003 10:17 pm

ok thanks for clarifying that up

but I'm still having a problem.. when I run the macro.. it seems to work for the first 20 seconds or so (it does what it's supposed to do)

but then I get this error message :

Ending macro: bad {} pairing
chchat.mac@22 (Event_Chat): /if $p0~~$a(2,0) /if $p2~~$a(2,1) {
chchat.mac@13 (Main): :loop

anyone know how to fix this?

I also have a question, if I want my spell to be cast only when I see 2 2 2 in the channel.. how do I do this (because of the spaces... it will count the second 2 as the time variable)

would it be

/macro chchat clerichannel (2 2 2) 3 ?

User avatar
ap50
a snow griffon
a snow griffon
Posts: 425
Joined: Sun Aug 18, 2002 2:29 pm

Post by ap50 » Wed Jul 30, 2003 3:48 am

Code: Select all

/if $p0~~$a(2,0) /if $p2~~$a(2,1) { 
  /delay $a(2,2)s 
  /sit off 
  /call cast "Complete Heal" 
  /sit on 
  }
You were missing the } :roll:
[color=yellow][size=92][b]Just because you're paranoid, it doesn't mean everyone isn't out to get you![/b][/size][/color]

Valerian
a grimling bloodguard
a grimling bloodguard
Posts: 709
Joined: Sun Jul 28, 2002 3:29 am

Post by Valerian » Wed Jul 30, 2003 9:53 am

VesperKnight wrote:I also have a question, if I want my spell to be cast only when I see 2 2 2 in the channel.. how do I do this (because of the spaces... it will count the second 2 as the time variable)

would it be

/macro chchat clerichannel (2 2 2) 3 ?
nope... /macro chchat clerichannel "2 2 2" 3

YKW-28983
a hill giant
a hill giant
Posts: 252
Joined: Sun Dec 01, 2002 11:37 pm

Post by YKW-28983 » Wed Jul 30, 2003 10:24 am

ap50 wrote:

Code: Select all

/if $p0~~$a(2,0) /if $p2~~$a(2,1) { 
  /delay $a(2,2)s 
  /sit off 
  /call cast "Complete Heal" 
  /sit on 
  }
You were missing the } :roll:
Doh, see what happens when I write code off my head? good catch ap..

kagonis
a hill giant
a hill giant
Posts: 228
Joined: Sat May 24, 2003 8:48 pm

Post by kagonis » Thu Jul 31, 2003 2:37 am

Making a macro like that to control 1 toon in a big CH chain makes absolutely no sense to me.

1. If any toons in the chain becomes unable to cast CH, due to LD, death, OOM, you name it, then the macro suddenly have to look for another string.

2. Fizzles, interrupts. If you get fizzle and/or interrupt you can be intelligent and throw a few patches and tell the next cleric to take it. Can probably code this into the macro, but not very intelligently.

Using MQ to control 1 cleric in a CH chain on something as important as Xegony is asking for trouble IMO.

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

Post by VesperKnight » Thu Jul 31, 2003 5:24 am

First of all, in reply to Kagonis, I would never leave my cleric unattended while I did this. The macro is really only there to make the counting, and clicking.. for sometimes as long as 50 minutes.. more precise and less tedious on my part, and my finger's part.

Also, in Xegony's example, we've killed her a handful of times so far and I've noted that our cycle very rarely has any interuptions. I don't know if you've done the encounter, but the way we do it there's very little that can go wrong as far as the cleric rotation is concerned.

Also, because I'm watching the whole time, I can still throw in quick heals if needed, or /end the macro at any time and take over manually if say the cleric before me was to die.

And lastly, I've modifed my macro so it /presses on my CH Cycle hotkey which in itself is already fizzleproof by having multiple lines of /cast in there seperated by chat messages. It works without fail, even on double fizzles.

Using this macro to let the cleric unattended would be unwise yes but that was not my plan nor my intention.

That said, I've encountered problems with the macro.

========================

First, here is the modifed code I now use... you'll have to excuse me for having removed the explanatory text but I thought that very text might be the cause of the weird anomalies I was experiencing.

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 $p0~~$a(2,0) /if "$p2"~~"$a(2,1)" { 
  /delay $a(2,2)s 
  /press 1
 }
/return 
The only major change from the original script is the line

Code: Select all

/if $p0~~$a(2,0) /if "$p2"~~"$a(2,1)" { 

in which it was suggested I add ""s sp that the macro could deal with spaces in the text it's looking for. IE the macro was not recognizing 2 2 2 because of the spaces but now it does as long as you write it /macro chchat channel "2 2 2" delay

I have this problem now... I wasn't expecting to have this one... but I guess that's how the macro works right now.

the last time I used the command I used this one

/macro chchat testcleric "8 8 8" 1.5

btw it handles half seconds.. and that's great since 2 seconds was a bit too slow. the macro was running great.. every time the person before me CH and his msg went off, my CH and msg went off approx 2 seconds later

but then later in the fight cleric 8 had to be skipped one round.. so as customary for us to do.. he said "skip 8" .. and that made my ch/msg go off too

now that's not good.. it was only supposed to go off when it said "8 8 8" not just any random single 8....

can you, or anyone, think of any way to make sure it only goes off when the chat matches exactly what it's looking for? in this case.. "8 8 8"

thanks that'd be great

but here's yet another problem.. much weirder then the first

At someone point while running the above macro.. from which I removed the "include spellcast.mac" because I didn't need it. It gave me this error message that really boggled me : Couldn't find a comparision operator in 'the'

... and it said that after there was no mention whatsoever of the word 'THE' in either the chat channel or other channels. I then removed all the explanatory text from the macro.. thinking it might be one of those 'the' that was messing it up.. and the same error happened later on

Also I thought of going around my problem with the macro not recognizing "8 8 8" as "8 8 8" and going off when a single 8 was spoken.. by having it look for "<8" instead since cleric 8's macro was <8 8 8> in fact. I tested this and indeed the macro no longer went off at the mention of a single 8... however it now went off at the mention of ANY "<" even if not followed by an 8...

just some minor problems I'm hoping

kagonis
a hill giant
a hill giant
Posts: 228
Joined: Sat May 24, 2003 8:48 pm

Post by kagonis » Sun Aug 03, 2003 6:33 am

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
My experience tells me that you should -allways- put strings inside quotes. And integers should stay outside quotes.

First problem is solved simply by giving your macro a more precise string to look for. Instead of just looking for "8" you make it look for as big a chunk of text as you can. Then when someone says "Skip 8" you just have to /endmacro, modify the trigger string to take the new cleric you are after into account, and you're going again. Wich should take no more than 20 seconds.

Last problem could be in the lack of quoting, perhaps where you are setting the parameters into the array.

And yes, I have done the Xegony encounter. Is one of the more fun encounters where you have to be on your toes on the CC teams ;)