Repeating /say command

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

User avatar
Hades0721
a lesser mummy
a lesser mummy
Posts: 31
Joined: Sun Apr 11, 2004 4:57 pm
Contact:

Repeating /say command

Post by Hades0721 » Thu Apr 15, 2004 2:49 am

This is a modified tradeskill macro taken from the macro depot. The changes take advantage of the GoD free tradeskill quests. It Runs fine until it gets to the part where it says the key word. After saying keyword once I can't get it to stop. It moves back to the beginning to start the process over but keeps saying the keyword...

Code: Select all

| ts.mac 

| General purpose macro for automating tradeskills with the new TS interface. 
| Usage:  /macro ts [action on success] [action on failure] [end on trivial] [combines to attempt] 
| Specified actions can be 0 (to destroy) and 1 {to keep) created items. 
| If end on trivial is 1, the macro will end when the items trivial.  (Defaults to 0) 
| This macro will /autoinventory by default, if no switches are provided. 

| Example usage: 
| /macro ts 1 0 1 
| This would keep successful combines, destroy unsuccessful combines, and stop 
| running when the items trivial. 

| Be sure to have selected your recipe and put the mouse over the combine button 
| before running the macro! 

#event NOITEM  "Sorry, but you don't have everything you need for this recipe in your general inventory." 
#event SUCC    "You have fashioned the items together to create something new!" 
#event FAIL    "You lacked the skills to fashion the items together." 
#event TRIV    "You can no longer advance your skill from making this item." 
#event SKILLUP "You have become better at" 
#event EXP     "Tonlyei Lyhin says 'Very well done."

Sub Main 
   /mouseto 325 600     
   /declare SKILLUP      global 

   /declare COMBINEATTM  global 
   /declare COMBINESUCC  global 
   /declare COMBINETRIV  global 
   /declare COMBINESKIL  global 
   /declare COMBINETRY   global 
   /declare COMBINEDONE  global
 
   /declare SUCCACTION   global 
   /declare FAILACTION   global 
   /declare ENDONTRIV    global 
   /declare MOUSECOORD   array 
   
   /declare MerchantName global
   /declare MadeItem     global
   /declare StoryScript  global
   /declare NoHaveItem   global

   /varset MerchantName "Tonlyei"
   /varset MadeItem "Simple Belt"
   /varset StoryScript "chores"
   /varset MOUSECOORD(0) $mouse(x) 
   /varset MOUSECOORD(1) $mouse(y) 
   /varset NoHaveItem 0

   /varset COMBINEATTM 0 
   /varset COMBINESUCC 0 
   /varset COMBINESKIL 0 
   /varset COMBINETRY  0 
   /varset COMBINEDONE 0
    
|**   /if n @Param0=="" { 
      /varset SUCCACTION 1 
      /varset FAILACTION 1 
      /varset ENDONTRIV 0 
      /varset COMBINETRY -5 
   /echo /macro ts [action on success] [action on failure] [end on trivial] [combines to attempt](optional) 
        /echo Example usage: 
        /echo /macro ts 1 0 1 
   /echo This would keep successful combines, destroy unsuccessful combines, and stop running when the items trivial. 
   /delay 30 
   /echo For skillups: /macro ts 1 0 1 
   /echo For mass production: /macro ts 1 1 0 
   /echo For 20 combines: /macro ts 1 1 0 20 
   /delay 5 
   /echo waiting for 260, stop me now or I mass produce 
   /delay 260 
   } else { **|
      /varset SUCCACTION @Param0 
      /varset FAILACTION @Param1 
      /varset ENDONTRIV @Param2 
      /if n @Param3=="" { 
   /varset COMBINETRY -5 
      } else { 
   /varset COMBINETRY @Param3 
      } 
 |  } 

/echo 
/echo -------------------------------------------------------------------------------------- 
/echo TradeSkill Macro activated  
/if n @Param0=="" /echo I will Keep all and not stop 
/if n @Param0==1 /echo I will keep combines 
/if n @Param1==1 /echo I will keep failures 
/if n @Param2==1 /echo I will stop at trivial 
/if n @Param3!="" /echo I will attempt @Param3 combines 
/echo -------------------------------------------------------------------------------------- 
/echo   
/echo WARNING: Containter needs to be open, item 
/echo selected and cursor on the combine button 
    
   :doloop 
      /if n @COMBINETRY!=0 { 
        /mouseto 325 600
        /click left  
        /delay 15 
        /doevents    
        /varset COMBINETRY $int($calc(@COMBINETRY-1)) 
        /goto :doloop 
      } 
    /call EndMacro 
/return 

Sub Event_NOITEM 
|  /varadd COMBINEDONE 1
| /if n @COMBINEDONE==3 {
|   /echo 
|   /echo 
|   /echo Missing one of the required items for this recipe; aborting. 
|   /call EndMacro 
|   } 
/call GiveItems
/return 

Sub Event_FAIL 
   /varadd COMBINEATTM 1 
   /call SortItems @FAILACTION 
/return 

Sub Event_SUCC 
   /varadd COMBINEATTM 1 
   /varadd COMBINESUCC 1 
   /call SortItems @SUCCACTION 
/return 

Sub Event_SKILLUP 
   /varadd COMBINESKIL 1 
/return 

Sub Event_TRIV 
   /if @ENDONTRIV==1 { 
      /echo 
      /echo 
      /echo Item is now trivial: Congratulations! 
      /call EndMacro 
   } 
/return 

Sub GiveItems
/target "@MerchantName"
:giveloop
   /if n $count("@MadeItem")==0 /goto :Done
   /sendkey down ctrl
   /finditem "@MadeItem"
   /click left target
   /delay 1s
|   /mouseto target
 |  /click left  
   :nextitem
   	/finditem "@MadeItem"
	/mouseto npctrade 1
      /click left 
      /delay 1s
   	/finditem "@MadeItem"
	/mouseto npctrade 2
      /click left  
      /delay 1s 
   	/finditem "@MadeItem"
	/mouseto npctrade 3
      /click left 
      /delay 1s
      /mouseto npctrade give 
	/click left 
      /delay 1s
      /goto :giveloop
:Done
/sendkey up ctrl
/doevents EXP
/call EndMacro
/return  

Sub Event_EXP
      /varset NoHaveItem 1
	/call GetItems
/return

Sub GetItems
   /if n @NoHaveItem==1 {
   	/say "@StoryScript"
   	/delay 1s
   	/autoinventory
   	/autoinventory
  	/autoinventory
   	/autoinventory
   	/varset NoHaveItem 0
   }
/call Main
/return

Sub SortItems 
   :itemloop 
   /if $cursor()!="NULL" { 
      /if n @Param0==1 { 
         /autoinventory 
      } else { 
         /destroy 
      } 
      /delay 5 
      /goto :itemloop 
   } 
/return 

Sub EndMacro 
   /echo 
   /echo 
   /echo 
   /echo 
   /echo -------------------------------------------------------------------------------------- 
   /echo Total time running:     $running 
   /echo Combines Attempted:     @COMBINEATTM 
   /echo Combines Successfull:   @COMBINESUCC 
   /echo Success rate:           $int($calc(@COMBINESUCC/@COMBINEATTM*100))% 
   /if n @COMBINESKIL>0 /echo Combines per skillup:   $int($calc(@COMBINEATTM/@COMBINESKIL)) 
   /echo -------------------------------------------------------------------------------------- 
   /endmacro 
/return 


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

Post by daerck » Thu Apr 15, 2004 5:57 am

Haven't done the quest mself but I assume your error is this:

Code: Select all

Sub Event_EXP 
      /varset NoHaveItem 1 
   /call GetItems 
/return 

Sub GetItems 
   /if n @NoHaveItem==1 { 
      /say "@StoryScript" 
      /delay 1s 
      /autoinventory 
      /autoinventory 
     /autoinventory 
      /autoinventory 
      /varset NoHaveItem 0 
   } 
/call Main 
/return 
a) /call Main is bad
b) If you recieve experience for saying the StoryScript text the next /doevents (in Sub Main) will trigger the Sub Event_ EXP again, which will trigger GiveItems again, rinse repeat.
c) change your /mouseto, /click and /sendkey to /notify, /itemnotify and /keypress.

User avatar
Hades0721
a lesser mummy
a lesser mummy
Posts: 31
Joined: Sun Apr 11, 2004 4:57 pm
Contact:

Post by Hades0721 » Thu Apr 15, 2004 11:43 am

Fixed it. Updated macro is in Macro Depot.