#Event help

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

Moderator: MacroQuest Developers

Epsilon
a lesser mummy
a lesser mummy
Posts: 61
Joined: Wed Apr 30, 2003 5:46 pm

#Event help

Post by Epsilon » Sun Sep 14, 2003 2:25 pm

hi i was trying to write my own CH rotation macro but i cant get it to work, how do i make so it reads text from a chat channel? if i type CLERIC1 in say etc then it works but not from a chat channel..thanks would love some help here

Code: Select all

#chat chat
#include spellsub.mac
#Event Rotation "CLERIC1"

Sub Main 
    :loop   
      /doevents
    /goto :loop
/return

Sub Event_Rotation
	/stand up
	/cast 1
	/2 CH on %t
	/delay 4
	/2 CH on %t ------------------------ CLERIC2 next
	/cast 1	
/return

Shin Noir
a ghoul
a ghoul
Posts: 90
Joined: Tue Aug 05, 2003 8:18 pm

Post by Shin Noir » Mon Sep 15, 2003 6:39 am

Hmm why does this look familiar.. Oh ya! Because it was posted about already HERE.

Here was the ending code

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

Epsilon
a lesser mummy
a lesser mummy
Posts: 61
Joined: Wed Apr 30, 2003 5:46 pm

Post by Epsilon » Tue Sep 16, 2003 5:52 am

wow thanks shin, that looks a bit more advanced than mine hehe

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

Post by grimjack » Tue Sep 16, 2003 7:38 am

If you know exactly what phrase you want to kick off the cheal (Other members of chain useing hotkey to report) you may want to change:

Code: Select all

   /varset a(2,0) "$p0"
   /varset a(2,1) "$p1"
   /varset a(2,2) $p2 
to

Code: Select all

   /varset a(2,0) $lcase("$p0")
   /varset a(2,1) $lcase("$p1")
   /varset a(2,2) $lcase($p2)


and

Code: Select all

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

Code: Select all

 /if $lcase("$p0")=="$a(2,0)" /if $lcase("$p2")=="$a(2,1)" {
It's a little more precise on what it matches.

If you don't want it to be that precise I would still change the first part and use this for the second.

Code: Select all

/if $lcase("$p0")=="$a(2,0)" /if $lcase("$p2")~~"$a(2,1)" { 
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

case

Post by boredom » Tue Sep 16, 2003 10:49 am

I don't beleive comparisons are case sensitive. In any case, MQ will store $a(2,0), $a(2,1), and $a(2,2) as lower case wether you want it to or not.

/Bored

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

Re: case

Post by grimjack » Wed Sep 17, 2003 1:59 am

boredom wrote:I don't beleive comparisons are case sensitive. In any case, MQ will store $a(2,0), $a(2,1), and $a(2,2) as lower case wether you want it to or not.

/Bored
I'm pretty sure you are correct. The lcase statements where more for in case they changed MQ to be case sensitive in the future. The main thing I was looking at was ~~ vs ==. While in most instances ~~ works, I prefer to use exact comparisons when I can. Having a trigger match when it shouldn't can cause some really wierd situations.

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