Bard Twisting Macro.

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

Gabriela
decaying skeleton
decaying skeleton
Posts: 5
Joined: Mon Jan 05, 2004 6:12 pm

Bard Twisting Macro.

Post by Gabriela » Mon Jan 05, 2004 6:18 pm

Twist2.mac doesn't work for me. If I /macro Twist2 123 456 it will twist 123 in noncombat mode flawlessly. When I hit autoattack after one round of singing (once through the songs) it will sing song 4, start 5 and stop it short. Then it starts 6 and stops it short, not even close to being done. Then it goes back to 4 and lets it run through fully. I don't know why it doesn't work for me.

That having been said I've tried to come up with my own solution. I can get it to twist songs 1, 2 and 3. I just can't get it to detect Missed notes or "You haven't rocovered yet..." messages. Could someone help me and maybe clean up my code? I know it is very rudamentary but it's the best I can do.

Code: Select all

| Please work
#turbo 10
#event MissedNote "You miss a note, bringing your song to a close!" 
#event Recovered "You haven't recovered yet..." 

Sub Main 
    /declare song global
    /varset song 1
    :Top
    /if @song==1 {
      /stopsong
      /cast 1
      /doevents 
      /delay 33
      /varset song 2
    }
    /if @song==2 {
      /stopsong
      /cast 2
      /doevents 
      /delay 33
      /varset song 3
    }
    /if @song==3 {
      /stopsong
      /cast 3
      /doevents 
      /delay 33
      /varset song 1
    }
    /goto :Top
/return

Sub MissedNote
    /if @song==1 {
      /stopsong
      /cast 1
      /delay 33
      /varset song 2
    }
    /if @song==2 {
      /stopsong
      /cast 2
      /delay 33
      /varset song 3
    }
    /if @song==3 {
      /stopsong
      /cast 3
      /delay 33
      /varset song 1
    }
/return

Sub Recovered
    /if @song==1 {
      /stopsong
      /cast 1
      /delay 33
      /varset song 2
    }
    /if @song==2 {
      /stopsong
      /cast 2
      /delay 33
      /varset song 3
    }
    /if @song==3 {
      /stopsong
      /cast 3
      /delay 33
      /varset song 1
    }
/return

Raebis
a ghoul
a ghoul
Posts: 81
Joined: Fri Dec 12, 2003 6:23 am

Post by Raebis » Tue Jan 06, 2004 12:13 am

k here it is, sloppy and i dunno if it works
but here we go

Code: Select all

| - twisty.mac - By Raebis
| Version: RELEASE Jan 05 2004
|
| This mac is used to twist songs together
| Uses 2 blocks of songs, the first one for when resting
| the second for when attacking
|
| usage: /mac twisty <RestSongs> <AttackSongs>
|
| usage examples:
| 
| .../mac twisty 342 5836
| would twist songs 243 durring downtime and 5836 while attacking
|
| Was special request for gobbi
|
Sub Main(SB1,SB2)

   /declare rSongs global 
   /declare aSongs array 

   /declare rNumSongs global
   /declare aNumSongs global

   /declare CurSong global 
   /declare PrevSong global 
   
   /declare CombatCount global
   /declare CombatStat global

   /declare tCasting timer

   /varset rNumSongs $strlen(@SB1)
   /varset aNumSongs $strlen(@SB2) 

   /declare EachSong local
   
   /for EachSong 1 to @rNumSongs
      /varset rSongs(@EachSong) $mid($calc(@EachSong-1),1,@SB1) 
      /echo Rest Song @EachSong: $char(gem,@Songs(@EachSong)) 
   /next EachSong

   /for EachSong 1 to @aNumSongs
      /varset aSongs(@EachSong) $mid($calc(@EachSong-1),1,@SB2)
      echo Attack Song @EachSong: $char(gem,@Songs(@EachSong))
   /next EachSong
 
   /varset tCastin 1
 
:Loop

   /if n @tCasting<28 /if $char(casting)==FALSE /call SongFailed
   /doevents

   /if $combat==FALSE then
      /varadd CombatCount 1
      /if @CombatCount>=8 {
         /varset CombatCount 8
         /varset CombatState 0
      }
   } else {
      /varset CombatState 1
   }
   /goto :Loop
/return

Sub Event_Timer(TimerName) 
   /if @TimerName==SongTimer { 
      /delay 2 
      /stopsong 
      /if n @CombatState=0 {
         /cast @rSongs(@CurSong) 
      } else {
         /case @aSongs(@CurSong)
      }
      /varset PrevSong @CurSong 
      /varadd CurSong 1 
      /if n @CurSong>@nSongs /varset CurSong 1 
      /varset SongTimer 30 
   } 
/return 

Sub SongFailed 
   /varset CurSong @PrevSong 
   /varset SongTimer 0 
/return
k, if you have an instrument in primary hand, macroquest won't know if u are attacking or not

edit: k edited for a coiuple of fxes
Always say what you want to say. Because those who mind, don't matter. And those who matter, don't mind.

Gabriela
decaying skeleton
decaying skeleton
Posts: 5
Joined: Mon Jan 05, 2004 6:12 pm

Post by Gabriela » Tue Jan 06, 2004 12:46 am

Code: Select all

   /for EachSong 1 to @rNumSongs 
      /varset rSongs(@EachSong) $mid($calc(@EachSong-1),1,@SB1) 
      /echo Rest Song @EachSong: $char(gem,@Songs(@EachSong)) 
   /next EachSong 

   /for EachSong 1 to @aNumSongs 
      /varset aSongs(@EachSong) $mid($calc(@EachSong-1),1,@SB2) 
      echo Attack Song @EachSong: $char(gem@Songs(@EachSong)) 
   /next EachSong 
[code]

I am pretty sure MQ does not like the above two lines.

Raebis
a ghoul
a ghoul
Posts: 81
Joined: Fri Dec 12, 2003 6:23 am

Post by Raebis » Tue Jan 06, 2004 1:43 am

yesh, the line is:

Code: Select all

echo Attack Song @EachSong: $char(gem@Songs(@EachSong)) 
needs a comma after gem

thats all, i already fixed that tho
Always say what you want to say. Because those who mind, don't matter. And those who matter, don't mind.

Gabriela
decaying skeleton
decaying skeleton
Posts: 5
Joined: Mon Jan 05, 2004 6:12 pm

Post by Gabriela » Tue Jan 06, 2004 4:22 am

This is the error that I get now:

Ending macro. Bad variable in /var function.
twisty.mac@40 (Main(SB1,SB2)): /varset rSongs(@EachSong) $mid($calc(@EachSong-1),1,@SB1)
Cleared the following: Timers Vars Arrays

koad
Plugins Czar
Posts: 127
Joined: Fri May 16, 2003 8:32 pm

Post by koad » Tue Jan 06, 2004 4:28 am

mmm I believe

Code: Select all

/declare rSongs global 
should be

Code: Select all

/declare rSongs array 
that should fix that problem.

Gabriela
decaying skeleton
decaying skeleton
Posts: 5
Joined: Mon Jan 05, 2004 6:12 pm

Post by Gabriela » Tue Jan 06, 2004 6:22 am

Here is one I made tonight!

Code: Select all

| Twist.mac by Gabriela
| version date - Tuesday January 6 2004 -- 05:14 -06:00
|
| After some help from dont_know_at_all and Raebis on IRC this
| is what I was able to throw together.  It requires/accepts no
| command line input.  All it does is twist three songs reguardless
| of player state.  It will twist while resting, fight and even
| attempt to twist while seated.  I might change it but for now
| until I learn more about MQ scripting it does what I want it to
| do.
|
| It can be made to twist four songs with some tinkering.  For me
| to twist four here is what I change:
|   /if n @Song==3 {    ->    /if n @Song==4 {
|   /varset Watch 31    ->    /varset Watch 30
|   /delay 7            ->    /delay 5
#turbo 15

Sub Main 
  /zapvars
  /declare Song global
  /declare Watch timer
  /varset Song 1
  :Loop
  /if n @Song==3 {
    /call Cast @Song
    /varset Song 1
    /goto :Loop
  }
  /call Cast @Song
  /varset Song $calc(@Song+1)
  /goto :Loop
/return 

Sub Cast
  :Start
  /stopsong
  /cast @Param0
  /varset Watch 31
  :Check
  /delay 7
  /if n @Watch==0 /goto :End
  /if $char(casting)=="FALSE" /goto :Start
  /if n @Watch>0 /goto :Check
  :End
/return