not sure how to edit this combine macro..

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

Spinal
decaying skeleton
decaying skeleton
Posts: 2
Joined: Mon Nov 03, 2003 10:05 am

not sure how to edit this combine macro..

Post by Spinal » Mon Nov 03, 2003 10:14 am

i was wanting to get this to make celestial essences (celestial solvent and the scent of marr combined in a mortar and pestle) but i'm sadly not really sure what to change in here since i just downloaded and compiled this late last night i have tried though unsuccessfully any tips or something would be appreciated thanks for your time

Code: Select all

#Event failure "You lacked the skills to fashion the items together."


Sub Combineall
/declare l0 local
/declare l1 local
/declare l2 local
/declare l3 local
/declare l4 local
/declare l5 local
/declare l6 local
/declare l7 local
/declare l8 local
/declare l9 local
/declare v86 global
/declare t22 timer

/for l0 0 to 9
  /if "$right(1,"@Param@l0")"=="@l0" /goto :Continueall
/next l0

:Continueall

/varset l2 100000


/for l1 1 to $int(@l0-1)

  /if "$left(1,"@Param@l1")"=="+" {
   /varset Param@l1 "$right($calc($strlen("$defined(param@l1)")-2),"$left($calc($strlen("$defined(param@l1)")-1),"$defined(param@l1)")")"
   /varadd v86 1
  } else {
    /if n @l2>$count("$defined(param@l1)") /varset l2 $count("$defined(param@l1)")
  }
/delay 1
/if n $count("@Param@l1")==0 {
  /echo Missing "$defined(param@l1)"
  /return
  }
/next l1

/for l3 1 to 10000

  /delay 0
  /call combine "@Param0" "@Param1" "@Param2" "@Param3" "@Param4" "@Param5" "@Param6" "@Param7" "@Param8" "@Param9"
  /if n $freeinv(space)<2 /return

/next l3
/return

|************************************************************************************************************|
Sub Combine
/declare l0 local
/declare l1 local
/declare l2 local
/declare l3 local
/declare l4 local
/declare l5 local
/declare l6 local
/declare l7 local
/declare l8 local
/declare l9 local


/if "$defined(param0)"!="Environment" {
  /call FindCombiner "@Param0"
  /if n $return==-1 /return
  /varset l0 $return
}

/for l1 0 to 9
/if "$right(1,"@Param@l1")"=="@l1" /goto :Continue
/next l1

:Continue

/if n @t22==0 {
/if "$defined(param0)"!="Environment" {
    /call clean
    /delay 5
  } else {
    /call clean
    /delay 2
    /face fast item
    /delay 2
    /click left item
    /delay 2
}
/call Openbags
}

/varset t22 105
/sendkey down ctrl
/delay 3

/if "$defined(param0)"=="Environment" {

    |***************ENVIRO GET ITEMS*******************|

    /for l2 1 to $int(@l1-1)
    :ENVIROFindDelay
    /doevents
    /if "$cursor()"=="TRUE" /goto :ENVIROFindDelay
    /finditem "$defined(param@l2)"
    :ENVIRODropDelay
    /doevents
    /if "$cursor()"=="NULL" /goto :ENVIRODropDelay
    /click left button enviro_$int(@l2-1)
    /next l2

    |************ENVIRO Combine Items********************|

    :ENVIROCombineDelay
    /doevents
    /if "$cursor()"=="TRUE" /goto :ENVIROCombineDelay
    /click left button enviro_combine

/goto :AutoDelay
}


|***************GET ITEMS*******************|

/for l2 1 to $int(@l1-1)
:FindDelay
/doevents
/if "$cursor()"=="TRUE" /goto :FindDelay
   /finditem "@Param@l2"
:DropDelay
/doevents
/if "$cursor()"=="NULL" /goto :DropDelay
  /click left button inv_pack"@l0"_$int(@l2-1)
/next l2

|************Combine Items********************|

:CombineDelay
/doevents
/if "$cursor()"=="TRUE" /goto :CombineDelay
   /mouseto button inv_pack"@l0"_combine

/call Combineat @l0
   

|************Put Finished Item in Inventory*****|
:AutoDelay
/doevents failure
/if n $return==1 {
/if @v86!="" {
/for l5 1 to @v86
/click left auto
/doevents
/next l5
}
/goto :DoneDelay
}
/if "$cursor()"=="NULL" /goto :AutoDelay
:DoneDelay
   /click left button auto |placing in inventory
   /if @v86!="" {
   /for l5 1 to @v86
   /click left auto
   /doevents
   /next l5
   }
   /delay 1
/if "$cursor()"=="TRUE" /goto :DoneDelay
   /doevents
/sendkey up ctrl
/return


Sub Openbags
/declare l0 local
/declare l1 local
/declare l2 local
/declare l3 local
/declare l4 local
/declare l5 local
/declare l6 local
/declare l7 local
/declare l8 local
/declare l9 local
/delay 2
/for l0 0 to 7
/if "$pack(@l0,open)"!="TRUE" {
/delay 3
/click right button inv_@l0
}
/next l0
/return

Sub Combineat
/declare l0 local
/declare l1 local
/declare l2 local
/declare l3 local
/declare l4 local
/declare l5 local
/declare l6 local
/declare l7 local
/declare l8 local
/declare l9 local

|*****************Bag Slot List*****************|

|   l0  =  the number of slots in the bag

/if "$item(inv,@Param0,name)"=="Foldable Medicine Bag" /varset l0 6
/if "$item(inv,@Param0,name)"=="Mixing Bowl" /varset l0 4
/if "$item(inv,@Param0,name)"=="Spit" /varset l0 6
/if "$item(inv,@Param0,name)"=="Collapsible Sewing Kit" /varset l0 8
/if "$item(inv,@Param0,name)"=="Collapsible Mortar and Pestle" /varset l0 6
/if "$item(inv,@Param0,name)"=="Collapsible Mixing Bowl" /varset l0 4
/if "$item(inv,@Param0,name)"=="Collapsible Spit" /varset l0 6
/if "$item(inv,@Param0,name)"=="Collapsible Fletching Kit" /varset l0 8
/if "$item(inv,@Param0,name)"=="Collapsible Toolbox" /varset l0 8
/if "$item(inv,@Param0,name)"=="Collapsible Jeweller's Kit" /varset l0 6
/if "$item(inv,@Param0,name)"=="Jeweller's Kit" /varset l0 6
/if "$item(inv,@Param0,name)"=="Planar Jeweller's Kit" /varset l0 6
/if "$item(inv,@Param0,name)"=="Large Sewing Kit" /varset l0 8
/if "$item(inv,@Param0,name)"=="Coldain Tanners Kit" /varset l0 8
/if "$item(inv,@Param0,name)"=="Deluxe Sewing Kit" /varset l0 10
/if "$item(inv,@Param0,name)"=="Fletching Kit" /varset l0 8
/if "$item(inv,@Param0,name)"=="Mortar and Pestle" /varset l0 6
/if "$item(inv,@Param0,name)"=="planar fletching kit" /varset l0 8
/if "$item(inv,@Param0,name)"=="Planar Sewing Kit" /varset l0 8
|************************************************|

    /varcalc l1 $calc(10-@l0)*-20
   /doevents
   /mouseto +0 "@l1"
   /delay 0
   /click left
/return


Sub FindCombiner
/declare l0 local
/declare l1 local
/declare l2 local
/declare l3 local
/declare l4 local
/declare l5 local
/declare l6 local
/declare l7 local
/declare l8 local
/declare l9 local
/for l1 7 downto 0
  /if "$pack(@l1,combine)"=="@Param0" /return @l1
/next l1
/echo You do not appear to have a valid $defined(param0) container.
/return -1


Sub Event_failure
/delay 0
/return 1


Sub 10potion
/call FindCombiner Alchemy
/if n $return==-1 /return
/varset l0 $return

/if n $count("$defined(param0)")<10 {
/echo You only have $count("$defined(param0)") $defined(param0)
/return
}

:Again

/varset l9 $count("$defined(param0)")

/if n @t22==0 {
    /call Clean
    /delay 5
  /call Openbags
}
/varset t22 50

|***************GET Potions*******************|


/for l2 1 to 10
:FindDelay
/delay 0
/if "$cursor()"=="TRUE" /goto :FindDelay
   /finditem "$defined(param0)"
:DropDelay
/delay 0
/if "$cursor()"=="NULL" /goto :DropDelay
   /click left button inv_pack@l0_$int(@l2-1)
/next l2

|************Combine Potions********************|

:CombineDelay
/delay 0
/if "$cursor()"=="TRUE" /goto :CombineDelay
   /click left button inv_pack@l0_combine
:DoneDelay
/delay 0
/if n @l9==$count("$defined(param0)") /goto :DoneDelay

/if n $count("$defined(param0)")=>10 /goto :Again
/return

Sub Clean
/cleanup
/press i
/delay 2
/return [/clode

Joshjje
orc pawn
orc pawn
Posts: 18
Joined: Mon Oct 27, 2003 2:39 pm

..

Post by Joshjje » Mon Nov 03, 2003 2:42 pm

First of all i dont think many people want to wade through all those lines of code (i didnt) to look for errors, or run the macro themselves. It would be better if you could state a particular problem you were having.

Also itd be better if you followed some variable naming conventions..instead of using numbers try giving them a name to help state what they are used for.

I also dont see why you have so much code only to combine scent of marr and celestial solvent in a mortar and pestle?

Another thing is you dont have a Sub Main which is required, unless of course this is intended to be an include.

Spinal
decaying skeleton
decaying skeleton
Posts: 2
Joined: Mon Nov 03, 2003 10:05 am

Post by Spinal » Mon Nov 03, 2003 3:28 pm

First of all i dont think many people want to wade through all those lines of code (i didnt) to look for errors, or run the macro themselves. It would be better if you could state a particular problem you were having.
ok my biggest problem frankly is im just not sure where to edit it to make it find the items neccesarry select them and combine them sorry if i wasnt specific enough when i made the topic
Also itd be better if you followed some variable naming conventions..instead of using numbers try giving them a name to help state what they are used for.
not really sure what you mean by variable naming conventions.... i didnt write it
I also dont see why you have so much code only to combine scent of marr and celestial solvent in a mortar and pestle?
i didn't write it.. i found it in the macro depot
Another thing is you dont have a Sub Main which is required, unless of course this is intended to be an include.
ok i didnt know that

im probably just going to delete macro quest or something as this is starting to give me a head ache lol if i came off as rude or anything anywhere in this topic.. sorry and thanks for your help

Joshjje
orc pawn
orc pawn
Posts: 18
Joined: Mon Oct 27, 2003 2:39 pm

..

Post by Joshjje » Thu Nov 06, 2003 3:14 pm

Ok i havent tested this out, just wrote it up on the whim, very simple and you will have to have the mortar and pestle open though you could easily write the code to do it (IE if its in your 6th inventory slot put this code in before the /for loop (/click right inv 5) Anyways tell me how it goes, i might have made a few mistakes.

Code: Select all

#turbo

#event CombineFail "You lacked the skills to fashion the items together."

|==================================================

Sub Main
/declare Failed_Count global
/declare Cnt global
/declare Num global
/declare CE global
/declare SoM global

/varset CS "Celestial Solvent"
/varset SoM "Scent of Marr"
|**---Make sure spelling is correct for these---**|

/varset Failed_Count 0
/varcalc Cnt $count("@CS")
|** The above ASSUMES that there are the same number of scent of marrs which you should have so... **|
/for Num 1 to @Cnt

|** This will call the combine sub with the celestial solvent and scent of marr as the parameters i have NOT tested this out but it should work**|

/call Combine "@CS" "@SoM"
/next Num

/echo "You failed @Failed_Count times!"
/return

|==================================================

Sub Event_CombineFail
/varadd Failed_Count 1
/return

|==================================================

Sub Combine
|** You can shorten the delays all depending on your lag  or you can program a sub to detect when an item has dropped/picked up :) **|

/sendkey down ctrl
/finditem "@Param0"
/sendkey up ctrl
/delay 15
/click left enviro 0
/delay 15
/sendkey down ctrl
/finditem "@Param1"
/sendkey up ctrl
/delay 15
/click left enviro 1
/delay 15
/click left enviro combine
/delay 15
/doevents
/delay 15
/click left auto
/delay 10
/return

|==================================================