Odd output on script with latest build

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

mrjoshuanc
orc pawn
orc pawn
Posts: 14
Joined: Tue Mar 16, 2004 10:29 pm

Odd output on script with latest build

Post by mrjoshuanc » Wed Mar 31, 2004 6:59 pm

This doesn't interfere with the actual running of the script. Runs fine, ends fine. It's more of an annoyance, and curiosity as to the why that has me buggered, as I'm trying to learn :)

Here's the output I receive when I run the script:

Variable name already defined: CombatCurSong
Variable name already defined: NonCombatCurSong
Variable name already defined: NNonCombatSongs
Variable name already defined: NCombatSongs
Variable name already defined: NonCombatSongList
Variable name already defined: CombatSongList
Variable name already defined: TwistI
Variable name already defined: TwistJ
Variable name already defined: DynamicBuffer

Here's the script I'm using:

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"=="TRUE" /call CombatSing @CombatSongArray(@CombatCurSong) 
        /if "$combat"!="TRUE" /call NonCombatSing @NonCombatSongArray(@NonCombatCurSong) 
    } 
   /if $char(state)=="DUCK" /press d 
   /if $char(state)=="SIT" /stand 
   /if n $char(buff,"Harmonize")<1 { 
      /cast item "Shadowsong Cloak" 
      /delay 4s 
   } 
   /if n $char(buff,"Nature's Melody")<1 { 
      /cast item "Nature's Melody" 
      /delay 4s 
   } 

   /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

User avatar
Bad Karma
a snow griffon
a snow griffon
Posts: 346
Joined: Sat Nov 22, 2003 9:34 pm
Contact:

Post by Bad Karma » Wed Mar 31, 2004 7:09 pm

I got similar messages with a few macros last night. Haven't tried today's release of MQ2 yet, though.
[b]- Bad Karma
________________________________________[/b]

In our own quest for excellence, we should strive to take the time to help those who help themselves.

All others should [b]RTFM[/b]!!!!!!!!!

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

Post by ml2517 » Wed Mar 31, 2004 7:10 pm

It's likely related to the /if fix that Lax just put in. Try grabbing the latest zip and recompiling.

mrjoshuanc
orc pawn
orc pawn
Posts: 14
Joined: Tue Mar 16, 2004 10:29 pm

Post by mrjoshuanc » Wed Mar 31, 2004 7:49 pm

Just did. Still the same output.

First time I run it, no problems. I have a hotkey for /endmacro, /stopsong to end it. Next time I start it again, boom, it starts up again.

Is there anything I can add to the /endmacro hotkey to flush those values?

daerck
a ghoul
a ghoul
Posts: 134
Joined: Mon Jan 12, 2004 8:44 pm

Post by daerck » Wed Mar 31, 2004 8:07 pm

/zapvars

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

Post by ml2517 » Wed Mar 31, 2004 8:13 pm

Oh yeah duh... Lax mentioned something about preserving variables when using /endmacro now. Yeah just use a /zapvars right below Sub Main.

mrjoshuanc
orc pawn
orc pawn
Posts: 14
Joined: Tue Mar 16, 2004 10:29 pm

Post by mrjoshuanc » Wed Mar 31, 2004 8:24 pm

ahhhh, ok, thank you sirs. =)