Requesting help converting the advanced bard twist anda attk

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

Moderator: MacroQuest Developers

Cazz

Requesting help converting the advanced bard twist anda attk

Post by Cazz » Mon Oct 13, 2003 1:32 am

http://macroquest2.com/phpBB2/viewtopic.php?t=2856

I loved that one, but sadly I suck with this coding and coversion stuff (I'm a hardware/network guy, not a programmer :( )


If anyone is really good with conversion, feel free to fix it, you would make one bards wrists very happy.

User avatar
grimjack
Macro Author
Macro Author
Posts: 525
Joined: Thu Nov 07, 2002 6:51 am
Contact:

Re: Requesting help converting the advanced bard twist anda

Post by grimjack » Mon Oct 13, 2003 2:16 am

Cazz wrote:http://macroquest2.com/phpBB2/viewtopic.php?t=2856

I loved that one, but sadly I suck with this coding and coversion stuff (I'm a hardware/network guy, not a programmer :( )


If anyone is really good with conversion, feel free to fix it, you would make one bards wrists very happy.
Don't have a bard so I don't know if it will work but here is a conversion.

Code: Select all

| twist_adv.mac
| Advanced bard twisting and fighting macro. This macro holds up to
| 5 songs in a twist (more than 3 will not be sustainable), and has
| target auto-following, and activatable move-behind script.
| Syntax
| p0 (move behind script - if disabled, everything but
|       the move-behind will be operational.
| p1 (cast delay - allows custization of the delays for casting, incase
|       your computer is lagging. 32 works for most circumstances
| p2-6 Song #1-5
| This script is a combination of Grimjack's excelent fighting and
| movebehind code, customized, and a bard song twisting macro
| -ThatOtherGuy
#Turbo 150
#Event Enraged "has become ENRAGED"
#Event Offrage "is no longer enraged"
#Event exp "You gain party experience"
#Event rexp "You gained raid experience"
#Event aaon "Auto attack is on"
#Event aaoff "Auto attack is off"
#Event MissedNote "You miss a note, bringing your song to a close!"

Sub Main
/declare MobShouldFace global
/declare autoon global
/declare RangeMin global
/declare RangeMax global
/declare FastRange global
/declare RaidYes global
/declare expset global
/declare expvar1 global
/declare expvar2 global
/declare expgain global
/declare aaexpvar1 global
/declare aaexpvar2 global
/declare aaexpgain global
/declare currentsong global
/declare song1 global
/declare song2 global
/declare song3 global
/declare song4 global
/declare song5 global
/declare dly global
/declare timer timer
/declare Combatstatus global
/declare CastTimer timer
/declare EnrageVar global
/if $defined(Param3)==FALSE {
   /echo usage (movebehind 1|0) (song cast delay) (song1) (song2) (song3) (song4) (song5)
   /return
}
/if $defined(Param2)==FALSE {
   /echo usage (movebehind 1|0) (song cast delay) (song1) (song2) (song3) (song4) (song5)
   /return
}
/if $defined(Param1)==FALSE {
   /echo usage (movebehind 1|0) (song cast delay) (song1) (song2) (song3) (song4) (song5)
   /return
}
/varset RaidYes @Param0
/varset RangeMin 5
/varset RangeMax 15
/varset FastRange 20
/varset Combatstatus 0
/varset EnrageVar 0
/varset expset 0
/varset autoon 0
/varset timer 0
/varset song1 @Param2
/if $defined(Param3)==TRUE /varset song2 @Param3
/if $defined(Param4)==TRUE /varset song3 @Param4
/if $defined(Param5)==TRUE /varset song4 @Param5
/if $defined(Param6)==TRUE /varset song5 @Param6
/echo song 1 @song1
/echo song 2 @song2
/echo song 3 @song3
/echo song 4 @song4
/echo song 5 @song5
/varset dly "@Param1"
/varset currentsong "songone"
   :Mainloop
      /call SetExp
      /doevents
      /call Combatcheck
      /if @Combatstatus=="1" /call RangeSub
      /if @Combatstatus=="1" /call Checkbehind
      /call twist
      /doevents
   /goto :Mainloop
/return

Sub Checkbehind
/if n $distance($calc($target(y)-$cos($target(heading))*10),$calc($target(x)-$sin($target(heading))*10))>8 {
   /if @RaidYes=="1" {
      /if @Combatstatus=="1" /call movebehind
   }
}
/return

Sub SetExp
/if @expset=="0" {
   /varset expvar1 $char(exp)
   /varset aaexpvar1 $char(aa,exp)
   /varset expset 1
   /return
}
/return

Sub Combatcheck
/if @autoon=="0" /return
/if $target()=="FALSE" {
   /varset Combatstatus 0
   /attack off
   /varset autoon 0
}
/if @EnrageVar=="1" {
   /if $target()=="TRUE" {
   /return
   } else {
   /varset EnrageVar 0
   /varset Combatstatus 0
   }
}
/if $target()=="FALSE" {
   /varset Combatstatus 0
   /if $combat=="TRUE" {
      /attack off
   }
   /return
}
   /if $target()=="TRUE" {
      /if @autoon=="1" {
         /varset Combatstatus 1
         /return
      }
   } else {
      /varset Combatstatus 0
   }
/return

Sub Rangesub
   /face fast nopredict
   /if n $target(distance)>=@FastRange /call Fastmove
   /if n $target(distance)>@RangeMax {
      /press up
   }
   /if n $target(distance)<@RangeMin {
      /press down
   }
/return

Sub Event_Enraged
   /if $target()=="TRUE" {
      /varset EnrageVar 1
      /attack off
   }
/return

Sub Fastmove
   :fastmoveloop
   /if $target()=="FALSE" {
      /varset Combatstatus 0
      /sendkey up up
      /if $combat=="TRUE" {
         /attack off
         /return
         }
         }
         /face fast nopredict
         /if n $target(distance)>@FastRange {
         /sendkey down up
         /attack off
         }
         /if n $target(distance)<=@FastRange {
         /if @Combatstatus=="1" {
         /if @EnrageVar=="0" {
         /attack on
         }
      }
      /sendkey up up
      /return
   }
   /goto :fastmoveloop
/return

Sub Event_Offrage
   /if $target()=="TRUE" {
      /varset EnrageVar 0
      /attack
   }
}
/return

Sub Event_aaon
/varset autoon 1
/return

Sub Event_aaoff
/varset autoon 0
/varset Combatstatus 0
/return
| --------------------------------

Sub movebehind
   /if $target()==FALSE {
      /attack off
      /sendkey up up
      /return
   }
   /varcalc MobShouldFace $char(heading)
   /varcalc MobShouldFace @MobShouldFace%360
   /if $target(heading)<=$calc(@MobShouldFace+80) /if $target(heading)>=$calc(@MobShouldFace-80) /return
   /sendkey down up
   :gotopointloop
      /if $combat=="TRUE" {
      }
      /if $target()==FALSE {
         /sendkey up up
         /return
      }
      /face fast loc $calc($target(y)-$cos($target(heading))*20),$calc($target(x)-$sin($target(heading))*20)
      /if n $distance($calc($target(y)-$cos($target(heading))*20),$calc($target(x)-$sin($target(heading))*20))>3 /goto :gotopointloop
      /sendkey up up
      /face fast nopredict
/return

|----------------------

Sub Event_exp
   /delay 1s
   /varset expvar2 $char(exp)
   /varset aaexpvar2 $char(aa,exp)
   /varcalc expgain @expvar2-@expvar1
   | AA calcs
   /varcalc aaexpgain @aaexpvar2-@aaexpvar1
   /varset expset 0
   /varset autoon 0
   /varset Combatstatus 0

   /echo EXP - Gain: @expgain% Total: $char(exp)%
   /echo AAEXP - Gain: @aaexpgain% Total: $char(aa,exp)%
/return

Sub Event_rexp
   /delay 1s
   /varset expvar2 $char(exp)
   /varset aaexpvar2 $char(aa,exp)
   /varcalc expgain @expvar2-@expvar1
   | AA calcs
   /varcalc aaexpgain @aaexpvar2-@aaexpvar1
   /varset expset 0
   /varset autoon 0
   /varset Combatstatus 0

   /echo EXP - Gain: @expgain% Total: $char(exp)%
   /echo AAEXP - Gain: @aaexpgain% Total: $char(aa,exp)%
/return

|-------------------------------------------------

Sub twist
/if @currentsong=="songone" {
   /if n @timer=="0" {
      /stop
      /delay 3
      /cast @song1
      /doevents
      /varset timer "@dly"
      /echo timer = @timer and dly = @dly
      /if @song2!="" {
         /varset currentsong "songtwo"
      }
      /if @song2=="" {
         /varset currentsong "songone"
      }
   } else {
      /return
   }
}   /return

/if @currentsong=="songtwo" {
   /if n @timer=="0" {
      /stop
      /delay 3
      /cast @song2
      /doevents
      /varset timer "@dly"
      /if @song3!="" {
         /varset currentsong "songthree"
      }
      /if @song3=="" {
         /varset currentsong "songone"
      }
   } else {
      /return
   }
   /return
}

/if @currentsong=="songthree" {
   /if n @timer=="0" {
      /stop
      /delay 3
      /cast @song3
      /doevents
      /varset timer "@dly"
      /if @song4!="" {
         /varset currentsong "songfour"
      }
      /if @song4=="" {
         /varset currentsong "songone"
      }
   } else {
      /return
   }
   /return
}

/if @currentsong=="songfour" {
   /if n @timer=="0" {
      /stop
      /delay 3
      /cast @song4
      /doevents
      /varset timer "@dly"
      /if @song5!="" {
         /varset currentsong "songfive"
      }
      /if @song5=="" {
         /varset currentsong "songone"
      }
   } else {
      /return
   }
   /return
}
/if @currentsong=="songfive" {
   /if n @timer=="0" {
      /stop
      /delay 3
      /cast @song5
      /doevents
      /varset timer "@dly"
      /varset currentsong "songone"
   } else {
      /return
   }
   /return
}
/return

Sub Event_MissedNote
/if @currentsong=="songone" {
   /cast @song1
   /delay 3
   /varset timer "@dly"
}
/if @currentsong=="songtwo" {
   /cast @song2
   /delay 3
   /varset timer "@dly"
}
/if @currentsong=="songthree" {
   /cast @song3
   /delay 3
   /varset timer "@dly"
}
/if @currentsong=="songfour" {
   /cast @song4
   /delay 3
   /varset timer "@dly"
}
/if @currentsong=="songfive" {
   /cast @song5
   /delay 3
   /varset timer "@dly"
}
/doevents
/return 
Thanks
Last edited by grimjack on Mon Oct 13, 2003 10:33 pm, edited 1 time in total.
When they come to me, they're in trouble, or they want some. I bust people out of prison, hunt down vampires, fight alien gods -- All the fun jobs people are too squeamish or too polite to do themselves.

Call me a mercenary. Call me an assassin. Call me a villain. I am all that and more.

My name's John Gaunt, but out on the streets of Cynosure, I am called...
GrimJack

insanitywiz
a hill giant
a hill giant
Posts: 250
Joined: Mon Jul 08, 2002 7:50 am

Post by insanitywiz » Mon Oct 13, 2003 3:19 am

I haven't taken a look at GJ's code yet, but there was some talk about converting it soon if this doesn't work. If it doesn't show up soon I'll take GJ's post and make sure it works, as it was going to be my next project anyway.

ThatOtherGuy
a lesser mummy
a lesser mummy
Posts: 41
Joined: Tue Aug 05, 2003 6:12 pm

Post by ThatOtherGuy » Mon Oct 13, 2003 7:26 am

Yea, I'm working on moving it over and maybe cleaning it up a bit. the movebehind code is a little weird to have on a bard, but I'll keep it in if people like it hehe
-TOG

insanitywiz
a hill giant
a hill giant
Posts: 250
Joined: Mon Jul 08, 2002 7:50 am

Post by insanitywiz » Mon Oct 13, 2003 12:45 pm

I don't use movebehind myself, since I only use this to twist unless I need to pause and mez or perform other duties, not to fully bot the bard. Bards are too fun to play to bot them entirely.

Cazz

ROCK

Post by Cazz » Mon Oct 13, 2003 3:40 pm

You guys rock, geez, thanks a ton! I'm gonna go test out the code now....
My Wrist send you love!

Cazz

Found a problem

Post by Cazz » Mon Oct 13, 2003 3:57 pm

heyya,

went for a test run, it starts up, but hangs on the 4th song twist

errors is like this
Ending Macro [] pairing ran into another sub-routine
Twist.mac @319 (twist)
@ current song =="songhour" (
twist.mac @87 (main): /call twist
cleared the following: Timer Vars Arrays
the macro has ended


Must be a typo somewhere in the song four call, I'll try to look for it.

Guest

Post by Guest » Mon Oct 13, 2003 4:02 pm

I found an error in MY post above
line :
@currentsong=="songhour" that should be @currentsong=="songfour"

Cazz

Hrmm think I found it

Post by Cazz » Mon Oct 13, 2003 4:34 pm

/if @currentsong=="songfour" {
/if n @timer=="0" {
/stop
/delay 3
/cast @song4
/doevents
/varset timer "@dly"
/if @song5!="" {
/varset currentsong "songfive"
}
/if @song5=="" {
/varset currentsong "songone"
}
} else {
/return
}
/return
changed to
/if @currentsong=="songfour" {
/if n @timer=="0" {
/stop
/delay 3
/cast @song4
/doevents
/varset timer "@dly"
/if @song5!="" {
/varset currentsong "songfive"
}
/if @song5=="" {
/varset currentsong "songone"
}
} else {
/return
}
/return
}

User avatar
grimjack
Macro Author
Macro Author
Posts: 525
Joined: Thu Nov 07, 2002 6:51 am
Contact:

Post by grimjack » Mon Oct 13, 2003 10:34 pm

Added the } to the top post.
When they come to me, they're in trouble, or they want some. I bust people out of prison, hunt down vampires, fight alien gods -- All the fun jobs people are too squeamish or too polite to do themselves.

Call me a mercenary. Call me an assassin. Call me a villain. I am all that and more.

My name's John Gaunt, but out on the streets of Cynosure, I am called...
GrimJack

tac8357

songs

Post by tac8357 » Fri Oct 17, 2003 4:05 pm

I hate to ask this where abouts would i insert the name of the songs at in the script. Still very new to this.

insanitywiz
a hill giant
a hill giant
Posts: 250
Joined: Mon Jul 08, 2002 7:50 am

Post by insanitywiz » Sat Oct 18, 2003 12:44 am

Do it by gem numbers.

/Macro Macroname 1 4 5 6 8

Should twist songs 1 4 5 6 8

tac8357
orc pawn
orc pawn
Posts: 25
Joined: Fri Oct 17, 2003 5:18 pm
Contact:

thanxs

Post by tac8357 » Sat Oct 18, 2003 8:45 am

thanx forclearing that up for me. You dont know how long i've been beating my head againts the wall trying to figure out how that works.