need help with this Twist2

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

dragontat0
decaying skeleton
decaying skeleton
Posts: 7
Joined: Tue Dec 02, 2003 7:26 am

need help with this Twist2

Post by dragontat0 » Fri Dec 26, 2003 12:07 am

This i have tried using but it doesnt want to work:


| Twist2.mac Flexible bard song twister using timers by BrainDozer.
| Updated by Drax.
|
| Syntax: /macro Twist2.mac [block 1] [block 2]
|
| Parameter block 1 indicates non-combat songs
| Parameter block 2 indicates combat songs
|
| Choose any combination of songs in any sequance to twist for each mode.
|
| Example: /macro Twist2.mac 256 1234234
|
| This would repeat songs 2, 5 and 6 durring non-combat and songs 1, 2, 3
| and 4 in the above sequence while in combat. In this instance, song 1
| is only twisted 1 for 7, which comes in handy for long duration songs
| like amplification.
|
| Other Examples: /macro Twist2.mac 0 123 | Twists on attack only
| /macro Twist2.mac 12345 0 | non-attack twisting only
| /macro Twist2.mac 12345 | same as above
| /macro Twist2.mac 9804 11 | twists 84 and 1
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
#turbo 10
#event MissedNote "You miss a note, bringing your song to a close!"
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
Sub Main
/zapvars
/declare CSong global | keeps track of current song number 1-max
/declare CSongf global | break and play song toggle (break=0 play=1)
/declare attack global | debug: @combat glitch work-around
/declare CSongt timer | break and play song timer
/declare attackct timer | debug: @combat glitch work-around check timer
/declare v90 global
/declare v91 global
/declare l0 global
/declare l1 global
/declare l2 global
/declare l3 global
/declare a array2
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
/stopsong
/call initVars @Param0 @Param1
:Mainloop
/if @attackct==0 /if $combat==TRUE /if @attack==0 /call AttackOn
/if @attackct==0 /if $combat==FALSE /if @attack==1 /call AttackOff
/if @attackct==0 /varset attackct 10 | adjustable attack check delay
| Debug: work-around
/if n @v9@attack!=-1 /if $char(state)==STAND /call TwistSong @attack
/doevents
/goto :Mainloop
/return
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
Sub TwistSong
/if @CSong>@v9@Param0 /varset CSong 0 | Restart twist when end of list
/if (@CSongf==0 && @CSongt==0) /call TS2 @Param0 | Start next song in list
/if (@CSongf==1 && @CSongt==0) /call TS3 | Stop song and advance index
/return | Debug: conditionals wern't playing nice with brackets
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
Sub TS2
/cast @a(@Param0,@CSong)
/varset CSongf 1
/varset CSongt 35 | adjustable play delay
/return
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
Sub TS3
/stopsong
/varset CSong $int($calc(@CSong+1)) | Debug: Force integer
/varset CSongf 0
/varset CSongt 1 | adjustable break delay
/return
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
Sub initVars
/if @Param1=="" /varset Param1 "0"
/varset v90 0 | v90,v91 max song index lengths
/varset v91 0 | l0 combat mode index
/for l0 0 to 1 | l1 parameter index
/for l1 0 to $int($calc($strlen(@Param@l0)-1)) | l2 hold
/varset l2 $mid(@l1,1,@Param@l0)
/varset l3 @v9@l0 | Debug: array didn't like the fancy stuff
/if (@l2>=1 && @l2<=8) /varset a(@l0,@l3) @l2 | Debug: Bracket trouble
/if (@l2>=1 && @l2<=8) /varset v9@l0 $int($calc(@v9@l0+1))
/next l1 | Debug: it thinks it's a float-forcing
/next l0
/varset v90 $int($calc(@v90-1)) | over increment fix
/varset v91 $int($calc(@v91-1)) |
/varset CSong 0
/varset CSongt 0
/varset CSongf 0
/if $combat==TRUE /varset attack 1 | debug: inital combat values
/if $combat==FALSE /varset attack 0 |
/return
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
Sub AttackOn
/stopsong
/varset attack 1
/varset CSong 0 | reset sequence
/varset CSongt 0 | attack mode twist start delay
/varset CSongf 0 | force play mode
/return
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
Sub AttackOff
/stopsong
/varset attack 0
/varset CSong 0 | reset sequence
/varset CSongt 0 | attack off mode twist start delay
/varset CSongf 0 | force play mode
/return
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
Sub Event_MissedNote
/varset CSongt 0 | missed note try again delay
/varset CSongf 0 | switch back to play mode
/return



and i get this error:

Q2Twist2.cpp
C:\Program Files\MQ2-Latest\Twist2\MQ2Twist2.cpp(1) : error C2143: syntax error : missing ';' before '|'
C:\Program Files\MQ2-Latest\Twist2\MQ2Twist2.cpp(4) : error C2143: syntax error : missing ';' before '/'
C:\Program Files\MQ2-Latest\Twist2\MQ2Twist2.cpp(11) : error C2143: syntax error : missing ';' before '/'
C:\Program Files\MQ2-Latest\Twist2\MQ2Twist2.cpp(18) : error C2143: syntax error : missing ';' before '/'
C:\Program Files\MQ2-Latest\Twist2\MQ2Twist2.cpp(24) : fatal error C1021: invalid preprocessor command 'turbo'
Error executing cl.exe.

MQ2Twist2.dll - 5 error(s), 0 warning(s)

can someone give me a valid up to date Twist2 please i need it for my 65 bard? Thanks





or is it obsolete because i need a twist macro

User avatar
wilso132
Contributing Member
Contributing Member
Posts: 106
Joined: Thu Oct 17, 2002 11:53 am

Post by wilso132 » Fri Dec 26, 2003 1:49 am

Gonna basically copy and paste the same thing I did on Twist2 post in the Depot.

Me and my friends have a bard at our disposal we'd like to use to slow the mob and haste the group, but not actually go up and attack (seeing as how it's 2 beasts and a shammy... he'd grab aggro). So I modified the code to send it the person you want to assist. This way he knows to slow a mob once it gets under 95%. If you leave the field blank, it also works like normal Twist2... which helps me use the same macro for 2 different purposes (either bot'ing or playing). Sorry if the code is sloppy... never claimed to be an expert.
Usage:
/macro Twist2 [non-combat songs] [combat songs] [person to assist]
e.g. /macro Twist2 123 456 wilso132
or
/macro Twist2 123 456 for use as normal

Code: Select all

| Twist2.mac  Flexible bard song twister using timers by BrainDozer. 
| Updated by Drax. 
| Assist feature added by wilso132.
| 
|   Syntax:  /macro Twist2.mac [block 1] [block 2] [block 3] 
| 
|     Parameter block 1 indicates non-combat songs 
|     Parameter block 2 indicates combat songs 
|     Parameter block 3 indicates target to assist
| 
|   Choose any combination of songs in any sequence to twist for each mode. 
| 
|     Example:  /macro Twist2.mac 256 1234234 wilso132
| 
|   This would repeat songs 2, 5 and 6 durring non-combat and songs 1, 2, 3 
|   and 4 in the above sequence while in combat.  In this instance, song 1 
|   is only twisted 1 for 7, which comes in handy for long duration songs 
|   like amplification. 
| 
|     Other Examples: /macro Twist2.mac 0 123      | Twists on attack only 
|                     /macro Twist2.mac 12345 0    | non-attack twisting only 
|                     /macro Twist2.mac 12345      | same as above 
|                     /macro Twist2.mac 9804 11    | twists 84 and 1 
|          /macro Twist2.mac 9804 11 wilso132 | same as above but assists “wilso132”
| 
|||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||| 
#turbo 10 
#event MissedNote "You miss a note, bringing your song to a close!" 
|||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||| 
Sub Main 
/zapvars 
/declare CSong  global   | keeps track of current song number 1-max 
/declare CSongf global   | break and play song toggle (break=0 play=1) 
/declare attack global   | debug: @combat glitch work-around 
/declare CSongt timer    | break and play song timer 
/declare attackct timer  | debug: @combat glitch work-around check timer 
/declare v90 global 
/declare v91 global 
/declare l0 global 
/declare l1 global 
/declare l2 global 
/declare l3 global 
/declare a array2 
/declare person_to_assist global
/declare need_to_assist global
|||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||| 
  /stopsong 
  /if @Param2~~"Param2" {
    /varset need_to_assist 0
    /echo Not assisting anyone, just twisting.
    } else {
    /varset person_to_assist @Param2
    /echo You will now be assisting @person_to_assist
   /varset need_to_assist 1 }

   /call initVars @Param0 @Param1
  
  :Mainloop 
     
     /if @need_to_assist==1 /if $target(type)=="NPC" /assist @person_to_assist
            /if n $target(hp,pct)<=95 /if n $target(distance)<100 { 
          /attack on}
     } else {
       /attack off
     }
     /if @attackct==0 /if $combat==TRUE /if @attack==0 /call AttackOn 
     /if @attackct==0 /if $combat==FALSE /if @attack==1 /call AttackOff 
     /if @attackct==0 /varset attackct 10     | adjustable attack check delay 
                                                           | Debug: work-around 
     /if n @v9@attack!=-1 /if $char(state)==STAND /call TwistSong @attack 
     /doevents 
  /goto :Mainloop 
/return 
|||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||| 
Sub TwistSong 
   /if @CSong>@v9@Param0 /varset CSong 0               | Restart twist when end of list 
   /if (@CSongf==0 && @CSongt==0) /call TS2 @Param0    | Start next song in list 
   /if (@CSongf==1 && @CSongt==0) /call TS3        | Stop song and advance index 
/return                          | Debug: conditionals wern't playing nice with brackets 
|||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||| 
Sub TS2 
   /cast @a(@Param0,@CSong) 
   /varset CSongf 1 
   /varset CSongt 35                     | adjustable play delay 
/return 
|||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||| 
Sub TS3 
   /stopsong 
   /varset CSong $int($calc(@CSong+1))   | Debug: Force integer 
   /varset CSongf 0 
   /varset CSongt 1                      | adjustable break delay 
/return 
|||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||| 
Sub initVars 
  /if @Param1=="" /varset Param1 "0" 
  /varset v90 0                                  | v90,v91 max song index lengths 
  /varset v91 0                                  | l0 combat mode index 
  /for l0 0 to 1                                 | l1 parameter index 
      /for l1 0 to $int($calc($strlen(@Param@l0)-1)) | l2 hold 
        /varset l2 $mid(@l1,1,@Param@l0) 
   /varset l3 @v9@l0              | Debug: array didn't like the fancy stuff 
        /if (@l2>=1 && @l2<=8) /varset a(@l0,@l3) @l2  | Debug: Bracket trouble 
   /if (@l2>=1 && @l2<=8) /varset v9@l0 $int($calc(@v9@l0+1)) 
     /next l1                            | Debug: it thinks it's a float-forcing 
  /next l0  
  /varset v90 $int($calc(@v90-1))   | over increment fix 
  /varset v91 $int($calc(@v91-1))   | 
  /varset CSong 0 
  /varset CSongt 0 
  /varset CSongf 0 
  /if $combat==TRUE /varset attack 1    | debug: inital combat values 
  /if $combat==FALSE /varset attack 0   | 
/return 
|||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||| 
Sub AttackOn 
   /stopsong 
   /varset attack 1 
   /varset CSong 0               | reset sequence 
   /varset CSongt 0              | attack mode twist start delay 
   /varset CSongf 0              | force play mode 
/return 
|||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||| 
Sub AttackOff 
   /stopsong 
   /varset attack 0 
   /varset CSong 0               | reset sequence 
   /varset CSongt 0              | attack off mode twist start delay 
   /varset CSongf 0              | force play mode 
/return 
|||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||| 
Sub Event_MissedNote 
   /varset CSongt 0              | missed note try again delay 
   /varset CSongf 0              | switch back to play mode 
/return 

Last edited by wilso132 on Fri Dec 26, 2003 5:36 pm, edited 1 time in total.

User avatar
wilso132
Contributing Member
Contributing Member
Posts: 106
Joined: Thu Oct 17, 2002 11:53 am

Post by wilso132 » Fri Dec 26, 2003 1:52 am

Also I just noticed you tried using Twist2.cpp... these aren't cpp files, they don't need to be compiled. They are add-on files with a .mac (macro) extension.

To use a macro you need to open up the macro folder (in Release-> Macro) and make a new one. The easiest way to is to copy and paste and existing one, then rename it say Twist2.mac.

After that, right click Twist2.mac and click Open With... choose notepad, or wordpad, or Word... whatever you like. Then copy and paste the macro code found here into your new .mac file. Save it and then you're good to use it in game.

wassup
Official Guardian and Writer of TFM
Official Guardian and Writer of TFM
Posts: 1487
Joined: Sat Oct 26, 2002 5:15 pm

Post by wassup » Fri Dec 26, 2003 2:29 am

Why is this being discussed in the Plugin Development section?

dragontat0
decaying skeleton
decaying skeleton
Posts: 7
Joined: Tue Dec 02, 2003 7:26 am

thanks

Post by dragontat0 » Fri Dec 26, 2003 2:34 am

Thanks

User avatar
wilso132
Contributing Member
Contributing Member
Posts: 106
Joined: Thu Oct 17, 2002 11:53 am

Post by wilso132 » Fri Dec 26, 2003 2:37 am

Wassup wrote:Why is this being discussed in the Plugin Development section?
Maybe because he thought it was a .cpp file? :lol:

wassup
Official Guardian and Writer of TFM
Official Guardian and Writer of TFM
Posts: 1487
Joined: Sat Oct 26, 2002 5:15 pm

Post by wassup » Fri Dec 26, 2003 5:59 am

hehehe...

I just now saw the bottom of the first post.

I thought he came her eto get help with a macro that wasn't working.

Compiling a .mac... that's a new one on me!

Virtuoso65
a hill giant
a hill giant
Posts: 150
Joined: Wed Oct 15, 2003 2:29 pm

Post by Virtuoso65 » Fri Dec 26, 2003 8:21 am


dragontat0
decaying skeleton
decaying skeleton
Posts: 7
Joined: Tue Dec 02, 2003 7:26 am

doesnt work

Post by dragontat0 » Fri Dec 26, 2003 11:29 am

hey ,when i try to macro it tells me it cant open the Twist2.mac file ,can you tell me why?

User avatar
wilso132
Contributing Member
Contributing Member
Posts: 106
Joined: Thu Oct 17, 2002 11:53 am

Post by wilso132 » Fri Dec 26, 2003 12:43 pm

Three things that are possibly wrong:
1- You don't have Twist2.mac in your "Macro" directory (in the Release-> Macro folder).
2- You didn't named it Twist2.mac and named it something else.
3- Your Twist2.mac doesn't have a .mac extension and has something else, possibly .txt.

My guess would be one of the first two.

dragontat0
decaying skeleton
decaying skeleton
Posts: 7
Joined: Tue Dec 02, 2003 7:26 am

Post by dragontat0 » Fri Dec 26, 2003 3:03 pm

well i renamed it from Twist2.mac to just Twist2 and it got it running just now it fails to parse /if command? i dont even know what that means im not a programmer

Virtuoso65
a hill giant
a hill giant
Posts: 150
Joined: Wed Oct 15, 2003 2:29 pm

Post by Virtuoso65 » Fri Dec 26, 2003 3:56 pm

Unless you have the show full file extensions turned on... when you named the file "twist2.mac" you were in actuality calling it "twist2.mac.mac".

Try to be more specific about the "/if" error but it sounds like user error to me.

User avatar
wilso132
Contributing Member
Contributing Member
Posts: 106
Joined: Thu Oct 17, 2002 11:53 am

Post by wilso132 » Fri Dec 26, 2003 5:23 pm

Edit: Fixed my above code and in the depot, you should no longer get an error parsing message.


If he's using the code I posted it might be popping up that error. I never got around to fixing it because it didn't influence the program at all.