loop collision? (also some other questions..)

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

Moderator: MacroQuest Developers

User avatar
Kint
a hill giant
a hill giant
Posts: 208
Joined: Thu Mar 13, 2003 3:36 am

loop collision? (also some other questions..)

Post by Kint » Wed Jul 16, 2003 4:54 am

here's teh code...

Code: Select all

#turbo
#event  NI "You begin casting Nature's Infusion."
#event  KR "You begin casting Karana's Renewal."
#event  snare "has been ensnared."
#event  root "You begin casting Savage Roots."
#event  RI "is surrounded by an outline of cold flame."
#event  HoR "is immolated by blazing flames."
#event  eci "is encrusted with a thin layer of ice."
#event  sotw "is encrusted by bark."
#event  rooted "is entrapped by roots."
#event  DS "surrounded by a thorny barrier."
#event  unsnare" Your Ensnare spell has worn off."
#event  exp "experience"
#event  cure "you begin casting Radiant "
#event  immune "Your target is immune to changes in its run speed"
#define ensnare v56
#define Damageshield1 t1
#define Damageshield2 t2
#define Damageshield3 t3
#define tank1 v55
#define tank2 v57
#define tank3 v58
#define Vsotw v59
#define channel v60

||usage: /macro call.mac <channel (/g, /2)> <MT> <ST>

Sub Main
/echo usage: /macro call.mac <channel (g, 2) [[don't use a /]]> <MT> <ST>
/if $p0== {
/echo you must specify a channel for calls
/end }
	 /varset v10 $p1
	 /varset v11 $p2
	 /varset channel $p0
	 /varset ensnare 0
	 /varset Vsotw 0
	 :loop
                 /goto :grouphealth
	 /doevents
	 /if n $Vsotw>=1 /call sotwCall
	 /goto :loop
/return

                 :grouphealth
	 /if n $spawn($group(1),hp,pct)<=50 {
	    /if n $spawn($group(1),id)!=$target(id) {
	       /if n $spawn($group(1),name)!=NULL {
	          /if n $t5==0 {
         /echo better check $spawn($group(1),name)
         /varset t5 5s
				}
			}
		} 
	}
	 /if n $spawn($group(2),hp,pct)<=50 {
	    /if n $spawn($group(2),id)!=$target(id) {
	       /if n $spawn($group(2),name)!=NULL {
	          /if n $t6==0 {
         /echo better check $spawn($group(2),name)
         /varset t6 5s
				}
			}
		} 
	}
	 /if n $spawn($group(3),hp,pct)<=50 {
	    /if n $spawn($group(3),id)!=$target(id) {
	       /if n $spawn($group(3),name)!=NULL {
	          /if n $t7==0 {
         /echo better check $spawn($group(3),name)
         /varset t7 5s
				}
			}
		} 
	}
	 /if n $spawn($group(4),hp,pct)<=50 {
	    /if n $spawn($group(4),id)!=$target(id) {
	       /if n $spawn($group(4),name)!=NULL {
	          /if n $t8==0 {
         /echo better check $spawn($group(4),name)
         /varset t8 5s
				}
			}
		} 
	}
	 /if n $spawn($group(5),hp,pct)<=50 {
	    /if n $spawn($group(5),id)!=$target(id) {
	       /if n $spawn($group(5),name)!=NULL {
	          /if n $t9==0 {
         /echo better check $spawn($group(5),name)
         /varset t9 5s
				}
			}
		} 
	}
         /goto :loop

sub Event_unsnare
/varset ensnare 0
/return

sub Event_cure
/$channel cure incomming
/return

sub Event_immune
/$channel %T is immune to changes in its run speed
/return

sub Event_exp
/varset ensnare 0
/return

Sub Event_NI
	  /if $target(type)==NPC {
/delay 1s
/press s
/delay 1s
/press s
/return
}
	  /if $target(type)==Corpse {
/delay 1s
/press s
/delay 1s
/press s
/return
}
/if $target(type)!=NPC {
/IF $target(type)!=Corpse {
/if n $target(hp,pct)<=80 /$channel patching %T
/return
}
	}



Sub Event_KR
	  /if $target(type)==NPC {
/delay 1s
/press s
/delay 1s
/press s
/return
}
	  /if $target(type)==Corpse {
/delay 1s
/press s
/delay 1s
/press s
}
/if $target(type)!=NPC {
/if $target(type) != Corpse {
/if n $target(hp,pct)<90 {
/$channel 4.7k heal inc %T, 10 seconds
/return
}
	}
		}

Sub Event_snare
/if n $ensnare==0 /$channel %T snared
/varset ensnare 1
/return

Sub Event_Rooted
/$channel %T rooted! back away so it doesn't pwn you.
/return

Sub sotwCall
/if $target(id)==$group(0) /g SotW inc
/if $target(id)==$group(1) /g SotW inc
/if $target(id)==$group(2) /g SotW inc
/if $target(id)==$group(3) /g SotW inc
/if $target(id)==$group(4) /g SotW inc
/if $target(id)==$group(5) /g SotW inc
/if $target(type)==NPC /g SotW inc
	 /if $target(type)!=NPC {
	 /if $channel!=g {
	 /$channel SotW to %Ts group
	 }
	 	}
/varset Vsotw 0
/return

Sub Event_sotw
/varadd Vsotw 1
/return

Sub Event_RI
	 /if n $target(level)>=65 /$channel Ro's Illumination on %T, ac(15) and atk(80) debuffed.
/return

Sub Event_HoR
	 /if n $target(level)>=65 /$channel HoR on %T, ac(15), atk(100) and FR(72) debuffed
/return

Sub Event_eci
	 /if n $target(level)>=65 /$channel e`ci's on %T, ac(24) and CR(55) debuffed
/return

Sub Event_DS
/if n $Damageshield1==0 {
	 /varset tank1 $target(name)
	 /varset Damageshield1 6m
} else /if ($Damageshield1!=0 && $Damageshield2==0) {
	 /varset tank2 $target(name)
	 /varset Damageshield2 6m
} else /if n $Damageshield3==0 {
	 /varset tank3 $target(name)
	 /varset Damageshield3 6m
}
/return

Sub Event_timer
/if n $p0==1 {
/echo time to redo DS on $tank1
} else /if n $p0==2 {
/echo time to redo DS on $tank2
} else /if n $p0==3 {
/echo time to redo DS on $tank3
}
/return

|||TODO|||
get all checks on heals to work (mostly working I think, get couldn't parse '=Corpse  when cast on PC)
it should warn me if the mob gets below 40 health and I haven't snared it yet
link snare to $target(id) (for multiple targets)
add abort mesage for aborted heals
calculate targets health and calculate if I should abort the Cheal and start a patch or not
add a str buff timer
add patch msg for chloroblast
make it invis me every time invis drops and I have a pet, or let me set autoinvis on the fly
give a rogue calculation for when I should start a CH based on the rate at which the tanks HPs drop**|

at random intervals, I will get an error with something to the effect of event_snare colliding with sub Main. then, two events will go off, it'll say "target is snared" and "cure incomming" then the macro will crash. any hints? I think it may have something to do with where I put /doevents.


I also have some more questions if anyone cares to answer them. the :grouphealth loop doesn't seem to work at all.
Also, I have is say $channel to use /g, /2 or whatever as the channel for all my calls. This doesn't work unless I do /if n 1==1, etc. It doesn't work period if I have channel as /rs.
And if anyone wants to help get anything on my todo list done... :twisted: :twisted: :D

thanks


Edit: updated it so that when sending a msg it's initialized by a / and then the appropriat channel. I'll test it when I get home.
Last edited by Kint on Wed Jul 16, 2003 12:57 pm, edited 5 times in total.

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 Jul 16, 2003 5:20 am

Also, I have is say $channel to use /g, /2 or whatever as the channel for all my calls. This doesn't work unless I do /if n 1==1, etc. It doesn't work period if I have channel as /rs.
That's the way the macro interpreter works. $channel at the beginning of a line doesn't get expanded. You need to have a / command (either mq or eq) since only parameters get expanded.

I don't know about /raidsay. It seems like it should work.

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

Post by ap50 » Wed Jul 16, 2003 5:56 am

gotta be careful with /raidsay... Whether it's still the case or not, I'm not sure, but a number of times in the past when I've switched my CH message from /GS or /GU to /RS it's changed from (paraphrasing)
Blahblah tells the group, "Incoming Complete Heal to HardBastard the Barbarian Warrior" to
Blahblah tells the raid, "Incoming Complete Heal to $target(name) the $target(race) $target(class)"

Which can be completely embarressing - especially during the time when /rs was bugged and people outside the raid got /rs chat too..
[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 16, 2003 8:22 am

heh... nifty bug that... raid events shouldn't be that hard to set up, just a matter of adding a define and a section of code to catch the raid say event, and recompilling... when I get done with the script class I'm working on, I'll put that change in (if someone else doesn't do it first)

User avatar
BlueSkies
a ghoul
a ghoul
Posts: 132
Joined: Tue Oct 01, 2002 6:22 pm

Post by BlueSkies » Wed Jul 16, 2003 10:48 am

Script class?
Live your dreams! Blue Skies everyone

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

Post by Valerian » Wed Jul 16, 2003 1:34 pm

yeah, working on putting the entire macro handling into a class, and making it possible to nest macros in macros...

Code: Select all

Sub Main
:Looping
/macro ThatMacro
/macro ThisOtherMacro
/if $return==QUIT /endmacro
/goto :Looping
and then I'll probably impliment some form of startup commands... either a static macro name to be run on startup, or .ini file lines to "create" a macro with and run that... big plans... lots of code reorg... learning all about how the inner workings work... hehe

User avatar
Kint
a hill giant
a hill giant
Posts: 208
Joined: Thu Mar 13, 2003 3:36 am

Post by Kint » Wed Jul 16, 2003 4:06 pm

lol, nice. sounds really interesting and very helpfull =p. PM me if you want my help, I'd be interested in trying to work that out.

thanks for the help also