Need help with a macro you are writing? Ask here!
Moderator: MacroQuest Developers
-
Luc`Dragon
- orc pawn

- Posts: 13
- Joined: Tue Feb 04, 2003 5:34 pm
Post
by Luc`Dragon » Mon May 31, 2004 6:12 pm
This macro is supposed to run in a square while chanting 2 dots and selos.
It doesn't work. Ne help would be appreciated.
Code: Select all
|****************************************************************|
|*******************Bard Chant Kite Macro************************|
|**************Runs in a square while doting mobs****************|
|****************************************************************|
|******************/macro kite dot1 dot2 selos*******************|
|****************************************************************|
|****************************************************************|
|**************************By: Luc`Dragon************************|
|****************************************************************|
|*##############################################################*|
|****************************************************************|
|***************************Events Set-Up************************|
|****************************************************************|
#event Dies "#*#LOADING, PLEASE WAIT...#*#"
#event MissedNote "#*#You miss a note, bringing your song to a close!#*#"
#event Recovered "#*#You haven't recovered yet...#*#"
#event Slowed "#*#You slow#*#"
Sub MAIN(int Dot1, int Dot2, int Selos)
|****************************************************************|
|************************Global Variables************************|
|****************************************************************|
/declare cursong int outer 0
/declare CurLocLock int outer 0
/declare SpellTicks int outer 0
/declare SDCnt int outer 0
/declare SpellDelay int outer 0
/declare X1 int outer 0
/declare X2 int outer 0
/declare Y1 int outer 0
/declare Y2 int outer 0
/declare Dist int outer
|****************************************************************|
|*********************Iniaties 1-Time Events*********************|
|****************************************************************|
:PreStart
/echo Starting run... Num Lock Down.
/keypress Num_Lock
/call FindXY
/varset Dist 90 |*Change this to increase-decrease size of square*|
/echo Running at a distance of ${Dist}
|****************************************************************|
|*****************Calls Events in Main Cycle*********************|
|****************************************************************|
:MainLoop
/call GetXY
/call TChk
/varset cursong ${Selos}
/call Chant
/call GetXY
/call TChk
/varset cursong ${Dot1}
/call Chant
/call GetXY
/call TChk
/varset cursong ${Dot2}
/call Chant
/call GetXY
/goto :MainLoop
/return
|****************************************************************|
|*************************Chant Routine**************************|
|****************************************************************|
Sub Chant
|****************************************************************|
|**************Stop Song and GetXY While Queded******************|
|****************************************************************|
/echo Beging chant of ${cursong}
:StopCastLoop
/stopsong
/delay 2
/call GetXY
/doevents
/delay 1
/if (${Me.SpellReady[${cursong}]}) {
/echo Going to cast...
/goto :Cast
}
/goto :StopCastLoop
|****************************************************************|
|***************************Beging Chant*************************|
|****************************************************************|
:Cast
/cast ${cursong}
/varcalc SpellDelay 1
/call GetXY
/echo Cast song delay ${SpellDelay}
|****************************************************************|
|**********Song Delay Loop. Does GetXY while queded**************|
|****************************************************************|
:SDLoop
/call GetXY
/echo Spell Delay loop ${SDCnt}/5
/if (${SDCnt}>=4) {
/varset SDCnt 1
/goto :Done
}
/call GetXY
/delay 1
/call GetXY
/delay ${SpellDelay}s
/varcalc SDCnt ${SDCnt}+1
/call GetXY
/doevents
/goto :SDLoop
:Done
/call GetXY
/echo Ending chant sub routine...
/return
|****************************************************************|
|*************Set and Calcs 4 Point Loc System*******************|
|****************************************************************|
Sub FindXY
/declare X int outer
/declare Y int outer
/varset X ${Target.Y}
/varset Y ${Target.X}
/varset X1 ${Math.Calc[${X}+90]}
/varset X2 ${Math.Calc[${X}-90]}
/varset Y1 ${Math.Calc[${Y}+90]}
/varset Y2 ${Math.Calc[${Y}-90]}
/delay 2
/echo Center at ${X}, ${Y}. X1=>${X1}, X2=>${X2}, Y1=>${Y1}, Y2=>${Y2}
/return
|****************************************************************|
|********************Checks and Finds New Loc********************|
|****************************************************************|
Sub GetXY
/if (${CurLocLock}>=4) /varset CurLocLock 0
/call Move${CurLocLock}
/return
|****************************************************************|
|*****************Check Dists and Changes Locs*******************|
|****************************************************************|
Sub Move0
/echo Doing loc 1[${X1},${Y1}] Distance to target loc ${Math.Distance[${X1},${Y1}]}
/if (${Math.Distance[${X1},${Y1}]}<=25) {
/echo Distance to target less than 25. Turning.. Move Loc 1 Sub Routine
complete.
/varcalc CurLocLock ${CurLocLock}+1
/goto :Done
}
/face loc ${X1},${Y1}
:Done
/return
Sub Move1
/echo Doing loc 1[${X1},${Y2}] Distance to target loc ${Math.Distance[${X1},${Y2}]}
/if (${Math.Distance[${X1},${Y2}]}<25) {
/echo Distance to target less than 25. Turning.. Move Loc 2 Sub Routine
complete.
/varcalc CurLocLock ${CurLocLock}+1
/goto :Done
}
/face loc ${X1},${Y2}
:Done
/return
Sub Move2
/echo Doing loc 1[${X2},${Y2}] Distance to target loc ${Math.Distance[${X2},${Y2}]}
/if (${Math.Distance[${X2},${Y2}]}<25) {
/echo Distance to target less than 25. Turning.. Move Loc 3 Sub Routine complete.
/varcalc CurLocLock ${CurLocLock}+1
/goto :Done
}
/face loc ${X2},${Y2}
:Done
/return
Sub Move3
/echo Doing loc 1[${X2},${Y1}] Distance to target loc ${Math.Distance[${X2},${Y1}]}
/if (${Math.Distance[${X2},${Y1}]}<25) {
/echo Distance to target less than 25. Turning.. Move Loc 4 Sub Routine complete.
/varcalc CurLocLock ${CurLocLock}+1
/goto :Done
}
/face loc ${X2},${Y1}
:Done
/return
|****************************************************************|
|************************Checks for Target***********************|
|****************************************************************|
Sub TChk
/if (${Target.ID}) /goto :Done
/if (${Target.Distance}>1000) {
/target clear
/goto :GetTarget
}
/goto :Done
:GetTarget
/echo Aquiring new target...
/target npc radius 250
/echo Target ${Target.Name}, level ${Target.Level}, class ${Target.Class}, HP
${Target.Hp}
:Done
/return
|****************************************************************|
|******************************Events****************************|
|****************************************************************|
Sub Event_MissedNote
/echo You missed a note. Retrying song ${cursong}
/call chant
/return
Sub Event_Died
/echo You died. Ending macro and sitting down...
/end
/sit
/return
Sub Event_Recovered
/echo You did not recover in time to cast that song.
/call chant
/return
Sub Event_Slowed
/echo You have lost selos. Casting selos...
/varset cursong ${selos}
/call chant
/return
Last edited by
Luc`Dragon on Mon May 31, 2004 10:59 pm, edited 2 times in total.
-
Virtuoso65
- a hill giant

- Posts: 150
- Joined: Wed Oct 15, 2003 2:29 pm
Post
by Virtuoso65 » Mon May 31, 2004 7:17 pm
|****************************************************************|
|**********Song Delay Loop. Does GetXY while queded**************|
|****************************************************************|
:SDLoop
/if (${SDLoop}>=5) {
/varset SDCnt 1
/goto

one
}
/delay 1
/delay ${SpellDelay}s
/varadd SDCnt 1
/call GetXY
/doevents
/goto :SDLoop

one
/return
This is wrong.
Instead try
-
Luc`Dragon
- orc pawn

- Posts: 13
- Joined: Tue Feb 04, 2003 5:34 pm
Post
by Luc`Dragon » Tue Jun 01, 2004 8:51 am
Changed, it now doesn't have ne errors, but nor does it work. It runs and erratic pattern, and does chant, but only a couple of songs, then it stops.
-
Virtuoso65
- a hill giant

- Posts: 150
- Joined: Wed Oct 15, 2003 2:29 pm
Post
by Virtuoso65 » Tue Jun 01, 2004 9:12 am

one
/return
|****************************************************************|
|************************Checks for Target***********************|
|****************************************************************|
Sub TChk
/if (${Target.ID}) /goto

one
/if (${Target.Distance}>1000) {
/target clear
/goto :GetTarget
}
/goto

one
:GetTarget
/echo Aquiring new target...
/target npc radius 250
/echo Target ${Target.Name}, level ${Target.Level}, class ${Target.Class}, HP ${Target.Hp}

one
/return
This will do nothing if you have no target, thus causing and endless loop.
Code: Select all
/if (${Target.ID}) /goto :Done
/if (${Target.Distance}>1000) {
/target clear
/goto :GetTarget
}
/goto :Done
:GetTarget
Instead try something like this.
Code: Select all
/if((${Target.ID) && (${Target.Distance}<1000)) {
/goto :Done
} else /goto :GetTarget
You have :done all over your macro in places it really shouldnt be, IE the end of subs. Let the sub do its normal return, this could also be causing your eradic behavior. Loops using :loop, /goto :loop should not have more then one :loop.
I have some free time so I am gona work on this a bit, will post a modded rendition shortly.
Good luck
V
-
Virtuoso65
- a hill giant

- Posts: 150
- Joined: Wed Oct 15, 2003 2:29 pm
Post
by Virtuoso65 » Tue Jun 01, 2004 10:31 am
Heh so a minor retune turned into a major rebuild.
This is untested but the song casting stuff should work a bit better as I just jacked it from my simple twist macro.
Code: Select all
|****************************************************************|
|*******************Bard Chant Kite Macro************************|
|**************Runs in a square while doting mobs****************|
|****************************************************************|
|******************/macro kite dot1 dot2 selos*******************|
|****************************************************************|
|****************************************************************|
|**************************By: Luc`Dragon************************|
|**********************Mod/fixed by Virtuoso65*******************|
|****************************************************************|
|***************************Events Set-Up************************|
|****************************************************************|
#event Dies "#*#LOADING, PLEASE WAIT...#*#"
#event MissedNote "#*#You miss a note, bringing your song to a close!#*#"
#event Recovered "#*#You haven't recovered yet...#*#"
#event Slowed "#*#You slow#*#"
Sub MAIN(P1,P2,P3)
/echo ${Macro} Starting up
|****************************************************************|
|************************Global Variables************************|
|****************************************************************|
/declare cursong int outer 0
/declare CurLocLock int outer 0
/declare SpellTicks int outer 0
/declare SDCnt int outer 0
/declare SpellDelay int outer 30
/declare X1 int outer 0
/declare X2 int outer 0
/declare Y1 int outer 0
/declare Y2 int outer 0
/declare Dist int outer 90
/declare P1 int outer
/declare P2 int outer
/declare P3 int outer
/declare pcount int outer
/declare t0 timer outer 0
|****************************************************************|
|*********************Iniaties 1-Time Events*********************|
|****************************************************************|
/call FindXY
/doevents
/keypress Num_Lock
/echo Running at a distance of ${Dist}
|****************************************************************|
|*************************Chant Routine**************************|
|****************************************************************|
:Cast
/if (${t0}<=0) {
/stopsong
/delay 2
/varset t0 ${SpellDelay}
/cast ${cursong}
/varcalc pcount ${pcount}+1
/if (${pcount}>3) {
/varset cursong 1
} else /varset cursong ${P${pcount}}
/call TChk
/call GetXY
/doevents
}
/goto :Cast
/return
|****************************************************************|
|*************Set and Calcs 4 Point Loc System*******************|
|****************************************************************|
Sub FindXY
/declare X int outer
/declare Y int outer
/varset X ${Target.Y}
/varset Y ${Target.X}
/varset X1 ${Math.Calc[${X}+${Dist}]}
/varset X2 ${Math.Calc[${X}-${Dsit}]}
/varset Y1 ${Math.Calc[${Y}+${Dist}]}
/varset Y2 ${Math.Calc[${Y}-${Dist}]}
/echo Center at ${X}, ${Y}. X1=>${X1}, X2=>${X2}, Y1=>${Y1}, Y2=>${Y2}
/return
|****************************************************************|
|********************Checks and Finds New Loc********************|
|****************************************************************|
Sub GetXY
/if (${CurLocLock}>=4) /varset CurLocLock 0
/call Move${CurLocLock}
/return
|****************************************************************|
|*****************Check Dists and Changes Locs*******************|
|****************************************************************|
Sub Move0
/echo Doing loc 1[${X1},${Y1}] Distance to target loc ${Math.Distance[${X1},${Y1}]}
/if (${Math.Distance[${X1},${Y1}]}<=25) {
/echo Distance to target less than 25. Turning.. Move Loc 1 Sub Routine complete.
/varcalc CurLocLock ${CurLocLock}+1
}
/face loc ${X1},${Y1}
/return
Sub Move1
/echo Doing loc 1[${X1},${Y2}] Distance to target loc ${Math.Distance[${X1},${Y2}]}
/if (${Math.Distance[${X1},${Y2}]}<25) {
/echo Distance to target less than 25. Turning.. Move Loc 2 Sub Routine complete.
/varcalc CurLocLock ${CurLocLock}+1
}
/face loc ${X1},${Y2}
/return
Sub Move2
/echo Doing loc 1[${X2},${Y2}] Distance to target loc ${Math.Distance[${X2},${Y2}]}
/if (${Math.Distance[${X2},${Y2}]}<25) {
/echo Distance to target less than 25. Turning.. Move Loc 3 Sub Routine complete.
/varcalc CurLocLock ${CurLocLock}+1
}
/face loc ${X2},${Y2}
/return
Sub Move3
/echo Doing loc 1[${X2},${Y1}] Distance to target loc ${Math.Distance[${X2},${Y1}]}
/if (${Math.Distance[${X2},${Y1}]}<25) {
/echo Distance to target less than 25. Turning.. Move Loc 4 Sub Routine complete.
/varcalc CurLocLock ${CurLocLock}+1
}
/face loc ${X2},${Y1}
/return
|****************************************************************|
|************************Checks for Target***********************|
|****************************************************************|
Sub TChk
/if((${Bool.Target.ID) && (${Target.Distance}<1000)) {
/return
} else {
/target npc radius 250
/echo Target ${Target.Name}, level ${Target.Level}, class ${Target.Class}, HP ${Target.Hp}
}
/return
|****************************************************************|
|******************************Events****************************|
|****************************************************************|
Sub Event_MissedNote
/varcalc pcount ${pcount}-1
/varset t0 1
/return
Sub Event_Died
/echo You died. Ending macro and sitting down...
/sit on
/camp
/end
/return
Sub Event_Recovered
/echo You did not recover in time to cast that song.
/varset t0 1
/return
Sub Event_Slowed
/echo You have lost selos. Casting selos...
/varset cursong ${P3}
/return