decreasing radius

A forum for macro code snippets to be used in writing other macros. Post routines or .inc files here only, completed macros go to the Macro Depot.

Moderator: MacroQuest Developers

Vaft
a lesser mummy
a lesser mummy
Posts: 69
Joined: Fri Mar 07, 2003 6:39 am

decreasing radius

Post by Vaft » Thu Feb 12, 2004 11:23 pm

A few people wanted this on IRC, it shows how to run in a circle while slowly decreasing your radius, until you reach a certain point.

I usually use a radius between 22 and 26, which is done by calling the macro with the radius as a parameter, i.e. /mac circle 22.

Code: Select all

#turbo

Sub Main
   /zapvars
   /declare CirX global
   /declare CirY global
   /declare Radius global
   
   /declare diff local
   /declare loop local
   
   /varset Radius @Param0
   /varset diff $calc(100+@Radius)
   
   /if n $target(id)!=0  {
      /varset CirX $target(y)
      /varset CirY $target(x)
   }

   /for loop @Radius to 100
     /delay 1
     /varset Radius $calc(@diff-@loop)
     /call Circle
   /next loop
   
/echo @Radius

:Loop
  /call Circle
/goto :Loop

/return

Sub Circle
   /if n $distance(@CirX,@CirY)<$calc(@Radius/2) {
      /face heading $calc($heading(@CirX,@CirY)+180)
   } else {
      /face heading $calc($heading(@CirX,@CirY)+$calc(90*$calc(@Radius/$distance(@CirX,@CirY))))
   }
/return
credit for the circle sub goes to whoever wrote it, I believe I took it from advkite.mac.

DyvimTvar
orc pawn
orc pawn
Posts: 16
Joined: Wed Oct 22, 2003 1:21 pm

Re: decreasing radius

Post by DyvimTvar » Fri Feb 20, 2004 11:32 am

Vaft wrote:

Code: Select all

      /varset CirX $target(y)
      /varset CirY $target(x)
[/quote]

Did you set CirX to Y and CirY to x values just to confuse people like me? ;)
DyvimTvar

theafkxper
a hill giant
a hill giant
Posts: 207
Joined: Sun Sep 08, 2002 6:41 pm

Post by theafkxper » Wed Feb 25, 2004 11:55 pm

readout for locs in eq isnt cartesian (or however its spelled), im guessing he was making it into normal x,y rather than eq's y,x system