Help with another macro conversion please =/

Need some help with that macro you're working on or aren't quite sure how to get your macro to do something? Ask here!

Moderator: MacroQuest Developers

Protector316
decaying skeleton
decaying skeleton
Posts: 5
Joined: Sun Oct 19, 2003 1:08 am

Help with another macro conversion please =/

Post by Protector316 » Thu Oct 23, 2003 2:22 am

Code: Select all

|- ChantKite.mac - 
| /mac Chantkite <GEM> <GEM> <GEM> <SELOS GEM> <XLOC> <YLOC> <RADIUS> 
| Note, since the lvl 49 Selo's lasts 2.5 minutes, this macro WONT WORK 
| IF YOU HAVEN'T GOT THE 2.5 MINUTE SELOS DON'T TRY, DON'T BITCH IT WON'T

#event MissedNote "You miss a note, bringing your song to a close!" 
#event Recovered "You haven't recovered yet..."
#event Exp "You gain "
#event Slow "You slow down"
#event Outran "out of range"
#event NeedTarget "You must first select a target for this spell!"

Sub Main(Psong1 Psong2 Psong3 Psong4 Pselo Pxloc Pyloc Pradius)

/declare songarray array

/declare timer0 timer
/declare timer1 timer

/declare CASTTIME global
/declare SELOS global
/declare xloc global
/declare yloc global
/declare radius global
/declare cursong global
/declare prevsong global
/declare nsongs global

	/varset timer1 0
	/varset CASTTIME 31
	/varset SELOS 5
	/varset cursong 0
	/varset nsongs 5
	/varset xloc  @Pxloc
	/varset yloc  @Pyloc
	/varset radius @Pradius

/varset songarray(1) @Psong1
/varset songarray(2) @Psong2
/varset songarray(3) @Psong3
/varset songarray(4) @Psong4
/varset songarray(5) @Pselo

|:DEBUG:| /echo Song 1: $char(gem,@Psong1)
|:DEBUG:| /echo Song 2: $char(gem,@Psong2)
|:DEBUG:| /echo Song 3: $char(gem,@Psong3)
|:DEBUG:| /echo Song 4: $char(gem,@Psong4)
|:DEBUG:| /echo Song 5: $char(gem,@Pselo)
|:DEBUG:| /echo x,y,radius: @xloc , @yloc , @radius

|:DEBUG:| /echo Array: @songarray(1) , @songarray(2) , @songarray(3) , @songarray(4) , @songarray(5)

:Loop 
/if n @timer1<=$calc(@timer0+@CASTTIME) { 
/varset cursong @SELOS 
} 
/if n @timer1<=@CASTTIME { 
/varset timer0 1 
} 
/if n @timer0<=0 /call Sing $int(@songarray(@cursong))
/call circ @xloc @yloc @radius 
/doevents 
/goto :Loop
/return

Sub Sing(Param) 
/varset timer0 @CASTTIME
/if n @Param==@SELOS /varset timer1 1475
/stopsong 
/cast @Param
/varset prevsong $cursong
/varadd cursong 1 
/if n @cursong>=@nsongs /varset @cursong 1 
/call circ @xloc @yloc @radius 
/doevents 
/return

Sub circ(Px Py Pr)
/if n $distance(@Px,@Py)<(@Pr/2){ 
/face heading $calc($heading(@Px,@Py)+180) 
} else { 
/face heading $calc($heading(@Px,@Py)+$calc(90*$calc(@Pr/$distance(@Px,@Py)))) 
} 
/return

Sub Event_MissedNote 
/varset cursong @prevsong
/varset timer0 0 
/doevents 
/return 

Sub Event_Recovered 
/varset timer0 0 
/varset cursong @prevsong 
/doevents 
/return

Sub Event_NeedTarget
/tar npc
/call circ @xloc @yloc @radius 
/doevents 
/return

Sub Event_Exp  
/tar npc 
/call circ @xloc @yloc @radius 
/doevents 
/return

Sub Event_Outran  
/tar npc 
/call circ @xloc @yloc @radius 
/doevents 
/return

Sub Event_Slow 
/varset cursong @SELOS
/varset timer0 0 
/return

Then i get these errors:

-------------------------------------------------------------------------------------
Ending macro: Bad variable in /var function.

bardkite.mac@73 (Sing(Param)): /if n @cursong>=@nsongs /varset @cursong 1
bardkite.mac@60 (Main(Psong1 Psong2 Psong3 Psong4 Pselo Pxloc Pyloc Pradius)): /if n @timer0<=0 /call Sing $int(@songarray(@cursong))
Cleared the following: Timers Vars Arrays
The current macro has ended.
-------------------------------------------------------------------------------------

If i comment out this line /if n @cursong>=@nsongs /varset @cursong 1 then it looks as though it works fine, BUT it casts songs way too fast, like one every .5 seconds, instead of waiting 3sec so they can cast. Any ideas would be cool! lol thanks guys.

User avatar
dont_know_at_all
Developer
Developer
Posts: 5450
Joined: Sun Dec 01, 2002 4:15 am
Location: Florida, USA
Contact:

Post by dont_know_at_all » Thu Oct 23, 2003 2:58 am

/if n @cursong>=@nsongs /varset @cursong 1

should be

/if n @cursong>=@nsongs /varset cursong 1

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

Post by Plazmic » Thu Oct 23, 2003 10:39 am

Sub Main(Psong1 Psong2 Psong3 Psong4 Pselo Pxloc Pyloc Pradius)
should be
Sub Main(Psong1,Psong2,Psong3,Psong4,Pselo,Pxloc,Pyloc,Pradius)

and

Code: Select all

Sub circ(Px Py Pr) 
/if n $distance(@Px,@Py)<(@Pr/2){ 
/face heading $calc($heading(@Px,@Py)+180) 
} else { 
/face heading $calc($heading(@Px,@Py)+$calc(90*$calc(@Pr/$distance(@Px,@Py)))) 
} 
/return 
should be

Code: Select all

Sub circ(Px[b],[/b]Py[b],[/b]Pr) 
/if n $distance(@Px,@Py)<[b]$calc[/b](@Pr/2){ 
/face heading $calc($heading(@Px,@Py)+180) 
} else { 
/face heading $calc($heading(@Px,@Py)+$calc(90*$calc(@Pr/$distance(@Px,@Py)))) 
} 
/return 
- Plazmic

Protector316
decaying skeleton
decaying skeleton
Posts: 5
Joined: Sun Oct 19, 2003 1:08 am

Post by Protector316 » Thu Oct 23, 2003 12:37 pm

/gasp! the gods have spoken!@

lol thanks guys, this is my first attempt at anything "macro".

i didn't say in the original post, but i'm not the AUTHOR of this macro, just tried converting it. thanks again guys.