twisting mac

A forum for you to dump all the macros you create, allowing users to use, modify, and comment on your work.

Moderator: MacroQuest Developers

Bass

Post by Bass » Mon Nov 17, 2003 4:43 am

I had same problem and was able to fix it by specifying same amount of songs when attacking and not attacking. For example:

/macro twist 8123 8567

or

/macro twist 8123123 8456456

I works fine when you specify same number of songs on both.

User avatar
Dniper
a lesser mummy
a lesser mummy
Posts: 71
Joined: Tue Nov 25, 2003 2:54 pm

Post by Dniper » Sat Dec 06, 2003 8:56 pm

Anyone able to fix it so you don't have to make it the same amount of songs on both?

ml2517
a grimling bloodguard
a grimling bloodguard
Posts: 1216
Joined: Wed Nov 12, 2003 1:12 am

Post by ml2517 » Sat Dec 06, 2003 9:18 pm

Posted tested version down below.
Last edited by ml2517 on Sun Dec 07, 2003 1:05 am, edited 1 time in total.

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

STILL A PROBLEM

Post by tac8357 » Sat Dec 06, 2003 11:34 pm

Doesnt switch between attack and non attack.

Guest

Post by Guest » Sun Dec 07, 2003 12:01 am

I see what the problem is here. I ran into it also. :lol:


$combat doesn't return the proper reading if you have an instrument equipped.

Try wielding two swords and try again. Make sure to start the macro like:

/macro twist.mac 1234 678

or something like that so you can tell if its actually switching songs.

ml2517
a grimling bloodguard
a grimling bloodguard
Posts: 1216
Joined: Wed Nov 12, 2003 1:12 am

Post by ml2517 » Sun Dec 07, 2003 12:02 am

And of course I forget to log in before I responded. :lol: Try what I said above and let me know.

ml2517
a grimling bloodguard
a grimling bloodguard
Posts: 1216
Joined: Wed Nov 12, 2003 1:12 am

Post by ml2517 » Sun Dec 07, 2003 1:08 am

Tested this version and worked on a few things.

Make sure you have two weapons equipped and not an instrument or it won't be able to switch from non-combat to combat mode properly.

See below.
Last edited by ml2517 on Tue Apr 20, 2004 10:02 pm, edited 1 time in total.

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

?

Post by tac8357 » Sun Dec 07, 2003 1:09 am

oky why cant we have it with a instrument equipped? Is there a way to make work with both?

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

?

Post by tac8357 » Sun Dec 07, 2003 1:10 am

As a bard i switch from weapon to drums all the time.

ml2517
a grimling bloodguard
a grimling bloodguard
Posts: 1216
Joined: Wed Nov 12, 2003 1:12 am

Post by ml2517 » Sun Dec 07, 2003 1:15 am

The problem is the way that $combat works in MQ2.

Maybe Lax or one of the other developers can comment?

Maybe if we could just check if auto attack is on it might work well also. I'll look around and see if there is a way to do that currently.

There are other ways that you could do checks to see if you are in combat but my only ideas on that would take tons of #event entries and would probably be slow.

Raebis

Post by Raebis » Sun Dec 07, 2003 6:18 pm

Code: Select all

DWORD parmCombat(PCHAR szVar, PCHAR szOutput, PSPAWNINFO pChar)
{
    DWORD i=0;
    // $combat
    if (!EQADDR_ATTACK) return PMP_ERROR_BADPARM;
    BYTE bAttack = *EQADDR_ATTACK;
    i+=5;
    if (bAttack == 0) {
        strcat(szOutput,"TRUE");
    } else {
        strcat(szOutput,"FALSE");
    }
    return i;
}
I don't think it has anything to do with MacroQuest but more or less the offset used to find out if autoattack is on

User avatar
Dniper
a lesser mummy
a lesser mummy
Posts: 71
Joined: Tue Nov 25, 2003 2:54 pm

Post by Dniper » Mon Dec 08, 2003 2:47 am

Thanks for the update.

I've noticed that I can switch instruments just fine without it screwing up.

I think it's only when the instrument is in the primary that it screws up combat/noncombat song line; which is okay for me since my bard doesn't use any primary-only instruments.

ml2517
a grimling bloodguard
a grimling bloodguard
Posts: 1216
Joined: Wed Nov 12, 2003 1:12 am

Post by ml2517 » Mon Dec 08, 2003 12:01 pm

Ah ok. Yeah I'd noticed the instrument thing when I had my epic in offhand and Drums of Karana in main hand.

ml2517
a grimling bloodguard
a grimling bloodguard
Posts: 1216
Joined: Wed Nov 12, 2003 1:12 am

Post by ml2517 » Fri Dec 12, 2003 12:25 am

Here is a version of twist.mac that has a dynamic buffer that should allow it to auto-tune based on lag. This requires an INI file to be saved in your macros directory as well. The INI has some song information that lets me know if the song icon is a shortbuff or not.

Code: Select all

| - twist.mac - 
|
| Modified from Colonel's Macro 
| 
| Modified to current form 12/11/2003 
|
|  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

| INIFILENAME is the name of the INI file that has the song shortbuff information
#define INIFILENAME songinfo.ini

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 

    /call INICompare

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


Sub CombatSing 
     /declare Buffer local
  :CombatSing1
    /varset SingTime 3s
    /varset Buffer 0    
|    /echo Song: @Param0  Type: @ArrSong(@Param0)
    /cast @Param0
  :CombatSing2
    /delay 1
    /if "$char(casting)"=="TRUE" /goto :CombatSing2
    /if n @SingTime>0 /goto :CombatSing1
    /if n @ArrSong(@Param0)!=1 {
        /delay @DynamicBuffer
        /stopsong
    } else {
      :CombatSing3
        /varadd Buffer 1
        /delay 1
        /if n @Buffer>8 {
        /stopsong
        /goto :CombatSing1
        }
        /if n $char(song,$char(song,"$char(gem,@Param0)"),duration)<2 /goto :CombatSing3
        /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
    /varset SingTime 3s
    /varset Buffer 0    
|    /echo Song: @Param0  Type: @ArrSong(@Param0)
    /cast @Param0
  :NonCombatSing2
    /delay 1
    /if "$char(casting)"=="TRUE" /goto :NonCombatSing2
    /if n @SingTime>0 /goto :NonCombatSing1
    /if n @ArrSong(@Param0)!=1 {
        /delay @DynamicBuffer
        /stopsong
    } else {
      :NonCombatSing3
        /varadd Buffer 1
        /delay 1
        /if n @Buffer>8 {
        /stopsong
        /goto :NonCombatSing1
        }
        /if n $char(song,$char(song,"$char(gem,@Param0)"),duration)<2 /goto :NonCombatSing3
        /varset DynamicBuffer @Buffer
        /stopsong
    }
|    /echo Dynamic Buffer: @DynamicBuffer
    /varadd NonCombatCurSong 1 
    /if n @NonCombatCurSong>@NNonCombatSongs /varset NonCombatCurSong 1 
/return 



Sub INICompare
    /declare A local
    /for A 1 to 8
    /varset ArrSong(@A) "$ini(INIFILENAME,"Songs",$Spell("$char(gem,@A)",id))" 
    /if n @ArrSong(@A)<0 /if n @ArrSong(@A)>2 /varset ArrSong(@A) 0
    /next A
/return
Save this INI as songinfo.ini in your macros directory as well:

Code: Select all

[Songs]
718=0
727=1
2603=1
1196=1
1197=0
706=0
1748=0
701=1
3682=0
3681=0
2606=1
704=0
1747=0
3371=0
4112=1
1759=1
1448=1
1287=1
723=1
745=1
1761=0
700=1
703=0
3372=1
2609=1
708=1
1452=1
741=0
1764=0
742=0
730=0
736=0
1100=0
3369=0
3030=0
3364=0
2607=1
710=1
2936=0
4085=1
4086=1
4087=1
707=0
4210=0
709=1
3375=0
7=1
722=1
1762=1
749=1
734=1
2604=1
1749=0
724=0
728=1
1751=0
705=0
3376=0
737=1
720=1
721=1
735=1
2601=1
702=1
1760=1
739=1
1449=1
3365=0
1752=1
1763=1
748=1
1451=0
713=1
714=1
716=1
3368=1
715=1
712=1
2608=1
711=1
3066=0
3362=1
4083=1
4084=1
3366=0
717=0
2605=2
1758=0
746=0
738=0
4395=0
1750=0
719=0
1450=1
3361=0
868=0
750=0
1765=1
725=0
1754=0
1755=0
1756=0
2602=1
1753=0
726=0
729=0
3567=0
3367=0
743=0
744=0
3373=0
3566=0
3363=0
3370=0
747=1
1757=1
740=1
2610=1
3374=1
3651=1

ml2517
a grimling bloodguard
a grimling bloodguard
Posts: 1216
Joined: Wed Nov 12, 2003 1:12 am

Post by ml2517 » Fri Dec 12, 2003 12:40 am

I should also mention. The above script will only dynamically tune itself if you have at least one song in your twist that shows up in the song buff box.