Need Help Modifying Script

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

Sephin
orc pawn
orc pawn
Posts: 25
Joined: Fri Nov 28, 2003 2:33 pm

Need Help Modifying Script

Post by Sephin » Tue Jan 20, 2004 10:19 pm

I need to add something to the twist script found at http://macroquest2.com/phpBB2/viewtopic.php?t=4949 , created by Raebis.

Code: Select all

| stwist.mac - SimpleTwist by Raebis 
| Version: REV1 Jan 13 18:45 
| 
| usage: /mac stwist <Songs> 
| 
| This example will twist the songs in gems 3, 4, 5, and 6: 
| /mac stwist 3456 
| 
| You can also use it to twist a song only once every other twist, i.e.: 
| /mac stwist 2345345 
| 

#turbo 

Sub Main(SongBlock) 
   /zapvars 
   /declare SongTimer timer 
   /declare Songs array 
   /declare CurSong global 
   /declare PrevSong global 
   /declare nSongs global 
   /declare EachSong local 

   /varset nSongs $strlen(@SongBlock) 
   /for EachSong 1 to @nSongs 
      /varset Songs(@EachSong) $mid($calc(@EachSong-1),1,@SongBlock) 
      /echo Song @EachSong: $char(gem,@Songs(@EachSong)) 
   /next EachSong 

   /varset CurSong 1 

   /call Event_Timer 
   :Loop 
   /doevents 
   /if $char(casting)==FALSE { 
      /varset CurSong @PrevSong 
      /call Event_Timer 
   } 
   /goto :Loop 
/return 

Sub Event_Timer(TimerName) 
      /delay 2 
      /stopsong 
      /cast @Songs(@CurSong) 
      /varset PrevSong @CurSong 
      /varset SongTimer 30 
      /varadd CurSong 1 
      /if n @CurSong>@nSongs /varset CurSong 1 
/return
I was just wondering how I could add a portion to takes tells or group chat or channel chat as commands.

Like Joe tells the group," twist 165"

It will have the bard do /mac twist 165, etc. Is this possible? I can not think of how to do it. Maybe set an #event for "joe tells the group" and twist then #s. I don't know =(

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

Post by wilso132 » Tue Jan 20, 2004 11:59 pm

Completely untested and thrown together in 2 seconds, but maybe it'll give ya an idea of where to start.

Code: Select all

| stwist.mac - SimpleTwist by Raebis 
| Version: REV1 Jan 13 18:45 
| 
| usage: /mac stwist <Songs> 
| 
| This example will twist the songs in gems 3, 4, 5, and 6: 
| /mac stwist 3456 
| 
| You can also use it to twist a song only once every other twist, i.e.: 
| /mac stwist 2345345 
| 

#turbo 
[color=red]#chat chat [/color]

Sub Main(SongBlock) 
[color=red]  :Main_Loop[/color]
   /zapvars 
   /declare SongTimer timer 
   /declare Songs array 
   /declare CurSong global 
   /declare PrevSong global 
   /declare nSongs global 
[color=red]   /declare SongsToSing global[/color]
   /declare EachSong local 
  

[color=red]   /varset SongsToSing @SongBlock[/color]
   /varset nSongs $strlen[color=red](@SongsToSing [/color]) 
   /for EachSong 1 to @nSongs 
      /varset Songs(@EachSong) $mid($calc(@EachSong-1),1[color=red],@SongsToSing[/color]) 
      /echo Song @EachSong: $char(gem,@Songs(@EachSong)) 
   /next EachSong 

   /varset CurSong 1 

   /call Event_Timer 
   :Loop 
   /doevents 
   /if $char(casting)==FALSE { 
      /varset CurSong @PrevSong 
      /call Event_Timer 
   } 
   /goto :Loop 
/return 

Sub Event_Timer(TimerName) 
      /delay 2 
      /stopsong 
      /cast @Songs(@CurSong) 
      /varset PrevSong @CurSong 
      /varset SongTimer 30 
      /varadd CurSong 1 
      /if n @CurSong>@nSongs /varset CurSong 1 
/return 

[color=red]Sub Event_Chat(Type,Sender,Text) 
      /if @Text~~"TWIST" {
        /varset SongsToSing $right(6,@Text)
        /goto :Main_Loop
/return[/color]