Buy/sell/combine help

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

Moderator: MacroQuest Developers

gumper
orc pawn
orc pawn
Posts: 16
Joined: Thu Jul 10, 2003 6:35 pm

Buy/sell/combine help

Post by gumper » Fri Jul 25, 2003 9:10 pm

I could reall use some help on this macro.. First let me set up outline of what I want it to do..

1. Open merchant buy stacks of items needed, close merchant.
2. I have done.. it is the combine.. I will paste it below (I only andded a few lines to this, I do not take credit for thsi script.. forget who did it)
3. Once all combines are done, open merchant and sell back all items made.
4. Go back to beginning and start all over..


Combine Macro


#turbo

#define CombinerPack v97
#define IngredSize v98

#chat tell

Sub Main
/press ctrl
/press alt
/press shift

/varset IngredSize 0

/call AddIngred "ingredient"
/call AddIngred "ingredient"
/call AddIngred "ingredient" | List of ingredients. The AddIngred
/call AddIngred "ingredient" | subroutine automatically sets the index.


/call FindCombiner "held container"

/echo $CombinerPack

:RunMake

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

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

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

:Done
/return

Sub ClearCursor
:Start
/if $cursor()!=NULL {
/click left auto
/delay 2
}
/delay 2
/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 2
/for v99 0 to $v50
/click left pack $p0 $v99
/delay 2
/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
/call sellitem
/endmacro
/return


The combine works GREAT!!! No problems there =)
I could really use the help, I also would like to be able to have the ability to plug in different values, the same way I have it in the combine section.

Thanks for the help!

gumper
orc pawn
orc pawn
Posts: 16
Joined: Thu Jul 10, 2003 6:35 pm

Post by gumper » Sat Jul 26, 2003 2:11 pm

So after working on this more I have the Combine working and the selling, but I need some help with making the combine /call sell sub routine.. Here is what I have.. PLEASE help me out )

Code: Select all

[color=orange]
#turbo 

#define CombinerPack v97 
#define IngredSize v98 

#chat tell 
Sub Main
    /sit
    /delay 1s
    /cleanup
           /delay 1s
           /click right inv 0
           /delay 1s
           /click right inv 7
           /delay 1s

        /varset IngredSize 0 

    /call AddIngred "item"  | List of ingredients.  The AddIngred 
    /call AddIngred "item"     | subroutine automatically sets the index. 
 

    /call FindCombiner "container"    

    /echo $CombinerPack 

    :RunMake 

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

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

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

    :Done 
/return 

Sub ClearCursor 
    :Start 
        /if $cursor()!=NULL { 
            /click left auto 
            /delay 2
        } 
        /delay 2
    /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 2 
    /for v99 0 to $v50 
        /click left pack $p0 $v99 
        /delay 2
        /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 
     /call sell
 
/return 


|-----------------|
|-Sell Routine---|
|-----------------|
Sub Sell
/target npc
   /delay 1
   /click right
   /delay 1s
   /click right inv 0
   /delay 1
   /click right inv 1
/delay 1
   /click right inv 2
/delay 1
   /click right inv 3
/delay 1
   /click right inv 4
/delay 1
   /click right inv 5
/delay 1
  /click right inv 6
/delay 1
  /click right inv 7
/delay 1
   :SellItem  
      /finditem similar "item" 
      /if "$find()"=="FALSE" /goto :DoneSellItem 
      /varcalc p2 $char(plat)*1000+$char(gold)*100+$char(silver)*10+$char(copper) 
      /click left merchant sell 
      :SellItemLoop 
         /delay 5 
      /if n $calc($char(plat)*1000+$char(gold)*100+$char(silver)*10+$char(copper))==$p2 /goto :SellItemLoop      
   /goto :SellItem 
   :DoneSellItem 
   /sendkey up shift 
/endmacro

[/color]
All I need is to get the two to blend together.. what I would liek to happen is when I am out items to combine it goes to sell routine... I guess I could take out the sell part and just destroy the made item or drop it.. but my funds are low to tradeskill so I need all I can get back