Request: Bard AE - Squared~!~

Got a cool macro idea? Wanna request a macro? Here is the place for you!

Moderator: MacroQuest Developers

KhaosWolf
a lesser mummy
a lesser mummy
Posts: 41
Joined: Wed Sep 10, 2003 11:34 pm

Request: Bard AE - Squared~!~

Post by KhaosWolf » Fri Dec 12, 2003 1:54 am

Instead of having the bard run in circles, is it possible to have the char run in a square around the middle point. I have no idea of how to do this and I tried with complete failure =/ this is also not my scipt btw its brick 37's, great script~

Code: Select all

| 
| - swarm.mac - 
| Hacked together by Brick 37 twisting 3 AE dots, 49 Selo's, 
| 
| swarm <dot1> <dot2> <dot3> <selo> <loc x> <loc y> <radius> 
| run around in a cirle while twisting selos and three DOT AEs.  If x, 
| y, and radius are not supplied, use the current position and a radius 
| of 32. But i strongly recommend you to type in xloc yloc and radius. 
| 

#event MissedNote "You miss a note, bringing your song to a close!" 
#event NeedTarget "You must first select a target for this spell!" 
#event Slow       "you slow down" 
#event Exp        "You gain " 
#event Tell       "tells you" 
#event Recovered "You haven't recovered yet..." 
#event Notsee   "You cannot see" 
#event Died "You have entered" 

| this needs to be on now -- parameter parsing takes too long
#turbo 150

Sub Main(p0,p1,p2,p3,p4,p5,p6) 

/declare cirx global 
/declare ciry global 
/declare cirr global 
| array of songs 
/declare a array 
| number of songs 
/declare nsongs global 
| current song 1-3 
/declare cursong global 
/declare prevsong global 
/declare exper global 
/declare aaexp global 
/declare health global 
/declare songtimer timer 
| /declare selotimer timer 
| /declare angstimer timer 
| /declare puretonetimer timer 
| /declare bellowtimer timer 
/declare rangecalc global 
/declare lastmobid global 
/varset rangecalc 0 

  /if $defined(p0)==false { 
    /echo usage: swarm.mac <DOT> <DOT> <DOT> <selo> <loc x> <loc y> <radius> 
    /return 
  } 

  | check if the location was passed in... 
  /if $defined(p4)==false { 
        /varset cirx $char(y) 
        /varset ciry $char(x) 
        /varset cirr 32 
  } else { 
        /varset cirx @p4 
        /varset ciry @p5 
        /varset cirr @p6 
  } 

  /varset nsongs 3 

| First song 
  /varset a(1) @p0 
  /echo Song 1: $char(gem,@p0) 

  /if $defined(p1)!=false { 
            /varset a(2) @p1 
            /echo Song 2: $char(gem,@p1) 
      } 

  /if $defined(p2)!=false { 
            /varset a(3) @p2 
            /echo Song 3: $char(gem,@p2) 
      } 

|Selos 
  /if $defined(p5)!=false { 
            /varset a(4) @p3 
            /echo Song 4: $char(gem,@p3) 
      } 

| always incremented before starting a new 
| song.  songs start at 1 so we can make 
| cursong = 0 to restart the list 
  /varset cursong 1 
  /varset exper $char(exp)% 
  /varset aaexp $char(aa,exp)% 
  /varset songtimer 64 
|  /varset bellowtimer 187 
|  /varset selotimer 0 
|  /varset angstimer 241 
|  /varset puretonetimer 65 

:Loop 
|   /if $defined(p3)==false { 
|      /varset selotimer 2500 
  } 
  /if $defined(p5)!=false { 
    /if $char(speed)<=1 /varset cursong @a(4) 
    /call circ @cirx @ciry @cirr 
  } 
|    /if n @selotimer<=0 { 
|      /varset cursong @a(4) 
|      /varset selotimer 1500 
|      /call Sing 
  } 
|    /if n @puretonetimer<=0  { 
|      /varset angstimer 0 
|      /disc puretone 
|      /varset puretonetimer 43200 
  } 
    /if n @songtimer<=0  /call Sing 
    /call circ @cirx @ciry @cirr 
    /doevents 
/goto :Loop 
/return 

Sub Sing 
   /stopsong 
   /cast @cursong 
   /if n $target(id)!=@lastmobid /if n @rangecalc!=0 /varset rangecalc 0 
|   /echo casting @cursong 
   /varset prevsong @cursong 
   /varadd cursong 1 
   /varset songtimer 35 
   /call circ @cirx @ciry @cirr 
   /doevents 
   /if n @cursong>@nsongs /varset cursong @a(1) 
/return 

Sub circ 
   /if $char(speed)<=.2 /press Num_Lock 
   /if n $distance(@cirx,@ciry)<(@cirr/2){ 
   /face heading $calc($heading(@cirx,@ciry)+180) 
   } else { 
   /face heading $calc($heading(@cirx,@ciry)+$calc(90*$calc(@cirr/$distance(@cirx,@ciry)))) 
   } 
/return 

Sub Event_MissedNote 
  | restart song 
   /varset cursong @prevsong 
   /varset songtimer 0 
   /call circ $xloc $yloc $radius 
   /doevents 
/return 

Sub Event_Recovered 
  | restart song 
   /if @cursong!=a(5) { 
   /varset cursong @prevsong 
} 
   /varset songtimer 0 
   /call circ $xloc $yloc $radius 
   /doevents 
/return 

Sub Event_Notsee 
   /stopsong 
   /varset cursong @prevsong 
   /varset songtimer 0 
   /call circ $xloc $yloc $radius 
   /doevents 
/return 

Sub Event_NeedTarget 
  | get target 
   /tar npc 
   /varset lastmobid $target(id) 
   /call circ @cirx @ciry @cirr 
   /doevents 
/return 

Sub Event_Tell 
   /beep 
   /call circ $xloc $yloc $radius 
   /doevents 
/return 

Sub Event_Died 
  /delay 10 
  /sit 
  /delay 10 
  /camp desktop 
/return 

Sub Event_Exp 
  /varset aaexp $calc($char(aa,exp)-@aaexp) 
  /varset exper $calc($char(exp)-@exper) 
  /echo Running time $calc($running/60) minutes 
  /echo @exper% regular exp @aaexp% AA exp 
  /varset exper $char(exp) 
  /varset aaexp $char(aa,exp) 
  /stopsong 
  /tar npc 
  /varset cursong @a(1) 
  /varset songtimer 0 
  /call circ @cirx @ciry @cirr 
  /doevents 
/return 

Sub Event_OOR 
  /varcalc rangecalc @rangecalc+1 
  /if n @rangecalc>=10 { 
      /press esc 
      /varset rangecalc 0 
      /tar npc 
      /call circ @cirx @ciry @cirr 
      /doevents 
  } 
/return 

ml2517
a grimling bloodguard
a grimling bloodguard
Posts: 1216
Joined: Wed Nov 12, 2003 1:12 am

Post by ml2517 » Sat Dec 13, 2003 7:39 pm

I took a few minutes and made some code to plot points based on your starting location, the number of sides of the object you'd like to run and the size of the object. You should be able to use this code to do what you want.

Code: Select all


#turbo

Sub Main
/declare Size global
/declare ObjectNumSides global
/declare PointNumber global
/declare StartedAtLocX global
/declare StartedAtLocY global
/declare XCoordinate array
/declare YCoordinate array

/varset Size 1000
/varset ObjectNumSides 4
/varset StartedAtLocX $char(x)
/varset StartedAtLocY $char(y)

/for PointNumber 1 to @ObjectNumSides
    /varcalc XCoordinate(@PointNumber) $calc($calc(@Size*$cos($calc($calc(360/@ObjectNumSides)*$calc(@PointNumber-1))))+@StartedAtLocX)
    /varcalc YCoordinate(@PointNumber) $calc($calc(@Size*$sin($calc($calc(360/@ObjectNumSides)*$calc(@PointNumber-1))))+@StartedAtLocY)
/next PointNumber

/for PointNumber 1 to @ObjectNumSides
    /echo Point Number[@PointNumber] @YCoordinate(@PointNumber),@XCoordinate(@PointNumber)
/next PointNumber
/return

Last edited by ml2517 on Sat Jan 03, 2004 9:52 pm, edited 1 time in total.

KhaosWolf
a lesser mummy
a lesser mummy
Posts: 41
Joined: Wed Sep 10, 2003 11:34 pm

Thanks

Post by KhaosWolf » Sun Dec 14, 2003 1:55 am

thanks for the help ml2517, trying it as we speak

Keta
orc pawn
orc pawn
Posts: 13
Joined: Fri Oct 10, 2003 6:02 pm

Post by Keta » Sun Dec 14, 2003 4:25 am

Pity bard ae is reportedly being nerfed soon =/