Yet Another Tradeskill Macro.

Macro depository for macros written before the user variable changes that broke all of them.

Moderator: MacroQuest Developers

Pigeon
orc pawn
orc pawn
Posts: 22
Joined: Fri May 16, 2003 9:43 pm

Yet Another Tradeskill Macro.

Post by Pigeon » Thu May 29, 2003 4:51 am

I realize this has been done better before, but this is nice and simple and I wanted to teach myself this stuff. Good luck.

Code: Select all

|   TradeSkill.mac - rudimentary tradeskill macro,
|       now that /finditem works.  ATM it doesn't support
|       enviro containers.  ALL containers in your inventory
|       must be already open, and cannot have been moved
|       since they were opened.  You may need to change the
|       /delay 5 commands to something higher depending on
|       your video and net lag.  Customizing it to a different
|       recipe is quite easy- just replace the AddIngred
|       lines with your own ingredients and replace the
|       FindCombiner line with the name of the container you're
|       using.  It's recommended you put the container you're
|       going to combine in in slot 7 so products don't stack up
|       in it.

#turbo

#define CombinerPack v97
#define IngredSize v98

#chat tell

Sub Main
    /press ctrl
    /press alt
    /press shift

    /varset IngredSize 0

    /call AddIngred "lion meat"  | List of ingredients.  The AddIngred
    /call AddIngred "Cheese"     | subroutine automatically sets the index.
    /call AddIngred "loaf of bread"
    /call AddIngred "non-stick frying pan"

    /call FindCombiner "spit"    | 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
Last edited by Pigeon on Thu May 29, 2003 6:12 pm, edited 1 time in total.

Mckorr
Developer
Developer
Posts: 2326
Joined: Fri Oct 18, 2002 1:16 pm
Location: Texas

Post by Mckorr » Thu May 29, 2003 8:03 am

When you say "put the combiner in slot 7", are you referring to the last inventory slot? I'm assuming such, since the slots are numbered 0-7 instead of 1-8.
MQ2: Think of it as Evolution in action.

Pigeon
orc pawn
orc pawn
Posts: 22
Joined: Fri May 16, 2003 9:43 pm

Post by Pigeon » Thu May 29, 2003 2:02 pm

Yes.

MajikL_p00p
orc pawn
orc pawn
Posts: 25
Joined: Sat Aug 31, 2002 1:57 am

Post by MajikL_p00p » Thu May 29, 2003 8:00 pm

Is there any way to use this with a forge?

Jaerin
Developer
Developer
Posts: 133
Joined: Mon Mar 10, 2003 7:37 pm
Contact:

Post by Jaerin » Thu May 29, 2003 9:19 pm

You might actually be able to speed this up a bit by using the cursor() function.

I setup functions like this: (Stolen from the doco)

Code: Select all

:ItemOnCursor
     /varset t1 5
     :ItemOnLoop
     /delay 0
     /if $cursor()!=TRUE /if n $t1>0 /goto :ItemOnLoop
/return

:ItemNotOnCursor
     /varset t2 5
     :ItemOnLoop
     /delay 0
     /if $cursor()==TRUE /if n $t2>0 /goto :ItemOnLoop
/return
Just call these whenever you want to see if it's done picking up or dropping something. Then you don't need to define an actual delay. It will automatically delay until the action happens. Only time this really doesn't work is when buying/selling something because the item never goes on your cursor. For that, again from the doco, I check my money for a change.

This will allow you to speed it up tremendously. Now I have noticed that for whatever reason /finditem is occasionally missing clicks. I'm not sure why, but it is.

Jaerin

alcor75
a lesser mummy
a lesser mummy
Posts: 77
Joined: Wed Jan 29, 2003 7:35 am

Post by alcor75 » Fri May 30, 2003 2:22 am

Firs let me say that this macro is very wery usefull, tnx alot for it.
Now you can use any combiner you want (in inventary or enviromental) just puting any combiner you want into the inventary slot 7 (i use a Collapsible sewing, kit but you may want to chose a 10 slot combiner like a large tool box, and muving the real container you going to use to the same location of the bag nr 7(just be sure to put the combine button at the same location and all the slot too), and keeping the bag nr 7 closed.
Put the name of the bag nr 7 in the macro and there you go, it put the item in the extern enviromental combiner and combine with it.

Once again tnx for this macro, wery wery usefull
(brew 248, smith 179, tailoring 170, jk 198, pottery 199, baking 199, fleching 202)

Alcor75

MajikL_p00p
orc pawn
orc pawn
Posts: 25
Joined: Sat Aug 31, 2002 1:57 am

Post by MajikL_p00p » Fri May 30, 2003 3:09 am

Thanks Alcor! I was able to get the forge working with this.

Amadeus
The Maestro
The Maestro
Posts: 2036
Joined: Sat Jun 29, 2002 3:51 pm

Post by Amadeus » Fri May 30, 2003 3:19 am

damn dude..you're amazing, I couldn't understand a think he was saying in that post.

Care to post a working edit for using a forge?

MajikL_p00p
orc pawn
orc pawn
Posts: 25
Joined: Sat Aug 31, 2002 1:57 am

Post by MajikL_p00p » Fri May 30, 2003 3:54 am

I couldn't understand it either at first, but then I read it a few more times and got it.

All you do is get a 10 slot container with a combine button, like a deluxe toolbox or something, put it in your inventory, open it, then open the forge and put the forge window exactly over it and start your macro. You also need to change the combiner type in the macro to "deluxe toolbox" or whatever your using.

topgun
a lesser mummy
a lesser mummy
Posts: 43
Joined: Thu Jan 09, 2003 8:27 am

Post by topgun » Fri May 30, 2003 7:03 am

Jaerin hov would the macro look, with your idea ???

I tried, but couldn't see any diference... But i must admit. Newer tried changing anything in a MQ macro before, so its me who can't figure it out

alcor75
a lesser mummy
a lesser mummy
Posts: 77
Joined: Wed Jan 29, 2003 7:35 am

Post by alcor75 » Fri May 30, 2003 7:19 am

And what did i sad? P
Yea sorry i have a wery bad English, btw brain still work )
tnx for the traslaction )

Alcor75

Mckorr
Developer
Developer
Posts: 2326
Joined: Fri Oct 18, 2002 1:16 pm
Location: Texas

Post by Mckorr » Fri May 30, 2003 8:49 am

I'll expand on this a bit:

The location parser does not check to see if the pack/combiner you are calling is actually open or not. That's one of those bits that's gotta be fixed...one of these days.

That means yes, you can refer to a location that, technically, does not currently "exist". The coordinates are still there. If I have absolutely no windows open, and type "/mouseto head", the mouse will still move to where my head slot would be IF my inventory window was open.

So, put a 10 slot combiner, deluxe toolbox being an excellent idea, in your last inventory slot. Open it. Open your external combiner (forge), and position it so it sits right over the toolbox, making sure the combine and done buttons and all the slots overlap as closely as possible. Now, close the toolbox. The location parser doesn't know the toolbox is closed, so it will still click where the toolbox is supposed to be, and hit the forge instead.

Now, don't expect this workaround to continue forever :) We'll get the parser sorted out one of these days so it checks for open/closed containers, and so it works with environmental containers.
MQ2: Think of it as Evolution in action.

alcor75
a lesser mummy
a lesser mummy
Posts: 77
Joined: Wed Jan 29, 2003 7:35 am

Post by alcor75 » Fri May 30, 2003 3:44 pm

And this is the natural envelope of the idea, a All Purpose macro, also now use enviromental combine, is been tested and work.
:Edited to use envoromental combiner =)

Code: Select all

|   TradeSkill.mac - rudimentary tradeskill macro, 
|       now that /finditem works.  ATM it doesn't support 
|       enviro containers.  ALL containers in your inventory 
|       must be already open, and cannot have been moved 
|       since they were opened.  You may need to change the 
|       /delay 5 commands to something higher depending on 
|       your video and net lag. It's recommended you put the container |you're 
|       going to combine in in slot 7 so products don't stack up 
|       in it. 
| 
| 
|   Usage:  /Tradeskill.mac "Combiner Name" "Ingredient 1" "Ingredient 2" ....."Ingredient 9" 
|     you can add from 1 to 9 item and combine them, you can use tools ecc, also i added the fast item check. 
|    Alcor75 
| 
|All Right for the original macro goto Pigeon. 
| 
#turbo 

#define CombinerPack v97 
#define IngredSize v98 

#chat tell 

Sub Main 
    /press ctrl 
    /press alt 
    /press shift 

    /varset IngredSize 0 

    /if "$p1"!="" /call AddIngred "$p1"  | List of ingredients.  The AddIngred 
    /if "$p2"!="" /call AddIngred "$p2"     | subroutine automatically sets the index. 
    /if "$p3"!="" /call AddIngred "$p3" 
    /if "$p4"!="" /call AddIngred "$p4" 
    /if "$p5"!="" /call AddIngred "$p5" 
    /if "$p6"!="" /call AddIngred "$p6" 
    /if "$p7"!="" /call AddIngred "$p7" 
    /if "$p8"!="" /call AddIngred "$p8" 
    /if "$p9"!="" /call AddIngred "$p9" 

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

    /if $CombinerPack<=7 /call OpenInv 
   /if $CombinerPack==8 /call OpenEnv 
   /if $CombinerPack==99 { 
                 /echo "Cannot find container-Aborting" 
                 /end 
                } 

    /echo $v20 

    :RunMake 

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

        /finditem "$a(0,$v99)" 
        /call ItemOnCursor 
        /if $find()==FALSE { 
            /goto :Done 
        } 
        /click left $v20 $v99 
        /call ItemNotOnCursor 
    /next v99 
    /delay 0
    /click left $v20 combine 
    /call ItemOnCursor 
    /doevents 
    /goto :RunMake 

    :Done 
/return 

Sub CombinerClick 


Sub ClearCursor 
    :Start 
        /if $cursor()!=NULL { 
            /click left auto 
            /call ItemNotOnCursor 
        } 
        /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 3 
    /for v99 0 to $v50 
        /click left pack $p0 $v99 
        /call ItemOnCursor 
        /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 { 
                /varset CombinerPack 8 
                } 

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

Sub Event_Chat 
    /endmacro 
/return 



Sub ItemOnCursor 
     /varset t1 5 
     :ItemOnLoop 
     /delay 0 
     /if $cursor()!=TRUE /if n $t1>0 /goto :ItemOnLoop 
/return 

Sub ItemNotOnCursor 
     /varset t2 5 
     :ItemOnLoop 
     /delay 0 
     /if $cursor()==TRUE /if n $t2>0 /goto :ItemOnLoop 
/return 

Sub OpenInv 
   /varset v20 "Pack $CombinerPack" 
    
    
   /if $pack($CombinerPack,empty)==FALSE /call CleanPack 
/return 

Sub OpenEnv 
    
   /varset CombinerPack enviro 
   /varset v20 enviro 
   /face item 
   /delay 0 
   /if $pack($CombinerPack,empty)==FALSE /call CleanPack
   /echo using the $v20 
/return
Added the ItemNotNoCursor after the click that was missing,now is supposed to no miss the combine anymore ), Tnx to Vaft
also reedited , Now work for real, tested and retested.
Alcor75[/code]
Last edited by alcor75 on Mon Jun 09, 2003 2:17 pm, edited 8 times in total.

Mckorr
Developer
Developer
Posts: 2326
Joined: Fri Oct 18, 2002 1:16 pm
Location: Texas

Post by Mckorr » Fri May 30, 2003 7:23 pm

BTW, I had no trouble clicking on an enviro container earlier today, hit everything right on the money. Are you sure you were calling it correctly?

Open the oh, forge. Slots are numbered as follows

0 1
2 3
4 5
6 7
8 9

If you have 4 ingredients, you need to cycle through the slots by either

/mouseto enviro 0

or to drop something in

/click left enviro 0

No abbreviating, the parser recognizes "enviro", not "env", "forge", etc.

Very crude, but

Code: Select all

#define EnviroSlot v90
/varset EnviroSlot 0

sub DropIntoEnviro
/if $cursor()=FALSE /return
/click left enviro $EnviroSlot
/varadd EnviroSlot1
/return
Just make sure, after hitting combine ("/click left enviro combine") that you reset EnviroSlot to 0.
MQ2: Think of it as Evolution in action.

kagonis
a hill giant
a hill giant
Posts: 228
Joined: Sat May 24, 2003 8:48 pm

Post by kagonis » Tue Jun 03, 2003 6:10 pm

Great script, but it seems to miss the combine button a bit..