can't save

Help section from before the user variable changes that broke all macros

Moderator: MacroQuest Developers

monkey pox
decaying skeleton
decaying skeleton
Posts: 1
Joined: Wed Sep 17, 2003 3:56 am

can't save

Post by monkey pox » Wed Sep 17, 2003 3:59 am

I used the recently posted Yet Another Tradeskill Mac to make this macro:

Code: Select all

#turbo 2

#define CombinerPack v97 
#define IngredSize v98 

#chat tell 

Sub Main 
    /press ctrl 
    /press alt 
    /press shift 

    /varset IngredSize 0 

    /call AddIngred "celestial solvent"  | List of ingredients.  The AddIngred 
    /call AddIngred "the scent of marr"     | subroutine automatically sets the index. 
    

    /call FindCombiner "mortar and pestle"    | Name of the container to combine in. 
                                 | It's highly recommented to put the combine 
                                 | container in slot 7. 

    /echo $CombinerPack 

    :RunMake 

    /press shift 
    /sendkey down ctrl 
    /delay 5 
    /for v99 0 to $v90 
        /if $pack($p0,empty)==FALSE { 
            /call ClearPack 
            /press shift 
            /sendkey down ctrl 
        } 
        /call ClearCursor 

        /finditem "$a(0,$v99)" 
        /delay 5 
        /if $find()==FALSE { 
            /goto :Done 
        } 
        /click left pack $CombinerPack $v99 
        /delay 5 
    /next v99 

    /click left pack $CombinerPack combine 
    /doevents 
    /goto :RunMake 

    :Done 
/return 

Sub ClearCursor 
    :Start 
        /if $cursor()!=NULL { 
            /click left auto 
            /delay 5 
        } 
        /delay 0 
    /if $cursor()!=NULL /goto :Start 
/return 

Sub ClearPack 
    /call ClearCursor 

    /if $pack($p0,empty)==TRUE /goto :Finished 
    :ReClear 
    /press ctrl 
    /sendkey down shift 

    /varcalc v50 $pack($p0,slots)-1 
    /delay 5 
    /for v99 0 to $v50 
        /click left pack $p0 $v99 
        /delay 5 
        /call ClearCursor 
    /next v99 
    /if $pack($p0,empty)==FALSE /goto :ReClear 

    :Finished 
/return 

Sub AddIngred 
    /varset v90 $IngredSize 
    /varset a(0,$IngredSize) "$p0" 
    /varcalc IngredSize $IngredSize+1 
    /echo $p0 
/return 

Sub FindCombiner 
    /varset CombinerPack 99 
    /for v99 0 to 7 
        /if "$pack($v99,name)"=="$p0" /varset CombinerPack $v99 
    /next v99 

    /if $CombinerPack==99 { 
        /echo No container named "$p0" found. 
        /endmacro 
    } 
/return $CombinerPack 

Sub Event_Chat 
    /endmacro 
/return
And I am unable to save it with MacroEdit. I get the Error:

Run-time Error '5':

Invalid procedure or call argument


Any idea what is wrong? Is it something wrong with my macro or the editor?

edit: Valerian likes code brackets.

User avatar
Curious
a ghoul
a ghoul
Posts: 88
Joined: Wed Aug 27, 2003 5:19 am

Post by Curious » Wed Sep 17, 2003 9:53 am

Not sure about the error you are getting, but saw a couple things that caught my attention:

Code: Select all

/if $pack([b]$p0[/b],empty)==FALSE {
   /call ClearPack
   /press shift
   /sendkey down ctrl
}
[b]/call ClearCursor[/b]
Do you pass the combiner name when calling the macro AND specifically set it to "mortar and pestle"? Or is the $p0 trying to read the /return $CombinerPack in your FindCombiner routine? I think $return is what does that.

Seems like the call to ClearCursor should come before the call to ClearPack ... what happens if you have something on your cursor and your pack has stuff too?

In Sub AddIngred, you have:

Code: Select all

/varcalc IngredSize $IngredSize+1
Might be better as:

Code: Select all

/varadd IngredSize 1
In Sub FindCombiner:

Code: Select all

/if $CombinerPack==99 {
Should be:

Code: Select all

/if n $CombinerPack==99 {
Hope I helped ... good luck

User avatar
Slice
a hill giant
a hill giant
Posts: 189
Joined: Wed Oct 30, 2002 2:52 pm

Post by Slice » Wed Sep 17, 2003 11:20 am

Not familiar with your editor but the first thing I'd check is if the destination file is set to read only.

Slice