PowerPull.mac - Helps with PLing.

Macro depository for macros written before the user variable changes that broke all of them.

Moderator: MacroQuest Developers

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

PowerPull.mac - Helps with PLing.

Post by YKW-28983 » Mon Jan 20, 2003 1:20 pm

This helps me when i'm pling my warrior or any other account that actually melee. as a shaman I yank a mob back with slow, incapacitate it, and then root it and then send my warrior in for the killing.


Fight.mac - Author: L124RD. With a few modifications

Code: Select all

| fight.mac 
| Syntax: /macro fight.mac &ASSIST (0=none), range (1-3), tank=1 dmg=0, tracking 0=off 1=on, autoattack 0=off 1=on&
| example: /macro fight.mac larry 2 0 1 0
| Range is a multiplier of 5.
| Autoattack is mainly used for jousting in pvp (turns off attack if range &15)
#include core.mac
#turbo
#Event Enrage "has become ENRAGED."
#Event UnEnrage "is no longer enraged."
#Event Stunned "You are stunned!"
#Event Unstunned "You are unstunned."
#Event Loading "LOADING, PLEASE WAIT..."

Sub main
/if $gm==TRUE /echo GM IN ZONE!!!!
/if $p0!=0 {
	/assist $p0
	/delay 5
}
/varset v0 $target(name)
/varset v1 $target(id)
/varset v2 0 | enrage
/varset v3 0 | stun
/if $v0=="NULL" /goto :EndAF
/if n $p0!=0 /echo Assisting $p0 at range $p1 on $target(name) level $target(level).
/if n $p0==0 /echo Engaging at range $p1 on $target(name) level $target(level).
/attack on
:CloserAF
 /if "$target(id)"!="$v1" /goto :EndAF
 /doevents
 /if $p4!=0 /call AutoAttack
 /if $p3!=0 /call Tracking$p1
 /if $p2!=0 /call AggroFunctions
 /if $v3==0 /call DmgFunctions
 /goto :CloserAF

:EndAF
| /echo $v0 is dead
 /sendkey up W
 /sendkey up D
 /attack off
 /varset v0 0
 /varset v2 0
 /varset v3 0
| /exp
| /mqlog EXP is $char(exp) %
 /macro FightWait
/return

Sub Tracking1
 /face nopredict fast
 /if n $target(distance)&5 /sendkey down W
 /if n $target(distance)&6 /sendkey up W
/return
Sub Tracking2
 /face nopredict fast
 /if n $target(distance)&14 /sendkey down W
 /if n $target(distance)&6 /sendkey down W
 /if n $target(distance)&15 /sendkey up W
 /if n $target(distance)&5 /sendkey up W
/return

Sub Tracking3
 /face nopredict fast
 /if n $target(distance)&30 /sendkey down W
 /if n $target(distance)&16 /sendkey down D
 /if n $target(distance)&31 /sendkey up W
 /if n $target(distance)&15 /sendkey up D
/return

Sub AggroFunctions
 /if n $v3==1 /return
 /if n $target(distance)&15 /return
 /if n $char(ability,taunt)&0 /doability taunt
 /if n $char(ability,disarm)&0 /doability disarm
 /if n $char(ability,begging)&0 {
   /attack off
   /doability begging
   /attack on
 }
/return

Sub DmgFunctions
 /if $v2==1 /return
 /if n $char(ability,slam)&0 /doability slam
 /if n $char(ability,kick)&0 /doability kick
 /if n $char(ability,"flying kick")&0 /doability "flying kick"
/return

Sub AutoAttack
 /if n $target(distance)&15 /attack off
 /if $v2!=0 /return
 /if n $target(distance)&15 /attack on
/return

Sub Event_Enrage
 /if n $target(hp,pct)&25 {
 /attack off
 /varset v2 1
 }
/return

Sub Event_UnEnrage
 /attack on
 /varset v2 0
/return

Sub Event_Stunned
 /varset v3 1
/return

Sub Event_Unstunned
 /varset v3 0
/return

Sub Event_Loading
/goto :EndAF
FightWait.mac - Code I wrote to wait for command.

Code: Select all

#chat tell

#define owner OWNERNAMEHERE

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

Sub Event_Chat
 /if $p1=="owner" {
  /if $arg(1,"$p2")==Assist {
   /sit off
   /target id $arg(3,"$p2")
   /reply Assisting you with $target(name)
   /macro fight tracking 1
  }
 }
/return
and if you don't have core.mac you will need it.

Code: Select all

#define SUCCESS 0 
#define TARGET_NOT_FOUND -1000 
#define TARGET_TOO_FAR -1001 
#define TIMED_OUT -1002 
#define ITEM_NOT_FOUND -1003 
#define FIND_NOT_FOUND -1004 
#define TOO_FULL -1005 
#define INVALID_COMBINER -1006 

#define BankOpen v99 
#event Bank "Welcome to my bank" 


| GotoLoc 
| Usage: /call GotoLoc x,y [precision] 
| Explaination: Runs your char the the loc specified in x,y if precision is supplied then 
| the char will stop within that many ticks of the loc alse the default of 5 is used. 
| Once the loc is reached then the char will stop running 
| Returns: TIMED_OUT if some problem caused sub to timeout 
| Author: Fippy. Mostly taken from routines.mac supplied with MQ distrib 

Sub GotoLoc  
   /varset t10 200 
   /varset l1 5 
   /if $p1==&1 /varset l1 $p1 
   :GotoLocLoop 
      /doevents 
      /face loc $p0 
      /call AutoRun 1 
      /if n $t10==0 /return TIMED_OUT 
   /if n $distance($p0)&$l1 /goto :GotoLocLoop 
   /call AutoRun 0 
/return 

| GotoLocCon 
| Usage: /call GotoLocCon x,y [precision] 
| Explaination: Runs your char the the loc specified in x,y if precision is supplied then 
| the char will stop within that many ticks of the loc alse the default of 5 is used. 
| Once the loc is reached then the char will carry on running 
| Returns: TIMED_OUT if some problem caused sub to timeout 
| Author: Fippy. Mostly taken from routines.mac supplied with MQ distrib 
Sub GotoLocCon 
   /varset t10 200 
   /varset l1 5 
   /if $p1!="" /varset l1 $p1 
   :GotoLocConLoop 
      /doevents 
      /face loc $p0 
      /call AutoRun 1 
      /if n $t10==0 /return TIMED_OUT 
   /if n $distance($p0)&$l1 /goto :GotoLocConLoop 
/return 


Sub AutoRun 
   /if $p0==$v80 /return 
   /varset v80 $p0 
   /if $p0==1 /sendkey down up 
   /if $p0==0 /sendkey up up 
/return 

| CleanPack 
| Usage: /call CleanPack &inventory slot pack is in or e for environmental pack& 
| Explaination: Takes any items in the currently opencombiner (Fletching Kit, Spit, Forge, BrewBarrel, Loom etc) 
| and drops them into the players inventory. 
| Returns: TIMED_OUT if some problem caused sub to timeout 
| Author: Fippy. Mostly taken from cheese.mac originally by L12ard & Plazmic 
Sub CleanPack 
/mqlog Cleenpack called with $p0 
   /if "$p0"=="e" { 
      /varset l3 enviro 
   } else { 
      /varset l3 "pack $p0" 
   } 
   /varcalc l2 $pack($p0,slots)-1 
   /sendkey down shift 
   /varset t10 200 
   /for l1 0 to $l2 
      /doevents 
      /if "$item($p0,$l1)"=="NULL" /goto :SkipClean 
      /click left $l3 $l1 
      :CleanWait0 
      /doevents 
      /if n $t10==0 /return TIMED_OUT 
      /if "$cursor()"!="TRUE" /goto :CleanWait0 
      /click left auto 
      :CleanWait1 
      /doevents 
      /if n $t10==0 /return TIMED_OUT 
      /if "$cursor()"=="TRUE" /goto :CleanWait1 
   :SkipClean 
   /next l1 
   /sendkey up shift 
/return 

| OpenMerchant 
| Usage: /call OpenMerchant &name& 
| Explaination: Checks that the merchant is in the zone and close enough to trade with. 
| Returns: TARGET_NOT_FOUND if the name supplied is not present in the zone 
|          TARGET_TOO_FAR if the target is too far away to trade with 
|          TIMED_OUT if some other problem caused a timeout 
| Author: Fippy. 
sub OpenMerchant 
   /mqlog OpenMerchant: $p0 selected 
   /call ResetKeys 
   /call EmptyHands 
   /cleanup 
   /varset t10 200 
   :WaitMerchant 
      /doevents 
      /target $p0 
      /if "$getlasterror"=="TARGET_NOTFOUND" /return TARGET_NOT_FOUND 
      /if n $target(distance)&19 /return TARGET_TOO_FAR 
      /face nopredict 
      /click right target 
      /press u 
      /delay 2 
      /if n $t10==0 /return TIMED_OUT 
   /if "$merchant"=="FALSE" /goto :WaitMerchant 
   /delay 5 
/return SUCCESS 

| OpenBank 
| Usage: /call OpenBank &name& 
| Explaination: Checks that the banker is in the zone and close enough to trade with. 
| Returns: TARGET_NOT_FOUND if the name supplied is not present in the zone 
|          TARGET_TOO_FAR if the target is too far away to trade with 
|          TIMED_OUT if some other problem caused a timeout 
| Author: Fippy. 
sub OpenBank 
   /mqlog OpenBanker: $p0 selected 
   /varset BankOpen 0 
   /call ResetKeys 
   /call EmptyHands 
   /cleanup 
   /varset t10 200 
   :WaitBanker 
      /doevents 
      /target $p0 
      /if "$getlasterror"=="TARGET_NOTFOUND" /return TARGET_NOT_FOUND 
      /if n $target(distance)&19 /return TARGET_TOO_FAR 
      /face nopredict 
      /click right target 
      /press u 
      /delay 2 
      /if n $t10==0 /return TIMED_OUT 
   /if n $BankOpen==0 /goto :WaitBanker 
   /delay 5 
/return SUCCESS 

| SellItems 
| Usage: /call SellItems &number of stacks to sell& &Name of Item& 
| Explaination: Sells the specified amount of the specified item. Assumes that 
| you have already opened the merchant window. see OpenMerchant. 
| Returns: ITEM_NOT_FOUND if you dont have the item in your inventory 
|          TIMED_OUT if some other problem caused a timeout 
| Author: Fippy. 
Sub SellItems 
   /mqlog SellItems: selling $p0 stacks of $p1  
   /if n "$count("$p1")"&1 /return ITEM_NOT_FOUND 
   /sendkey down shift 
   /varset t10 200 
   /for l1 1 to $p0 
      /doevents 
      /finditem "$p1"  
      /varset l2 $char(cash) 
      /click left merchant buy 
      :SellItemsLoop 
         /delay 0 
         /if n $t10==0 /return TIMED_OUT 
      /if n $char(cash)==$l2 /goto :SellItemsLoop 
   /next l1 
   /sendkey up shift 
/return SUCCESS 

| BuyItems 
| Usage: /call BuyItems &number of stacks to buy& &Name of Item& 
| Explaination: Buys the specified amount of the specified item. Assumes that 
| you have already opened the merchant window. see OpenMerchant. 
| Returns: ITEM_NOT_FOUND if the merchant does not have the requested item. 
|          TIMED_OUT if some other problem caused a timeout 
| Author: Fippy. 
Sub BuyItems 
   /mqlog BuyItems: buying $p0 stacks of $p1  
   /if "$merchant(has,"$p1")"=="FALSE" /return ITEM_NOT_FOUND 
   /merchant "$p1"  
   /sendkey down shift 
   /varset t10 200 
   /for l1 1 to $p0 
      /doevents 
      /varset l2 $char(cash) 
      /click left merchant buy 
      :BuyItemsLoop 
         /doevents 
         /delay 0 
         /if n $t10==0 /return TIMED_OUT 
      /if n $char(cash)==$l2 /goto :BuyItemsLoop 
   /next l1 
   /sendkey up shift 
/return SUCCESS 

| ResetKeys 
| Usage: /call ResetKeys 
| Explaination: Checks that all the modifier keys (Shift, Ctrl, and Alt) are in 
| not engaged (i.e not pressed down) 
| Author: Fippy. 
sub ResetKeys 
  | Initialisation 
  /press ctrl 
  /press shift 
  /press alt 
/return 

| LogError 
| Usage: /call LogError &message& &errornumber& 
| Explaination: logs an error to the log file. The supplied message and a descriptive 
| explaination of the error raised is written to the log. 
| Author: Fippy. 
sub LogError 
   /if $p1==TARGET_NOT_FOUND { 
      /mqlog $p0: Target not found 
      /endmacro 
   } else /if $p1==TARGET_TOO_FAR { 
      /mqlog $p0: Target too far away 
      /endmacro 
   } else /if $p1==TIMED_OUT { 
      /mqlog $p0: Timed out 
      /endmacro 
   } else /if $p1==ITEM_NOT_FOUND { 
      /mqlog $p0: Item not found 
      /endmacro 
   } else { 
      /mqlog $p0 : Unspecified Error 
      /endmacro 
   } 
    
/return 

| EmptyHands 
| Usage: /call EmptyHands 
| Explaination: Checks that there is nothing on the cursor and 
| if there is drop it into the players inventory. 
| Returns: TOO_FULL if the player has no room in their inventory to drop item on the cursor. 
| Author: Fippy. 
sub EmptyHands 
   :CheckEmpty 
   /doevents 
   /if "$cursor()"=="TRUE" /goto :DropItem 
   /goto :CursorEmpty 
   :DropItem 
   /if n $freeinv(space)&1 /return TOO_FULL 
   /if "$invpanel"=="TRUE" { 
      /click left auto 
   } else { 
       | Open Inventory 
      /press i 
      /click left auto 
      /press i 
   } 
   /delay 2 
   /goto :CheckEmpty 
    
:CursorEmpty    
/return 

| OpenCombiner 
| Usage: /call OpenCombiner &name& 
| Explaination: Checks if combiner is in your inventory and opens it. If not found 
| then checks for an Enviromental combiner and opens it. 
| Returns: The slot that the combiner is in if its in the players inventory (0 - 7) 
|          8 if the combiner is an environmental one. 
|          TARGET_NOT_FOUND if the combiner could not be opened. 
| Author: Fippy. 
Sub OpenCombiner 
   /call EmptyHands 
   /if $return&0 { 
      /call LogError OpenCombiner: $return 
      /varset l1 TOO_FULL 
      /goto :EndOpen 
   } 
   /for l2 7 downto 1 
      /doevents 
      /if "$pack($l2,combine)"=="$p0" { 
         /cleanup 
         /click right inv l2 
         :WaitOpen 
            /doevents 
            /if $pack($l1,open)==FALSE /goto :WaitOpen 
         /mqlog $p0 found in slot $l2 
         /varset l1 $l2 
         /goto :EndOpen 
     } 
   /next l2 

   | Its not an inventory based combiner so check for an enviromental one. 
   /itemtarget $p0 
   /if "$getlasterror"=="ITEM_NOTFOUND" /return TARGET_NOT_FOUND 
   /if n $distance(item)&19/return TARGET_TOO_FAR 
   /cleanup 
   /face item 
   /delay 1 
   /click left item 
   /delay 5 
   /varset l1 8 
    
:EndOpen 
/return $l1 

| Combine 
| Usage: /call Combine &combiner& &ingredient 1& &ingredient 2& ... &ingredient x&    
| Explaination: Combines the supplied ingedients in the specified combiner. Supports up to 9 components. 
| Drops all products into the players inventory.  
| Returns: TOO_FULL if the player runs out of room in their inventory. 
| Author: Fippy. Inspired by combine.mac by Gengis http://macroquest2.com/phpBB2/viewtopic.php?t=798 
sub Combine 
   | Open specified combiner 
   /call OpenCombiner "$p0" 
   /if n $return&0 { 
      /call LogError Combine: $return 
      /return 
   } 
    
   /if n $return==8 { 
      /varset l1 enviro 
      /varset l3 e 
   } else { 
      /varset l1 "pack $return" 
      /varset l3 $return 
   } 

   | Empty the pack if it has items in it. 
   /if $pack($l3,empty)==FALSE /call CleanPack $l3 
    
   /sendkey down ctrl 
   :MakeItem 
    
         /doevents 
    
         /finditem "$p1" 
         /if $find()==FALSE /goto :Done 
         /click left $l1 0 
    
         /if "$p2"=="" /goto :Combine 
         /finditem "$p2" 
         /if $find()==FALSE /goto :Done 
         /click left $l1 1 
    
         /if "$p3"=="" /goto :Combine 
         /finditem "$p3" 
         /if $find()==FALSE /goto :Done 
         /click left $l1 2 
    
         /if "$p4"=="" /goto :Combine 
         /finditem "$p4" 
         /if $find()==FALSE /goto :Done 
         /click left $l1 3 
    
         /if "$p5"=="" /goto :Combine 
         /finditem "$p5" 
         /if $find()==FALSE /goto :Done 
         /click left $l1 4 
    
         /if "$p6"=="" /goto :Combine 
         /finditem "$p6" 
         /if $find()==FALSE /goto :Done 
         /click left $l1 5 
    
         /if "$p7"=="" /goto :Combine 
         /finditem "$p7" 
         /if $find()==FALSE /goto :Done 
         /click left $l1 6 
    
         /if "$p8"=="" /goto :Combine 
         /finditem "$p8" 
         /if $find()==FALSE /goto :Done 
         /click left $l1 7 
    
         /if "$p9"=="" /goto :Combine 
         /finditem "$p9" 
         /if $find()==FALSE /goto :Done 
         /click left $l1 8 
    
         :Combine 
           /click left $l1 combine 
    
         :WaitCombine 
           /doevents 
         /if $pack($l3,empty)==FALSE /goto :WaitCombine 
    
         :AutoDrop 
           /doevents 
           /click left auto 
           /delay 1 
           /if "$cursor()"=="TRUE" /goto :AutoDrop 
    
      /delay 1s 
      /goto :MakeItem 
    
      :Done 
       /sendkey up ctrl 
       /cleanup 

/return 


| Door 
| Usage: /call Door [book] 
| Explaination: Opens the nearest door to the player. If book is supplied then no 
| Open/Closed status is checked since PoK books dont use this flag 
| Returns: TARGET_TOO_FAR if the door is too far away to open. 
sub Door 
   /doortarget 
   /face door 
   /if n $door(distance)&29 /return TARGET_TOO_FAR 
   /if "$door(open)"=="TRUE" /return 
   /if "$p0"=="book" { 
      /press u 
      /return 
   } 
   :OpenDoor 
      /doevents 
      /press u 
   /if "$door(open)"=="FALSE" /goto :OpenDoor 
/return 

| BankConvert 
| Usage: /call BankConvert 
| Explaination: Converts all cash in the bank to highest possible denominations. 
| Author: L12ard (borrowed from his excellent MacroKit http://macroquest2.com/phpBB2/viewtopic.php?t=1257) 
|         fixed it to actually work in the bank rather than on the char. 
Sub BankConvert 
/sendkey down shift 

:ConvertCP 
  /if n $char(copper,bank)==0 /goto :ConvertSP 
  /click left bank copper 
  /click left bank silver 
  /click left bank copper 

:ConvertSP 
  /if n $char(silver,bank)==0 /goto :ConvertGP 
  /click left bank silver 
  /click left bank gold 
  /click left bank silver 

:ConvertGP 
  /if n $char(gold,bank)==0 /goto :ConvDone 
  /click left bank gold 
  /click left bank plat 
  /click left bank gold 
:ConvDone 
  /sendkey Up shift 
/return 

| BankDeposit 
| Usage: /call BankDeposit 
| Explaination: Puts all cash on your char into the bank 
| Author: L12ard (borrowed from his excellent MacroKit http://macroquest2.com/phpBB2/viewtopic.php?t=1257) 
sub BankDeposit 
/sendkey down shift 
:Plat 
  /if n $char(plat)==0 /goto :Gold 
  /click left plat 
  /click left bank plat 

:Gold 
  /if n $char(gold)==0 /goto :Silver 
  /click left gold 
  /click left bank gold 

:Silver 
  /if n $char(silver)==0 /goto :Copper 
  /click left silver 
  /click left bank silver 

:Copper 
  /if n $char(copper)==0 /goto :DepDone 
  /click left copper 
  /click left bank copper 
:DepDone 
  /sendkey up shift 
/return 

| BankWithdraw 
| Usage: /call BankWithdraw &amount in pp& 
| Explaination: Withdaws specified amount of pp from the bank. 
| Author: Fippy 
sub BankWithdraw 
/click left bank plat 
/hslider $p0 
/click left hslider done 
/click left auto 
/return 

sub event_bank 
   /varset BankOpen 1 
/return 

| WaitForZone 
| Usage: /call WaitForZone &zone name& 
| Explaination: Waits until your char is in the supplied zone 
| Author: Fippy 
sub WaitForZone 
   /mqlog WaitForZone: Zone is $zone waiting for $p0 
   :WaitZone 
      /delay 10 
      /doevents 
   /if "$zone"!="$p0" /goto :WaitZone 
   /mqlog Made it to $p0 
/return 

sub event_bank 
   /varset BankOpen 1 
/return
Last edited by YKW-28983 on Mon Jan 20, 2003 7:24 pm, edited 1 time in total.

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

Post by YKW-28983 » Mon Jan 20, 2003 1:23 pm

Make a hotkey that will send a tell to the bot with Assist <anything>! $target(id)

Code: Select all

/tell a_little_warrior_01 Assist Please! $target(id)

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

Post by L124RD » Mon Jan 20, 2003 5:35 pm

Salutations,
I wrote fight.mac off some code that plazoo wrote (or I did, no clue anymore).

codewarrior
orc pawn
orc pawn
Posts: 10
Joined: Mon Jun 02, 2003 8:31 am

question

Post by codewarrior » Tue Jun 03, 2003 1:16 am

I know this may sound like a dumb question but what does the & do?

/if n $target(distance)&15 /return
/if n $char(ability,taunt)&0 /doability taunt
/if n $char(ability,disarm)&0 /doability disarm
Ive seen several different ways of doing this, and i was just curious what it does in this variation.

Im currently working on a code similar to this, and hope to post it soon, but i dont want to unless i fully understand what it does.

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

Post by Valerian » Tue Jun 03, 2003 9:10 am

looks to me like it does a bitwise AND, which doesn't seem to make much sense to me...

Code: Select all

	} else if (strstr(szCond,"&")) {
		Comp = COMP_BITAND;
		strncpy(szVal1,szCond,strstr(szCond,"&")-szCond);
		strcpy(szVal2,strstr(szCond,"&")+1);
		CompareType = COMP_TYPE_BIT;
.
.
.
		case COMP_BITAND:
			return (dwVal1 & dwVal2);
		case COMP_BITOR:
			return (dwVal1 | dwVal2);

Code: Select all

/if n $target(distance)&15 /return 
/if n $char(ability,taunt)&0 /doability taunt 
/if n $char(ability,disarm)&0 /doability disarm 
seems to me, the first would fire off whenever your distance from the target was 0x0Fh, 0x1Fh, or any time when your distance ended in 0xFh... the other two would never fire off since anything AND 0 == 0.

For those non-bitwise-comparison knowing folks, AND is basically binary multiplication without carrying any 1's, and OR is basically binary addition without carrying 1's...

1 & 1 = 1
1 & 0 = 0
0 & 0 = 0

1 | 1 = 1
1 | 0 = 1
0 | 0 = 0

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

Post by L124RD » Tue Jun 03, 2003 11:18 am

Salutaitons,
The &'s are supposed to be >'s and <'s... It's simply the forum messing up, but I think that code is actually lost forever now so you're going to have to figure out what goes where... if you do I'll edit the post for y'all

codewarrior
orc pawn
orc pawn
Posts: 10
Joined: Mon Jun 02, 2003 8:31 am

Post by codewarrior » Tue Jun 03, 2003 1:31 pm

Thanks for responding =), didnt think that they made sense... anyhow i did post that code i said i would post. I love my new pet warrior.