Mods to a twist macro.

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

Moderator: MacroQuest Developers

Banannaboy
a lesser mummy
a lesser mummy
Posts: 43
Joined: Tue Apr 13, 2004 9:59 pm

Mods to a twist macro.

Post by Banannaboy » Wed Apr 14, 2004 10:47 pm

Hi. Im looking for some help adding some code to this twisting macro I use. Right now, the macro twists for me, but I would like to add the following to the macro.
1) Automatically forage and autoinventory whatever it forages (if anything)
2) Follow the mob that I am attacking untill it dies.

The code for the macro right now is.

Code: Select all

| - twist.mac - 
| 
| Modified from Colonel's Macro by ml2517 
| 
| Modified to current form 1/25/2004 
| 
|  Combat Twist Order ------------+ 
|  NonCombat Twist Order -----+   | 
|                             |   | 
| Usage:                      v   v 
|           /macro twist.mac ### ### 
| # represents the spell gem number you'd like to sing 
| 
| Example: 
| /macro twist.mac 4567 123456 
| 

#turbo 30 


Sub Main(Param0) 
    /if $defined(Param0)==FALSE /endmacro 

| 
|  Variable Declarations 
| 
    /declare CombatCurSong global 
    /declare NonCombatCurSong global 
    /declare NNonCombatSongs global 
    /declare NCombatSongs global 
    /declare NonCombatSongList global 
    /declare CombatSongList global 
    /declare TwistI global 
    /declare TwistJ global 
    /declare DynamicBuffer global 
    /declare NonCombatSongArray array 
    /declare CombatSongArray array 
    /declare ArrSong array 

| 
|  Timer Declarations 
| 
    /declare SingTime timer 


    /varset CombatCurSong 1 
    /varset NonCombatCurSong 1 
    /varset NNonCombatSongs $strlen(@Param0) 
    /varset NCombatSongs $strlen(@Param1) 
    /varset NonCombatSongList @Param0 
    /varset CombatSongList @Param1 
    /varset DynamicBuffer 5 

    /for TwistI 1 to @NNonCombatSongs 
        /varcalc TwistJ $int(@TwistI-1) 
        /varset NonCombatSongArray(@TwistI) $mid(@TwistJ,1,@NonCombatSongList) 
    /next TwistI 
    /for TwistI 1 to @NCombatSongs 
        /varcalc TwistJ $int(@TwistI-1) 
        /varset CombatSongArray(@TwistI) $mid(@TwistJ,1,@CombatSongList) 
    /next TwistI 

    :Loop 
    /if "$char(state)"!="SIT" { 

| ** Note -- When the $combat function gets fixed to return TRUE while in combat please change: 
| /if "$combat"=="FALSE" and /if "$combat"!="FALSE" both to TRUE 

        /if "$combat"=="FALSE" /call CombatSing @CombatSongArray(@CombatCurSong) 
        /if "$combat"!="FALSE" /call NonCombatSing @NonCombatSongArray(@NonCombatCurSong) 
    } 
   /if $char(state)=="DUCK" /press d 
   /if $char(state)=="SIT" /stand 
   /goto :Loop 
/return 


Sub CombatSing 
     /declare Buffer local 
  :CombatSing1 
    /call CheckSong @Param0 
    /varset SingTime 3s 
    /varset Buffer 0    
    /cast @Param0 
  :CombatSing2 
    /delay 1 
    /if "$char(casting)"=="TRUE" { 
        /if n @SingTime<=0 /goto :CombatSingBreak 
        /goto :CombatSing2 
    } 
    :CombatSingBreak 
    /if n @SingTime>0 /goto :CombatSing1 
    /if n $return==0 { 
        /delay @DynamicBuffer 
        /stopsong 
    } else /if n $return==2 { 
      :CombatSing3 
        /varadd Buffer 1 
        /delay 1 
        /if n @Buffer>8 { 
        /stopsong 
        /goto :CombatSing1 
        } 
        /if n $char(buff,$char(buff,"$char(gem,@Param0)"),duration)<24 /goto :CombatSing3 
        /varset DynamicBuffer @Buffer 
        /stopsong 
    } else { 
      :CombatSing4 
        /varadd Buffer 1 
        /delay 1 
        /if n @Buffer>8 { 
        /stopsong 
        /goto :CombatSing1 
        } 
        /if n $char(song,$char(song,"$char(gem,@Param0)"),duration)<2 /goto :CombatSing4 
        /varset DynamicBuffer @Buffer 
        /stopsong 
    } 
|    /echo Dynamic Buffer: @DynamicBuffer 
    /varadd CombatCurSong 1 
    /if n @CombatCurSong>@NCombatSongs /varset CombatCurSong 1 
/return 


Sub NonCombatSing 
     /declare Buffer local 
  :NonCombatSing1 
    /call CheckSong @Param0 
    /varset SingTime 3s 
    /varset Buffer 0    
    /cast @Param0 
  :NonCombatSing2 
    /delay 1 
    /if "$char(casting)"=="TRUE" { 
        /if n @SingTime<=0 /goto :NonCombatSingBreak 
        /goto :NonCombatSing2 
    } 
    :NonCombatSingBreak 
    /if n @SingTime>0 /goto :NonCombatSing1 
    /if n $return==0 { 
        /delay @DynamicBuffer 
        /stopsong 
    } else /if n $return==2 { 
      :NonCombatSing3 
        /varadd Buffer 1 
        /delay 1 
        /if n @Buffer>8 { 
        /stopsong 
        /goto :NonCombatSing1 
        } 
        /if n $char(buff,$char(buff,"$char(gem,@Param0)"),duration)<24 /goto :NonCombatSing3 
        /varset DynamicBuffer @Buffer 
        /stopsong 
    } else { 
      :NonCombatSing4 
        /varadd Buffer 1 
        /delay 1 
        /if n @Buffer>8 { 
        /stopsong 
        /goto :NonCombatSing1 
        } 
        /if n $char(song,$char(song,"$char(gem,@Param0)"),duration)<2 /goto :NonCombatSing4 
        /varset DynamicBuffer @Buffer 
        /stopsong 
    } 
|    /echo Dynamic Buffer: @DynamicBuffer 
    /varadd NonCombatCurSong 1 
    /if n @NonCombatCurSong>@NNonCombatSongs /varset NonCombatCurSong 1 
/return 

Sub CheckSong(GemNumber) 
/if "$spell("$char(gem,@GemNumber)",spelltype)"~~"Beneficial" { 
    /if ("$spell("$char(gem,@GemNumber)",targettype)"~~"Group" || "$spell("$char(gem,@GemNumber)",targettype)"~~"Self" || "$spell("$char(gem,@GemNumber)",targettype)"~~"PC") { 
        /if "$char(gem,@GemNumber)"=="Selo`s Accelerating Chorus" { 
            /return 2 
        } else { 
            /return 1 
        } 
    } else { 
        /return 0 
    } 
} else { 
    /return 0 
} 
/return 
Any help in this would be greatly appreciated. I know there is code out there for following a mob, and code for foraging, but I do not know how to combine all that into one macro.

User avatar
Elric
Cheese Whore
Cheese Whore
Posts: 466
Joined: Sun Nov 23, 2003 12:31 am
Location: Tampa, Fl
Contact:

Post by Elric » Wed Apr 14, 2004 11:25 pm

Didn't this already get locked once?
-Elric

Banannaboy
a lesser mummy
a lesser mummy
Posts: 43
Joined: Tue Apr 13, 2004 9:59 pm

Post by Banannaboy » Wed Apr 14, 2004 11:27 pm

Hmm? I just now posted this, its my second post on the boards.

MrSmallie
a hill giant
a hill giant
Posts: 167
Joined: Fri Oct 11, 2002 11:18 am

Post by MrSmallie » Fri Apr 16, 2004 3:49 pm

The bard/stickmob macro that you've posted in works fine.
You can add a couple lines in the noncombat twisting portion to forage.

Code: Select all

/doability "Forage"
/autoinv
No need for timers or anything.
Me
[img]http://home.comcast.net/~mrsmallie/ches.JPG[/img]

Charisa
a hill giant
a hill giant
Posts: 165
Joined: Tue Apr 06, 2004 5:38 pm

Post by Charisa » Fri Apr 16, 2004 5:57 pm

If you use the twist plugin, which in my opinion is vastly superior to anything i've seen done in a macro you can easily add in the other functionality.

I've got a macro done (just needing to do a bit ore debugging on it) based on that plugin and comwatch, it will stick to a mob till it dies, return to the spot where it engaged, will twist downtime and combat songs, do melee abilities if you so desire (such as intimdation), all of which can be independantly turned on or off and the settings are stored in an ini file so that the next time you activate it you don't have to set everything up again (even the songs you twist are stored in the ini by name, and will be skipped if they are not loaded when you fire up the macro so you don't accidently twist agro songs during downtime, etc).

Anyhow I can post my code if you want but there are a few errors in it that I'm well aware of. I've been waiting for MQ to switch over fully to the new system to make sure the plugins I based it on are still working, but I could easily finish up the last little bit of code, includng adding foraging option.

ImaNoob
a ghoul
a ghoul
Posts: 89
Joined: Mon Mar 08, 2004 4:37 am

Post it!

Post by ImaNoob » Fri Apr 16, 2004 7:05 pm

But post it to Macro Help.
Someone will look at it and help you, I'm sure.

Banannaboy
a lesser mummy
a lesser mummy
Posts: 43
Joined: Tue Apr 13, 2004 9:59 pm

Post by Banannaboy » Sat Apr 17, 2004 1:53 am

Charisa, that would be great. No need to post the code now, but could you post it when your done? That is just what I am looking for. Thanks