drag.mac for dragging unlimited corpses ;)

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

Moderator: MacroQuest Developers

Plazmic
The One
The One
Posts: 800
Joined: Fri Jun 14, 2002 12:31 am
Contact:

drag.mac for dragging unlimited corpses ;)

Post by Plazmic » Fri Oct 03, 2003 10:57 pm

Unlimited depending on how fast you move... might drop some if you move too fast while dragging a lot...

Code: Select all

|drag.mac 
|Usage /macro drag.mac name name name... ect ect 
|Version 2.5, based on GrimJack's version

#turbo
Sub Main
   /declare loop global 
   /declare CorpseCount global 
   /if $defined(Param0)==FALSE { 
      /echo Usage /macro drag.mac corpse1 corpse2 corpse3 ect. 
      /end 
   } 
   /varset CorpseCount 0
   :CountLoop
      /varadd CorpseCount 1
   /if $defined(Param@CorpseCount)==TRUE /goto :CountLoop
   /varsub CorpseCount 1

   /varset LoopNum 0 
   :DragLoop 
      /for loop 0 to @CorpseCount
         /target corpse @Param@loop
         /delay 3 
         /corpse 
         /delay 3 
      /next loop
   /goto :DragLoop
/return
- Plazmic

eq_freak
a ghoul
a ghoul
Posts: 105
Joined: Mon Jun 24, 2002 7:17 am

Post by eq_freak » Tue Oct 07, 2003 6:54 am

Ahh, so Plazmic plays a rogue? :D

User avatar
Curious
a ghoul
a ghoul
Posts: 88
Joined: Wed Aug 27, 2003 5:19 am

Post by Curious » Tue Oct 07, 2003 8:33 am

eq_freak wrote:Ahh, so Plazmic plays a rogue? :D
Think you lost me eq_freak, how do you come to this conclusion?

Zxeses
a ghoul
a ghoul
Posts: 103
Joined: Tue Jan 07, 2003 4:17 pm

Post by Zxeses » Tue Oct 07, 2003 11:23 am

Based upon what you said in other posts, when using a variable, you use the @, but not when setting or declaring. but in your script you have two lines where this rule doesnt seem to be applied:

Code: Select all

 
/if $defined(Param0)==FALSE { 
Shouldnt this be

Code: Select all

/if $defined(@Param0)==FALSE { 

and

Code: Select all

   /if $defined(Param@CorpseCount)==TRUE /goto :CountLoop 

Code: Select all

   /if $defined(@Param@CorpseCount)==TRUE /goto :CountLoop 
based upon the code rules you've previously mentioned.

MacroFiend
a grimling bloodguard
a grimling bloodguard
Posts: 662
Joined: Mon Jul 28, 2003 2:47 am

Post by MacroFiend » Tue Oct 07, 2003 1:58 pm

Just like any language grammar, there are exceptions. :)

You don't use the @ when you are referencing the variable as a whole. (i.e. with /varadd, /varsub, /declare or $defined) because you are working against the variable and not the contents of the variable.

When you put the @, the variable parser will convert that to the value of the variable before the $ parser or actual commands are run.

Zxeses
a ghoul
a ghoul
Posts: 103
Joined: Tue Jan 07, 2003 4:17 pm

Post by Zxeses » Tue Oct 07, 2003 3:46 pm

Spoken like a true C programer... :D

I hope this little tidbit makes it into the documentation at least. :!:

Plazmic
The One
The One
Posts: 800
Joined: Fri Jun 14, 2002 12:31 am
Contact:

Post by Plazmic » Tue Oct 07, 2003 10:47 pm

Actually, it's right to left, @ and $ at the same time, so this would work:
@MyArray($int(@MyIndex*2))
- Plazmic

Plazmic
The One
The One
Posts: 800
Joined: Fri Jun 14, 2002 12:31 am
Contact:

Post by Plazmic » Tue Oct 07, 2003 10:49 pm

Curious wrote:
eq_freak wrote:Ahh, so Plazmic plays a rogue? :D
Think you lost me eq_freak, how do you come to this conclusion?
A rogue is the only class that would really be safe dragging 25 corpses.
A monk could handle this almost as well, but feign does fail...

I did macro a rogue from 1-52 before the NewUI, but have been playing a different class since I started working on this again...

But I wrote this macro strictly becuase it was an example of how to use the new variables, and because it didn't have the 7 corpse limit ;)
- Plazmic

Anonymous Coward

Doesn't work

Post by Anonymous Coward » Sat Oct 11, 2003 4:23 pm

Hey Plaz,

This macro doesn't work. At least for me with the latest ZIP build.

Basically, the variable that you are incrementing: CorpseCount is a number with 2 decimal places.

So if you do: /echo @CorpseCount you get: 1.00

And if you do /if $defined(Param@CorpseCount) you get FALSE

(this is because the parameter Param1.00 is not defined).



How do you force it to give you a number without ANY decimal places?


Anonymous Coward

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

Re: Doesn't work

Post by grimjack » Sat Oct 11, 2003 5:44 pm

Anonymous Coward wrote:Hey Plaz,

This macro doesn't work. At least for me with the latest ZIP build.

Basically, the variable that you are incrementing: CorpseCount is a number with 2 decimal places.

So if you do: /echo @CorpseCount you get: 1.00

And if you do /if $defined(Param@CorpseCount) you get FALSE

(this is because the parameter Param1.00 is not defined).



How do you force it to give you a number without ANY decimal places?


Anonymous Coward
$int(@CorpseCount)

Should do the job.
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

AlphaBeta
a ghoul
a ghoul
Posts: 126
Joined: Sat Nov 09, 2002 12:35 am

Post by AlphaBeta » Mon Oct 13, 2003 3:32 am

Would there be a way to make this a little simpler so that you could run this macro and then just point at the bodys you wanted to drag insted of filling out the macro with names?

Guest

Post by Guest » Mon Oct 13, 2003 4:35 am

Code: Select all

|drag.mac
|Usage /macro drag.mac name name name... ect ect
|Version 2.5, based on GrimJack's version
|Version 2.5a, gf getting happy.

#turbo
Sub Main
   /declare loop global
   /declare CorpseCount global
   /declare CorpseID global
 
   /if $defined(Param0)==FALSE /if $target(type)!=CORPSE {
      /echo Usage:  /macro drag.mac corpse1 corpse2 corpse3 ect.
      /echo         /macro drag.mac <target>
      /end
   }

   /if "$target(type)"=="CORPSE"  /varset CorpseID $target(id)

   /varset CorpseCount 0
   :CountLoop
      /varadd CorpseCount 1
   /if $defined(Param@CorpseCount)==TRUE /goto :CountLoop
   /varsub CorpseCount 1
 
   /if n @CorpseCount<0 {
      :DragSingle
      /if n $target(distance)>25 {
         /if n $target(id)!=@CorpseID /target id @CorpseID
         /corpse
      }
      /goto :DragSingle
   }
      
   /varset LoopNum 0
   :DragLoop
      /for loop 0 to @CorpseCount
         /target corpse @Param@loop
         /delay 3
         /corpse
         /delay 3
      /next loop
   /goto :DragLoop


/return

Guest

Post by Guest » Mon Oct 13, 2003 4:45 am

I'm such a yutz. typo's and ugliness above, and of course I didn't log in, so I can't edit it......

Code: Select all

|drag.mac
|Usage /macro drag.mac name name name... ect ect
|Version 2.5, based on GrimJack's version
|Version 2.5a, gf getting happy.

#turbo
Sub Main
   /declare loop global
   /declare CorpseCount global
   /declare CorpseID global

   /if $defined(Param0)==FALSE [color=cyan]/if "$target(type)"!="CORPSE"[/color] {
      /echo Usage:  /macro drag.mac corpse1 corpse2 corpse3 ect.
      [color=cyan]/echo         /macro drag.mac <target>[/color]
      /end
   }

   [color=cyan]/if "$target(type)"=="CORPSE"  /varset CorpseID $target(id)[/color]

   /varset CorpseCount 0
   :CountLoop
      /varadd CorpseCount 1
   /if $defined(Param@CorpseCount)==TRUE /goto :CountLoop
   /varsub CorpseCount 1

   [color=cyan]/if n @CorpseCount<0 {
      :DragSingle
      /if n $spawn(@CorpseID,distance)>25 {
         /if n $target(id)!=@CorpseID /target id @CorpseID
         /corpse
      }
      /goto :DragSingle
   }[/color]
     
   /varset LoopNum 0
   :DragLoop
      /for loop 0 to @CorpseCount
         /target corpse @Param@loop
         /delay 3
         /corpse
         /delay 3
      /next loop
   /goto :DragLoop

/return 

GoatFoot
a lesser mummy
a lesser mummy
Posts: 68
Joined: Fri Jan 17, 2003 1:48 am

Post by GoatFoot » Mon Oct 13, 2003 4:52 am

just shoot me

GoatFoot
a lesser mummy
a lesser mummy
Posts: 68
Joined: Fri Jan 17, 2003 1:48 am

I really should get some sleep.

Post by GoatFoot » Mon Oct 13, 2003 6:17 am

edit - REALLY needed sleep last night. :)

Code: Select all

|drag.mac
|Usage /macro drag.mac name name name... ect ect
|Version 2.5, based on GrimJack's version
|Version 2.5a, gf getting happy.
|Version 2.6, De-Happified it.

#turbo
Sub Main
   /declare CorpseID local
   /declare i local
   /declare CorpseCount local
   /declare Bodies array

   /if $defined(Param0)==FALSE /if "$target(type)"!="CORPSE" {
      /echo Usage:  /macro drag.mac corpse1 corpse2 corpse3 ect.
      /echo         /macro drag.mac <target>
      /end
   }

   /if $defined(Param0)!=TRUE {
      /if "$target(type)"=="CORPSE" /varset Bodies(0) $target(id)
      /goto :CorpseCheck
   }
   
   /varset i 0
   /varset CorpseCount 0
   :CountCorpses
      /target corpse @Param$int(@i)
      /varadd i 1
      /if n $target(id)>0 {
        /varset Bodies(@CorpseCount) $target(id)
        /varadd CorpseCount 1
      }
   /if $defined(Param$int(@i))==TRUE /goto :CountCorpses
   /varsub CorpseCount 1
   /echo @CorpseCount
   
   :CorpseCheck
   /if $defined(Bodies(0))==UNDEFINED-ARRAY-ELEMENT {
     /echo No corpses are targetable.
     /end
   }
   /varset i 0
   :DragThem
      /if n $spawn(@Bodies(@i),distance)>25 {
         /if n $target(id)!=@Bodies(@i) /target id @Bodies(@i)
         :WaitforTarget
            /delay 0
         /if $target(id)!=@Bodies(@i) /goto :WaitforTarget
         /corpse
      }
      /varadd i 1
      /delay 0
      /if n @i>@CorpseCount /varset i 0
   /goto :DragThem
/return