Dirty bard kite needs cleaning!

For questions regarding conversion of scripts from the old, parm style to the new MQ2Data format. Conversion questions only!

Moderator: MacroQuest Developers

jcooler
a ghoul
a ghoul
Posts: 87
Joined: Wed Dec 31, 2003 7:38 pm

Dirty bard kite needs cleaning!

Post by jcooler » Sat May 01, 2004 4:16 am

ahhhh hehe what do you guys think .... it runs but could it run better?

Code: Select all

| 
| - swarm.mac - 
| Hacked together by Brick 37 twisting 3 AE dots, 49 Selo's, 
| qusihacked by jcooler to twist 4 songs 
| Kinda converted by Beastman
| 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 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 

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

/declare cirx float outer
/declare ciry float outer 
/declare cirr float outer 
| array of songs 
/declare a[4] int outer
| number of songs 
/declare nsongs int outer
| current song 1-3 
/declare cursong int outer
/declare prevsong int outer 
/declare exper float outer 
/declare aaexp float outer 
/declare health int outer
/declare songtimer timer outer
/declare rangecalc int outer 
/declare lastmobid string outer 
/varset rangecalc 0

  /if (!${Defined[p0]}) { 
    /echo usage: swarm.mac <DOT> <DOT> <DOT> <selo> <loc x> <loc y> <radius> 
    /return 
  } 

  | check if the location was passed in... 
  /if (!${Defined[p4]}) { 
        /varset cirx ${char[y]} 
        /varset ciry ${char[x]} 
        /varset cirr 32 
  } else { 
        /varset cirx ${p4} 
        /varset ciry ${p5} 
        /varset cirr ${p6} 
  } 

  /varset nsongs 4 

| First song 
  /varset a[1] ${p0} 
  /echo Song 1: ${Me.Gem[${p0}]} 

  /if (${Defined[p1]}) { 
            /varset a[2] ${p1} 
            /echo Song 2: ${Me.Gem[${p1}]}
      } 

  /if (${Defined[p2]}) { 
            /varset a[3] ${p2} 
            /echo Song 3: ${Me.Gem[${p2}]} 
      } 
  /if (${Defined[p3]}) { 
            /varset a[4] ${p2} 
            /echo Song 4: ${Me.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 songtimer 64 

:Loop 
  
    /if (${songtimer}<=0) /call Sing 
    /call circ ${cirx} ${ciry} ${cirr} 
    /doevents 
/goto :Loop 
/return 

Sub Sing 
   /stopsong 
   /cast ${cursong} 

   /if ( ${rangecalc}!=0) /varset rangecalc 0
|   /echo casting ${cursong} 
   /varset prevsong ${cursong} 
   /varcalc cursong ${cursong} + 1 
   /varset songtimer 32 
   /call circ ${cirx} ${ciry} ${cirr} 
   /doevents 
   /if (${cursong}>${nsongs}) /varset cursong ${a[1]} 
/return 

Sub circ 
   /if (${Me.Speed}<=.2) /keypress Num_Lock
   /if (${Math.Distance[${cirx},${ciry}]}<${Math.Calc[${cirr}/2]}) { 
   /face heading ${Math.Calc[${Heading[${cirx},${ciry}].DegreesCCW}+180]} 
   } else { 
   /face heading ${Math.Calc[${Heading[${cirx},${ciry}].DegreesCCW}+${Math.Calc[90*${Math.Calc[${cirr}/${Math.Distance[${cirx},${ciry}]}]}]}]} 
   } 
/return 


Sub Event_MissedNote 
  | restart song 
   /varset cursong ${prevsong} 
   /varset songtimer 0 
   /call circ ${cirx} ${ciry} ${cirr}
   /doevents 
/return 

Sub Event_Recovered 
  | restart song 
   /if (${cursong}!=${a[5]}) { 
   /varset cursong ${prevsong} 
} 
   /varset songtimer 0 
   /call circ ${cirx} ${ciry} ${cirr}
   /doevents 
/return 

Sub Event_Notsee 
   /stopsong 
   /varset cursong ${prevsong} 
   /varset songtimer 0 
   /call circ ${cirx} ${ciry} ${cirr}
   /doevents 
/return 

Sub Event_NeedTarget 
  | get target 
   /tar npc 
   /varset lastmobid ${Target[ID]} 
   /call circ ${cirx} ${ciry} ${cirr} 
   /doevents 
/return 



Sub Event_Died 
  /delay 10 
  /sit 
  /delay 10 
  /end
/return 

Sub Event_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 

nils
a grimling bloodguard
a grimling bloodguard
Posts: 565
Joined: Wed Jul 30, 2003 10:02 pm

Post by nils » Tue May 04, 2004 11:23 am

I've been looking at the chant.mac which appears to be the same as this one. what doesn't work right now?

Preocts
a snow griffon
a snow griffon
Posts: 312
Joined: Thu Jan 29, 2004 1:02 pm

Post by Preocts » Tue May 04, 2004 12:52 pm

As far as straight code goes it looks as clean as one would want it. Along the lines of redundant calls, loops, check, and ect. I doubt you could make it much cleaner. Only thing I could think of to do is remove all those extra /doevents from each sub. Sub Circ doesn't have a loop in it or any delays so all those subs are just jumping back into the mainloop where the /doevents is.

That's all you were asking right?

jcooler
a ghoul
a ghoul
Posts: 87
Joined: Wed Dec 31, 2003 7:38 pm

Post by jcooler » Wed May 05, 2004 3:21 pm

yes because just the smallest amout of lag and kill a man with 30 mobs on his ass =)

Preocts
a snow griffon
a snow griffon
Posts: 312
Joined: Thu Jan 29, 2004 1:02 pm

Post by Preocts » Wed May 05, 2004 3:43 pm

I've used this macro and macros like it. You don' t need to worry about the macro laggin'. You just worry about your video laggin'. Set your kite up, turn off all mapfilters except maybe PCs, and look at the ground.

jcooler
a ghoul
a ghoul
Posts: 87
Joined: Wed Dec 31, 2003 7:38 pm

Post by jcooler » Wed May 05, 2004 6:19 pm

now thats a good idea =p