Drag.mac - Smart corpse dragging (4/26/2004)

A forum for you to dump all the macros you create, allowing users to use, modify, and comment on your work.

Moderator: MacroQuest Developers

Cunning
a lesser mummy
a lesser mummy
Posts: 61
Joined: Tue Mar 23, 2004 4:42 pm

Drag.mac - Smart corpse dragging (4/26/2004)

Post by Cunning » Mon Apr 26, 2004 8:58 pm

SmartDrag 1.0

The idea is that it grabs a list of all corpses in a specified radius (user or default radius 20), helps you pile them together and drags them if you have consent. If you don't have consent from a particular corpse it'll drop it off your drag list. This is the first version of this so I expect there to be some issues. Comments/Suggestions/Bug Reports welcome.

Code: Select all

|SmartDrag 1.0
|-----------------------------------------------
|By Cunning
|
|Usage:  /macro drag.mac <searchradius (default 20)>
|         
|Version History
|	1.0 -  Release

Sub Main

	/zapvars
	
	/declare Rad local
	/declare CorpseList array2
	/declare NumCorpse local
	/declare NumConsented local
	/declare Count local
	/declare TargetName local
	/declare Msg local
	
	/varset NumCorpse 1
	/varset NumConsented 0
	/varset Count 1

	/echo "SmartDrag 1.0 Starting."

    /if (${Defined[Param0]}) { 
       /varset Rad @Param0             
    } else { 
       /varset Rad 20 
    } 

	/echo "Building drag list..."
	
	/varset TargetName ${Me.NearestSpawn[@NumCorpse, pc corpse radius @Rad]}
	/target @TargetName
	/delay 1
	/if (${Target.ID} && ${String[@TargetName].NotEqual[NULL]}) {
		/varset CorpseList(@NumCorpse,1) @TargetName | Corpse Name
		/varset CorpseList(@NumCorpse,2) ${Target.X} | Current Xloc
		/varset CorpseList(@NumCorpse,3) ${Target.Y} | Current Yloc
		/varset CorpseList(@NumCorpse,4) ${Target.Z} | Current Zloc
		/varset CorpseList(@NumCorpse,5) 0			 | Ok to Drag
		/varadd NumCorpse 1
	} else {
		/echo "There are no corpses in that radius.  Exiting..."
		/zapvars
		/endmacro
	}
		
:GetCorpseList
	/delay 1
	/varset TargetName ${Me.NearestSpawn[@NumCorpse, pc corpse radius @Rad]}
	/target @TargetName
	/delay 4
	/if (${Target.ID} && ${String[@TargetName].NotEqual[NULL]}) {
		/varset CorpseList(@NumCorpse,1) @TargetName | Corpse Name
		/varset CorpseList(@NumCorpse,2) ${Target.X} | Current Xloc
		/varset CorpseList(@NumCorpse,3) ${Target.Y} | Current Yloc
		/varset CorpseList(@NumCorpse,4) ${Target.Z} | Current Zloc
		/varset CorpseList(@NumCorpse,5) 0	     	 | Ok to Drag
		/varadd NumCorpse 1
		/goto :GetCorpseList
	}
	
	/echo "Drag list completed.  Body count = @NumCorpse." 

:CheckDrag
	/delay 1
	
	/varset Msg 0
	
	/if (@Count>=@NumCorpse) /goto :DragCorpses
	
	/keypress esc
	/target @CorpseList(@Count,1)
	/delay 4
	/face nolook fast
:CheckDistance
	/delay 1
	/if (${Target.ID}>0 && @CorpseList(@Count,2)==${Target.X} && @CorpseList(@Count,3)==${Target.Y} && @CorpseList(@Count,4)==${Target.Z}) {
		/corpse
		/delay 10
		/if (@CorpseList(@Count,2)!=${Target.X} || @CorpseList(@Count,3)!=${Target.Y} || @CorpseList(@Count,4)!=${Target.Z}) {
			/varset CorpseList(@Count,5) 1
			/varadd NumConsented 1
			/echo "@CorpseList(@Count,1)'s corpse moved on /corpse."
			}
		}
	}
	/varadd Count 1
	/goto :CheckDrag			
			
:DragCorpses
	/delay 1
	
	/varset Count 1

	/echo "@NumConsented out of @NumCorpse gave consent."
	
	/if (@NumConsented>0) {
:DragCorpseLoop	
		/if (@Count>@NumConsented) /varset Count 1
		/delay 1
		/if (@CorpseList(@Count,5)==1) {
			/target @CorpseList(@Count, 1)
			/delay 3
			/if (${Target.Distance}<${Target.MaxRange}) /corpse
		}
		/varadd Count 1
		/goto :DragCorpseLoop
	}
/endmacro

fryfrog
a hill giant
a hill giant
Posts: 271
Joined: Fri Jun 20, 2003 5:37 am

Post by fryfrog » Tue Apr 27, 2004 10:34 pm

Code: Select all

/varset TargetName ${Me.NearestSpawn[@NumCorpse, pc corpse radius @Rad]}
Something about the above line does not work right, it gets a "(0-100) any null" error. I am gonna look at how exactly "Me.NearestSpawn" works some :)

User avatar
ieatacid
Developer
Developer
Posts: 2727
Joined: Wed Sep 03, 2003 7:44 pm

Post by ieatacid » Tue Apr 27, 2004 10:54 pm

I get the same "NULL" thing.

fryfrog
a hill giant
a hill giant
Posts: 271
Joined: Fri Jun 20, 2003 5:37 am

Post by fryfrog » Tue Apr 27, 2004 11:07 pm

I just updated to latest source and it works now :)

ogrestud
decaying skeleton
decaying skeleton
Posts: 3
Joined: Fri Mar 05, 2004 4:52 pm

Post by ogrestud » Thu Apr 29, 2004 2:41 pm

What would have to be done to have this have a set radius, say the max distance you can drag a corpse, but instead of it grabing every corpse, have it so you can set a number of corpses in a variable such as usage /mac drag 3 and it adds just 3 corpses to the array. Dragging 2 or 3 corpses is a great help on raids, and also isnt that suspicious.

Thanks