Multi-treading or synth

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

Moderator: MacroQuest Developers

crazybear
decaying skeleton
decaying skeleton
Posts: 4
Joined: Fri Mar 28, 2003 8:03 pm

Multi-treading or synth

Post by crazybear » Fri Mar 28, 2003 8:15 pm

thinking about adding my own twist to the wonderfull cleric.mac of Dirtface and crew.

Heres what I wanna do
- No heals in begining of fights (agro avoid), unless HP %T < 40
- Gone try improve Auto healing by using some HP/ Heal levels of nesting
- Durring fight if flag = true cleric will move to target and heal if in xxx range then /return if Out of range error occurs
- /heal %T ability, also perhapse buffs.
- Gone add Nuke %T (no brainer though)

Heres how I plan to do it

Controler goes into fight sends tell set Vfight = true
the problem is I don't want to stick the CLR into a single threading hold:

is MQ a multi-thread app?

is there a time tracker value I can use to hold off some loops until x time passes?

CrazyBear

|| Napolion ||
a ghoul
a ghoul
Posts: 96
Joined: Sat Dec 28, 2002 7:45 am

Post by || Napolion || » Sat Mar 29, 2003 8:14 pm

There is a timer you can use $t#
If you read true the help file you get more info on it.

|| Napolion ||

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

Post by L124RD » Sat Mar 29, 2003 9:17 pm

Salutations,
This code will excecute events 0, 1 and 2 after 25, 17 and 39 seconds respectively:

Code: Select all

| timer event example

sub main
  /varset t0 25s
  /varset t1 17s
  /varset t2 39s
  /echo Timers have been set.  Please wait...
  :main_loop
    /doevents
    /goto :main_loop
/return

sub event_timer
  /echo Event $p0 fired! It was set to go off after $calc($p1/10) seconds.
  /if n $p0==2 /endmacro
/return

crazybear
decaying skeleton
decaying skeleton
Posts: 4
Joined: Fri Mar 28, 2003 8:03 pm

Well I guess it time to let it loose

Post by crazybear » Fri Apr 25, 2003 1:13 am

Here it is my project that didn't quite go all the way. Basically the originators need the credit I simply added a more advanced healing routine and a few low level bells and whistles.

Code: Select all

| cleric.mac 
| cleric petbot 
|  
| Modded By Crazybear
| Courtesy of Dirtface 
| Special thanks: Wes (for the idea of the FOR loop) 
|                 Fippy (for figuring out "What went wrong.) 
|                 Valerian (for completely writing the Autoheal script 
|                           and the auto loot script. 
|                           Seriously, Val figured this whole thing out.) 
|                 Sparr (For helping me with the Set camp feature) 
| Usage: /macro cleric.mac <character in control> 

#define GroupMember v93 
#define GroupMax v90 
#define ChatCommand p2 
#define XLOC v52 
#define YLOC v53 
#define $GroupClass $spawn($group($GroupMember),class) 

#include SpellSub.mac 
#include routines.mac 
#chat tell 
#Event Invited "To join the group, click on the 'FOLLOW' option, or 'DISBAND' to cancel" 
#Event ClarityGone "Your mind returns to normal." 
#Event InvisGone "You feel yourself starting to appear" 
#Event RootGone "Your Immobilize spell has worn off." 
#Event FollowOff "You are no longer auto-following " 

Sub Main 
   /varset v69 $p0 
:chkevent 
   /doevents 
   | *** AutoHeal *** 

   /varcalc GroupMax $group(count)-1 
   /for GroupMember 0 to $GroupMax 
	 /if n $spawn($group($GroupMember),hp,pct)<1 /goto :nextmember 

	 /if "$GroupClass"=="Warrior" /goto :Tankheal 
	 /if "$GroupClass"=="Paladin" /goto :Tankheal 
	 /if "$GroupClass"=="Shadow Knight" /goto :Tankheal 
	 /if "$GroupClass"=="Monk" /goto :Meleheal 
	 /if "$GroupClass"=="Ranger" /goto :Meleheal 
	 /if "$GroupClass"=="Rogue" /goto :Meleheal 
	 /goto :CasterHeal 

:Tankheal 
	/if n $spawn($group($GroupMember),hp,pct)<41 { 
		/if n $group($GroupMember)==$char(id) /press F1 
		/if n $group($GroupMember)!=$char(id) /target id $group($GroupMember) 
		/if n $target(distance)>100 {
			/tell $p0 %T is too far away.
			/delay 30
			/press esc 
			/goto :nextmember 
		}
		/stand 
		/g Complete Heal >> %T
		/call SpellSub 6 100 
		/sit 
		/press esc 
         }
         /goto :nextmember 

:Meleheal 
	/if n $spawn($group($GroupMember),hp,pct)<61 { 
		/if n $group($GroupMember)==$char(id) /press F1 
		/if n $group($GroupMember)!=$char(id) /target id $group($GroupMember) 
		/if n $target(distance)>100 {
			/tell $p0 %T is too far away.
			/delay 30
			/press esc 
			/goto :nextmember 
		}
		/stand 
		/g SupHeal >> %T 
		/call SpellSub 7 50 
		/sit 
		/press esc 
         }
         /goto :nextmember 

:Casterheal 
 	/if n $spawn($group($GroupMember),hp,pct)<71 { 
		/if n $group($GroupMember)==$char(id) /press F1 
		/if n $group($GroupMember)!=$char(id) /target id $group($GroupMember) 
		/if n $target(distance)>100 {
			/tell $p0 %T is too far away.
			/delay 30
			/press esc 
			/goto :nextmember 
		}
		/stand 
		/g SupHeal >> %T 
		/call SpellSub 7 50 
		/sit 
		/press esc 
	}
        /goto :nextmember 

:nextmember 
      } 
   /next GroupMember 
   /goto :chkevent 
/return 

Sub Event_Chat 

:Commands 

| *** Complete Heal *** 

/if "$ChatCommand"=="ch" { 
     /target $p1 
     /stand 
     /g COMPLETE HEAL on %T in 10seconds 
     /call SpellSub 1 105 
     /sit 
     /press esc 

| *** HEAL OVER TIME *** 

   } else /if "$ChatCommand"=="ce" { 
     /target $p1 
     /stand 
     /g Cel Heal >> %T 
     /call SpellSub 1 50 
     /sit 
     /press esc 

| *** Cure Poison *** 

   } else /if "$ChatCommand"=="poison" { 
     /target $p1 
     /stand 
     /g Cure Poison >> %T 
     /call SpellSub 6 50 
     /sit 
     /press esc 

| *** GATE *** 

   } else /if "$ChatCommand"=="gate" { 
     /stand 
     /g Gating 
     /call SpellSub 8 55 
      
| *** HP BUFF *** 

   } else /if "$ChatCommand"=="HP" { 
     /target $p1 
     /stand 
     /g HP Buff on %T 
     /call SpellSub 5 65 
     /sit  
     /press esc 

| *** Superior Heal *** 

   } else /if "$ChatCommand"=="Heal" { 
     /target $p1 
     /stand 
     /g SHeal >> %T
     /call SpellSub 7 50 
     /sit 
     /press esc 

| *** Pet Superior Heal *** 

   } else /if "$ChatCommand"=="pet" { 
     /press esc 
     /press f2 
     /press f2 
     /stand 
     /g CH on %T 
     /call SpellSub 1 105 
     /sit 
     /press esc 

| *** Symbol *** 

   } else /if "$ChatCommand"=="Symbol" { 
     /target $p1 
     /stand 
     /g Symbol on %T 
     /call SpellSub 3 55 
     /sit  
     /press esc 

| *** AC BUFF *** 

   } else /if "$ChatCommand"=="AC" { 
     /target $p1 
     /stand 
     /g AC BUFF on %T 
     /call SpellSub 4 85 
     /sit 
     /press esc 

| *** Root *** 

     } else /if "$ChatCommand"=="root" { 
     /target $p1 
     /assist 
     /stand 
     /delay 7 
     /g Rooting %T 
     /call SpellSub 2 40 
     /sit 
     /press esc 

| *** Nuke *** 

     } else /if "$ChatCommand"=="nuke" { 
     /target $p1 
     /assist 
     /stand 
     /delay 7 
     /g Nuke >> %T
     /call SpellSub 1 40 
     /sit 
     /press esc 

| *** Report Mana *** 

   } else /if "$ChatCommand"=="mana" { 
     /stand 
     /dismount 
     /press F1 
     /g Mana is at $char(mana,pct) 
     /press esc 
     /sendkey down shift 
     /press 2 
     /press shift 
     /press 0 
     /press esc 

| *** AUTOFOLLOW *** 

   } else /if "$ChatCommand"=="follow" { 
     /target $p1 
     /face 
     /sit off 
     /follow 
     /r Lead on %T 
     /varset v10 0 

| *** Define Camp Spot *** 

   } else /if "$ChatCommand"=="setcamp" { 
     /press F1 
     /delay 5 
     /varset XLOC $char(x) 
     /varset YLOC $char(y) 
     /g Ok. Here I sit. 

| *** AUTORETURN (to camp)*** 

   } else /if "$ChatCommand"=="return" { 
:return 
     /stand 
     /face loc $YLOC,$XLOC 
     /call GotoLoc $YLOC,$XLOC 
     /sit 

| *** AUTOSTOP *** 

   } else /if "$ChatCommand"=="stop" { 
     /press down 
     /varset v10 1 
     /r Stopping here. 

| *** SIT/STAND *** 

   } else /if "$ChatCommand"=="sit" { 
     /sit 

| *** MOUNT HORSE *** 

   } else /if "$ChatCommand"=="mount" { 
     /sendkey down shift 
     /press 2 
     /press shift 
     /press 0 

| *** DISMOUNT HORSE *** 

   } else /if "$ChatCommand"=="dismount" { 
     /dismount 

| *** LFG ON *** 

   } else /if "$ChatCommand"=="LFG" { 
     /delay 10 
     /press f1 
     /delay 10 
     /disband 
     /delay 10 
     /lfg on 
     /r LFG now. 

| *** CAMP *** 

   } else /if "$ChatCommand"=="camp" { 
     /sit off 
     /sit 
     /camp 
     /delay 10 
     /unload 

| *** COMMAND HELP *** 

   } else /if "$ChatCommand"=="command help" { 
     /reply [CE] - Celestial Heal, [CH] - Complete Heal, [AC] - HP Buff, [HP] - HP Buff, [Heal] - Superior Heal, [Root] - Root Mob, [Nuke] - DD Mob, [Gate] - Gate out, [Mana] - Report Mana, [Follow] - Follow, [Stop] - Stop Follow, [Loot] - Autoloot, [Setcamp] = Set camp spot, [Return] - Return to camp, [Sit] - Sit/Stand, [MOUNT/DISMOUNT] - (dis)mount Horse, [LFG] - LFG ON, [Camp] - Camp
            
   } 
/return 

Sub Event_Invited 
   /delay 20 
   /invite 
/return 

Sub Event_ClarityGone 
   /g I'm outa crack and I'm gettin feindish... 
/return 

Sub Event_InvisGone 
   /g Invis is wearing off. 
/return 

Sub Event_RootGone 
   /g Root Wore off. 
     /press f2 
     /assist 
     /delay 11 
     /stand 
     /g Rooting %T 
     /call SpellSub 3 40 
     /sit 
     /press esc 
/return 

Sub Event_FollowOff 
   /if n $v10==1 { 
      /r Parked. 
   } else { 
      /g Lost ya. 
      /sendkey down up 
      :KeepRunning 
      /face 
          /if n $target(distance)<50 { 
             /sendkey up up 
             /follow 
             /varset v10 0 
             /g Back on Auto-Follow. go ahead. 
          } else { 
             /goto :KeepRunning 
          } 
       } 
/return