tradeskill code snippets using INI files

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

Moderator: MacroQuest Developers

GoatFoot
a lesser mummy
a lesser mummy
Posts: 68
Joined: Fri Jan 17, 2003 1:48 am

tradeskill code snippets using INI files

Post by GoatFoot » Thu Aug 21, 2003 6:05 pm

Samples of some things I use.
These require that returns be able to handle multiple data types.

Most of the ideas below come from posts to the board, so all credit to the original coders.

If anyone is feeling particularly bored, take a look at sub "CombineItem" and figure out why I couldn't

Code: Select all

/varset COMB_MSG ""
One of the things I like is the ability to deal with multiple combine messages for the same combine.

Code: Select all

       /call CombineItem "$COMBINER"
       /varset l2 $return
       /if "$l2"~~"error" /call CleanPack "$COMBINER"
       /if "$l2"~~"success" /call ClearCursor
       /if "$l2"~~"trivial" /goto :Done
Though I think "success" and "trivial" are the only time multiple success mesages may be important.

some subs

Code: Select all

#define INIPATH "<PATH TO INIFILES>"

#event CombineTrivial "You can no longer advance" 
#event CombineSuccess "You have fashioned"
#event CombineFail "You lacked the skills"
#event CombineError "You cannot combine" 

#define COMB_MSG v98

|/call GetRecipe <trade skill> <recipe name>
|sets a(0,0) to number of recipe components
|sets a(0,#) to a recipe component

sub GetRecipe
   /varset a(0,0) NULL
|  /if "<LIST OF INI FILES>"!~"$p0" {
|     /echo $p0 is not recognized. 
|     /return NULL
|  }
   /for l0 10 downto 0
      /if "$ini(INIPATH\$p0.ini,"$p1")"~~"comp$l1" /varset a(0,0) $l0
   /if $a(0,0)==NULL /next l0
   /for l1 1 to $a(0,0)
      /varset a(0,$l1) "$ini(INIPATH\$p0.ini,"$p1",comp$l1)"
      /echo $a(0,$l1)
   /next l1
/return $p0

|/call GetTrivial
sub GetTrivial
/return $ini(INIPATH\$p0.ini,"$p1",trivial)

|/call GetCombiner
sub GetCombiner
/return $ini(INIPATH\$p0.ini,"$p1",combiner)

| /call SetCombiner <trade skill>
sub SetCombiner
   /for l0 0 to 7
      /if "$pack($l0,combine)"~~"$p0" /goto :SetCombiner
   /next l0
   :SetCombiner
   /if n $l0<8 /return "pack $l0"
/return "enviro"

| /call ClearCursor [auto|destroy]
sub ClearCursor
    /varset l0 auto
    /if "$p0"~~"dest" /varset l0 destroy
    :ClearCursor
    /click left $l0
    /delay 1
    /if $cursor()==TRUE /goto :ClearCursor
/return

| /call GetItem <item name>
sub GetItem
    /press shift
    /sendkey down ctrl
    /finditem "$p0"
    /sendkey up ctrl
    :VerifyItem
    /delay 1
    /if $getlasterror==FIND_NOTFOUND {
	/echo $getlasterror "$p0"
        /return -1
    }
    /if $cursor()!=TRUE /goto :VerifyItem
/return


| /call PutItem (enviro | pack #) <slot>
sub PutItem
   /if $cursor()!=TRUE {
        /echo No Item to put.
	/return -1
   }
   /click left $p0 $p1
   :PutItem
   /delay 1
   /if $cursor()==TRUE /goto :PutItem
/return

| /call CombineItem (enviro | pack #)
sub CombineItem
   /click left $p0 combine
   /varset COMB_MSG NULL
   :WaitforCombine
      /delay 1
      /doevents
   /if n $strlen("$COMB_MSG")==4 /goto :WaitforCombine
/return "$COMB_MSG"

| /call CleanPack (enviro | pack #)

Sub CleanPack
   /if "$p0"=="enviro" {
      /varset l0 9
   } else {
      /varset l1 $right(2,"$p0")
      /varcalc l0 $pack($int($l1),slots)-1
   }

   /press ctrl
   /sendkey down shift
   /for l1 0 to $l0
      /click left $p0 $l1
      /delay 1
      /click left auto
      :CP_ClearCursor
      /delay 1
      /if $cursor()==TRUE /goto :CP_ClearCursor
   /next l1
   /sendkey up shift
   /press shift
/return 

sub Event_CombineTrivial
   /varset COMB_MSG "$COMB_MSG trivial"
/return 3

sub Event_CombineSuccess
   /varset COMB_MSG "$COMB_MSG success"
/return 2

sub Event_CombineFail
   /varset COMB_MSG "$COMB_MSG fail"
/return 1

sub Event_CombineError
   /varset COMB_MSG "$COMB_MSG error"
/return -1
Sample ini file.
file name - brewing.ini

Code: Select all

[fetid essence]
trivial=122
combiner="brew barrel"
comp1="water flask"
comp2="fishing grubs"

[heady kiola]
trivial=46
combiner="brew barrel"
comp1="water flask"
comp2="packet of kiola sap"
comp3="packet of kiola sap"
comp4="bottle"

[skull ale]
trivial=151
combiner="brew barrel"
comp1="spices"
comp2="short beer"
comp3="cyclops skull"
comp4="vinegar"

[faydwer shaker]
trivial=188
combiner="brew barrel"
comp1="mead"
comp2="dwarven ale"
comp3="elven wine"
comp4="gnomish spirits"
comp5="cask"

[minotaur hero`s brew]
trivial=248
combiner="brew barrel"
comp1="water flask"
comp2="water flask"
comp3="yeast"
comp4="short beer"
comp5="short beer"
comp6="malt"
comp7="malt"
comp8="malt"
comp9="cask"
Last edited by GoatFoot on Fri Aug 22, 2003 12:39 am, edited 1 time in total.

Shin Noir
a ghoul
a ghoul
Posts: 90
Joined: Tue Aug 05, 2003 8:18 pm

Post by Shin Noir » Thu Aug 21, 2003 11:11 pm

Yea, I was going the same route with my little tradeskill macro I made.
Not really up for debugging yours though, maybe my code will help you out.

Note my code was more or less fully operational, but it never allowed you to use a bag, you had to use the environment. I got bored of the code and haven't really touched it lately. I also had all tradeskills listed (I wrote a nify little converter to extract the data from eqtrader's listing heh) but I can't find it right now and too lazy to look =-/

Code: Select all

|Shin Noir's Combine.mac Version 1.3 (8/18/03)
|
|
|HOW TO SET UP FOR THIS MACRO:
|
|Before Starting:
|1) Open all bags you have of the combinable items and put them all in their own area on the screen.
|2) Close all these bags. Reopen them. (This will save their positions which is NECCESSARY for this .mac to work)
|3) Open the Container you will be doing the combines in it's own free area. (Kiln, ect)
|4) Close the container. Reopen it.
|5) Double check all bags and the container needed for this macro are open are ready.
|
|How to Combine:
|
|/mac combine [CombineName]
|
|Please look at CombineReadMe.txt on how to get a list of Combine Names!

#turbo


#define StopAtTrivial "FALSE" |Set this to FALSE to do combines even if trivial.
#define AutoWalk "FALSE" |Still in Testing Phase, Recommended FALSE

|Don't Change These Variables Below!
|v0 Boolean to let you continue next combine
|v1 Current Pointer for Item list a(0,*)
|v2 RunTime
|v3 Used in PresetLoad
#define OfficialName v4
#define TrivialAt v5
|v6 = CPH (Combines Per Hour)
|v7 = # of Skillups
|v8 = Fail #
|v9 = Success #
|v10 = combine wait
#define OpenSpot v12
|v13 = Old Bag Slot
|v90 = Temp variable used for various quick comparisons
|v91 = just like v90
|
|a(0,0) = Max Count of Items
|a(0,1) = Item 1
|.....
|a(0,10)= Item 10
|a(1,0) = Max Count of Delete Item List
|a(1,1) = Delete Item 1
|.....
|a(1,9) = Delete Item 9


#event CombineFail "You lacked the skills to fashion the items together."
#event CombineSuceed "You have fashioned the items together to create something new!"
#event CombineAlternate "You have fashioned the items together to create an alternate product"
#event SkillTrivial "You can no longer advance your skill from making this item" 
#event SkillUp "You have become better at "

Sub Main

/varset v2 $running

/call LoadPreset "$p0" "$p1" "$p2" "$p3" "$p4" "$p5" "$p6" "$p7" "$p8" "$p9"

/if $cursor()!="NULL" {
/echo Cannot run macro with $cursor(name) on cursor.
/endm
}

 /sendkey down ctrl
 | /if $ucase(Setup)=="TRUE" /call Setup
  /varset v0 1
 /echo Press CTRL to exit at any time. 
 
 :CombineLoop
  /if n $v0==1 {
    /varset v0 0
    /varset t2 0
    /for v1 1 to $a(0,0)
    /varset v10 0
     /finditem "$a(0,$v1)"
     /varset t1 40
     
     :FindIt

      /if $t1<=10 /goto :NotFound
      /if $find()=="FALSE" /goto :NotFound
      /doevents
      /if "$cursor(name)"=="NULL" /goto :FindIt
      /goto :Found
     :Notfound
      /echo $a(0,$v1) was not found.
      /varadd v2 3
      /goto :Done
     :Found
      /if $cursor(stack)>1 {
      /if $cursor(name)!="NULL" {
       /echo Error multiple items on cursor. ($Cursor(name) ($cursor(stack)))
       } else {
       /echo Cannot grab "$a(0,$v1)", aborting.
       }
       /goto :Done
      }
      /click left enviro $int($calc($v1-1))
    /doevents
    /next v1
    /if $a(0,0)<=5 /delay 4 |Code runs too fast won't register Combine when not many items lol
     /varset t2 50
     /click left enviro combine
     /doevents
    }
   :WaitForCombine
   /doevents
   /if $v10==0 /goto :WaitForCombine
   /if "$cursor(name)"!="NULL" {
   /varset v0 1
   /call ClearCursor
   } else {
   /varset v0 1
   }
 |   /if n $calc($running-$v1)>$calc($running+5) /call Done
    /if $gm=="TRUE" /endm
    /if $t2=="0" {
    /echo 3 Second timeout waiting for Combine.
    /goto :Done
    }

  /goto :CombineLoop

:Done   
 /echo $int($v8) Fails, $int($v9) Successes, $int($calc($v8+$v9)) Total Combines in $running secs. $calc($calc(60/$calc($running-$v2))*$calc($v8+$v9)) combines per minute. $int($v7) Skillups
    /sendkey up ctrl   
/return

Sub Event_CombineFail 
     /if $Cursor(name)!="NULL" {
     /call ClearCursor
|     /echo Error! $Cursor(name) ($cursor(stack)) is on the cursor after a fail.
|     /endm
     }
     /doevents
     |/delay 10
     /varset v10 1
     /varadd v8 1
/if $int($calc($v8+$v9))==20 /echo $calc($calc(60/$running)*$calc($v8+$v9)) Combines Per Minute.
/return 

Sub Event_CombineSuceed 
    /doevents | /delay 10
     /varset v1 $running
     /varadd v9 1
     /varset v10 1

   | /call ClearCursor

/if $int($calc($v8+$v9))==20 /echo $calc($calc(60/$running)*$calc($v8+$v9)) Combines Per Minute.
/return 

Sub Event_SkillTrivial
/if StopAtTrivial=="TRUE" {
/echo Combine has become trivial. $int($v9) Successes, $int($v8) Fails, $int($v7) skill ups
/echo Edit Combine.mac if you want to do multiple combines of this item.
/sendkey up ctrl
/endm
}
/return

Sub Event_SkillUp
/varadd v7 1
/return

Sub Event_Timer

/return

sub FindOpenSlot

 |/echo Finding open slot...
 |find an open slot
 /for v91 0 to 7 |Go through packs 0 to 7
  /if  $pack($v91,open)=="FALSE" /goto :NextPack |Go to next pack if this one isn't open.
  /for v92 0 to $pack($v91,slots) |Search each slot for a free spot
   /if "$item($v91,$v92,name)"=="NULL" {
   |/echo Found slot $v92 empty of $pack($v91,name)
   /varset OpenSpot 1
   /goto :Bagged
   }
   /doevents
   :FindNext
   /next v92
  
  :NextPack
  /doevents
 /next v91
 /varset OpenSpot 0
 :Bagged
 /doevents

/return
Sub ClearCursor

/varset v91 0

|Check if item should be destroyed
/if n $a(1,0)>0 {
 /for v91 1 to $a(1,0)
  /echo "$lcase($a(1,$v91))"=="$lcase($Cursor(name))"
  /if n "$lcase("$a(1,$v91)")"==$lcase("$Cursor(name)") /varset v91 1
 /next v91
}

/if $v91==1 {
 /echo $Cursor(name)($cursor(stack)) destroying...
 /click left destroy
 /doevents
} else { |If an item is on the inventory that ISNT flagged as destroyable auto-equip
 
|/echo $Cursor(name)($cursor(stack)) bagging...
/if OpenSpot==0 {
/echo Cannot Find Open Slot!
/endm
}
:NextAuto
 /click left auto
 /doevents
}
     /if $Cursor()!="NULL" {
     /if $t3<>10 /goto :ErrorAuto
     /if $t3==0 /varset t3 30
     /goto :NextAuto
     :ErrorAuto
     /echo Error! $Cursor(name) ($cursor(stack)) is on the cursor after an attempt at deleting.
     /endm
     }
/return

sub LoadPreset

/if "$p0"=="" {
/echo Syntax: /mac combine [name] [destroy1] [destroy2] ... [destroy9]
/endm
}

|Get List of Items
/if "$p0"=="list" {
 /if "$p1"!="" {
  /if "$ini(tradeskill.ini,"$p1")"=="NOTFOUND" {
   /echo Cannot find $p1.
   /endm 
  }

  /echo Items for $p1:
  /for v3 1 to 10
   /if "$ini(tradeskill.ini,"$p1","item$v3")"=="NOTFOUND" {
    /goto :DoneList
   } else {
    /echo $ini(tradeskill.ini,"$p1","item$v3")
   }
  /next v3
 :DoneList
  /endm
 } else {
  /echo Syntax: /mac combine [list] [name]
  /endm
 }
}

|Set Combine Items
/for v3 1 to 10
/if "$ini(tradeskill.ini,"$p0","item$v3")"=="NOTFOUND" {
/varset a(0,0) $int($calc($v3-1))
/goto :FoundItems	
} else {
/varset a(0,$v3) "$ini(tradeskill.ini,"$p0","item$v3")"
}
/next v3
:FoundItems

/if $v3==0 {
/echo Invalid Combine Name! See CombineReadme.txt for how to get a list of combines
/endm
}

|Set Delete List
/varset a(1,0) 0

/if "$p1"!="" {
 /varset a(1,1) "$p1"
 /varset a(1,0) 1
}

/if "$p2"!="" {
 /varset a(1,2) "$p2"
 /varset a(1,0) 2
}

/if "$p3"!="" {
 /varset a(1,3) "$p3"
 /varset a(1,0) 3
}

/if "$p4"!="" {
 /varset a(1,4) "$p4"
 /varset a(1,0) 4
}

/if "$p5"!="" {
 /varset a(1,5) "$p5"
 /varset a(1,0) 5
}

/if "$p6"!="" {
 /varset a(1,6) "$p6"
 /varset a(1,0) 6
}

/if "$p7"!="" {
 /varset a(1,7) "$p7"
 /varset a(1,0) 7
}

/if "$p8"!="" {
 /varset a(1,8) "$p8"
 /varset a(1,0) 8
}

/if "$p9"!="" {
 /varset a(1,9) "$p9"
 /varset a(1,0) 9
}

/return


tradeskill.ini put in /windows/

Code: Select all

#######BREWING#######

[2x Brewed 2x Stout Dwarven Ale]
item1=Cask
item2=Dwarven Ale
item3=Dwarven Ale
item4=Short Beer
item5=Short Beer
trivial=142

[Ale]
item1=Water Flask
item2=Barley
item3=Malt
item4=Cask
trivial=68

[Armadillo Simmer Ale]
item1=Armadillo Husk
item2=Armadillo Meat
item3=Malt
item4=Ogre Swill
item5=Vinegar
item6=Yeast
trivial=148

[Bleeding Brain]
item1=Fire Beetle Eye
item2=Shotglass
item3=Spices
item4=Vodka
trivial=168

[Bog Juice]
item1=Bottle
item2=Snake Scales
item3=Water Flask
trivial=21

[Boot Beer]
item1=Bottle of Milk
item2=Innothule Mushroom
item3=Large Leather Boots
item4=Malt
item5=Swamp Vegetables
item6=Water Flask
trivial=162

[Bottle of Kalish]
item1=Bottle
item2=Fruit
item3=Vegetables
item4=Water Flask
trivial=30

[Brandy]
item1=Red Wine
item2=Red Wine
item3=Shotglass
item4-Spices
item5=Vegetables
trivial=122

[Brut Champagne]
item1=Champagne Magnum
item2=Grapes
item3=Grapes
item4-Grapes
item5=Soda Water
item6=Wine Yeast
trivial=250

[Caynar Nut Brown Ale]
item1=Bag of Caynar nuts
item2=Barley
item3=Cask
item4=Hops
item5=Malt
trivial=41

[Demi-sec Champagne]
item1=Champagne Magnum
item2=Grapes
item3=Grapes
item4=Soda Water
item5=Wine Yeast
trivial=250

[Egg Nog Xxx]
item1=Bottle
item2=Brandy
item3=Egg Nog
trivial=55

[Honey Mead]
item1=Cask
item2=Hops
item3=Royal Jelly
item4=Water Flask
trivial=40

[Mead]
item1=Cask
item2=Hops
item3=Malt
item4=Yeast
trivial=41

[Minotaur Hero's Brew]
item1=Cask
item2=Malt
item3=Malt
item4=Malt
item5=Short Beer
item6=Short Beer
Item7=Water Flask
Item8=Water Flask
Item9=Yeast

[Ogre Swill]
item1=Cask
item2=Froglok Meat
item3=Malt
item4=Yeast
trivial=51

[Ol'tujim's Fierce Brew]
item1=Barley
item2=Cask
item3=Hops
item4=Malt
item5=Yeast
trivial=135

[Othmir Short Beer]
item1=Azure Algae
item2=Cask
item3=Ochre Algae
item4=White Algae
trivial=31

[Short Beer]
item1=Barley
item2=Cask
item3=Hops
item4=Malt
trivial=31

[Short Ale]
item1=Barley
item2=Cask
item3=Hops
item4=Water Flask
trivial=51

########### Baking ############

[Fish Fillets]
item1=Fresh Fish
item2=Jug of Sauces
trivial=82


Valerian
a grimling bloodguard
a grimling bloodguard
Posts: 709
Joined: Sun Jul 28, 2002 3:29 am

Post by Valerian » Fri Aug 22, 2003 8:15 am

Shin Noir wrote:

Code: Select all

########### Baking ############ 
not really important... but comments in an ini file are made with the semicolon (;)

Zeus
a hill giant
a hill giant
Posts: 180
Joined: Wed Feb 19, 2003 10:03 am
Contact:

Post by Zeus » Sun Aug 24, 2003 2:44 am

Seleepy so didn't read anything but

Code: Select all

/varset COMB_MSG ""
If i remember right there should be a space in there

Code: Select all

/varset COMB_MSG " "
like that

Draekz
a hill giant
a hill giant
Posts: 263
Joined: Thu Aug 01, 2002 6:07 pm
Location: Winnipeg, Manitoba, Canada

tradeskill.ini additions

Post by Draekz » Sun Aug 24, 2003 9:11 am

Here's the tradeskill.ini so far with my additions (includes the recipes that come with the macro, just added more to it).

Only got a handful done before i decided to go to bed before i pass out from exhaustion hehe

Code: Select all

#######ALCHEMY#######

[Lesser Vigor]
item1=Lucern
item2=Birthwart
trivial=17

[Lesser Power]
item1=Lucern
item2=Fenugreek
trivial=22

[Minor Aura of Purity]
item1=Lucern
item2=Nightshade
trivial=32

[Blood of the Wolf]
item1=Birthwart
item2=Fenugreek
item3=Wolf Blood
trivial=37

[Unlife Awareness]
item1=Fennel
item2=Elderberry
trivial=42

[Kilva's Blistering Flesh]
item1=Jatamasi
item2=Clubmoss
trivial=52

[Antiweight]
item1=Hydrangea
item2=Jatamasi
trivial=52

[Serpent's Conviction]
item1=Fennel
item2=Eucalyptus Leaf
trivial=63

[Vigor]
item1=Lucern
item2=Birthwart
item3=Blue Vervain Bulb
trivial=76

[Null]
item1=Fenugreek
item2=Mandrake Root
item3=Blue Vervain Bulb
trivial=90

[Aura of Purity]
item1=Lucern
item2=NightShade
item3=Blue Vervain Bulb
trivial=103

[Spirit Shield]
item1=Sumbul
item2=Clubmoss
item3=Clover
trivial=110

[Greater Negation]
item1=Mystic Ash
item2=Mystic Ash
item3=Mercury
trivial=122

[Dulsehoud]
item1=Hill Giant Toes
item2=Balm Leaf
trivial=131

[Greater Vigor]
item1=Lucern
item2=Birthwart
item3=Valerian Root
trivial=143

[Greater Power]
item1=Lucern
item2=Fenugreek
item3=Valerian Root
trivial=150

[Greater Purity]
item1=Lucern
item2=Nightshade
item3=Valerian Root
trivial=163

[Adrenaline Tap]
item1=Comfrey
item2=Dhea
trivial=170

[Titan Potion]
item1=Maliak Leaf
item2=Tri-fern Leaf
trivial=180



#######BREWING####### 

[2x Brewed 2x Stout Dwarven Ale] 
item1=Cask 
item2=Dwarven Ale 
item3=Dwarven Ale 
item4=Short Beer 
item5=Short Beer 
trivial=142 

[Ale] 
item1=Water Flask 
item2=Barley 
item3=Malt 
item4=Cask 
trivial=68 

[Armadillo Simmer Ale] 
item1=Armadillo Husk 
item2=Armadillo Meat 
item3=Malt 
item4=Ogre Swill 
item5=Vinegar 
item6=Yeast 
trivial=148 

[Bleeding Brain] 
item1=Fire Beetle Eye 
item2=Shotglass 
item3=Spices 
item4=Vodka 
trivial=168 

[Bog Juice] 
item1=Bottle 
item2=Snake Scales 
item3=Water Flask 
trivial=21 

[Boot Beer] 
item1=Bottle of Milk 
item2=Innothule Mushroom 
item3=Large Leather Boots 
item4=Malt 
item5=Swamp Vegetables 
item6=Water Flask 
trivial=162 

[Bottle of Kalish] 
item1=Bottle 
item2=Fruit 
item3=Vegetables 
item4=Water Flask 
trivial=30 

[Brandy] 
item1=Red Wine 
item2=Red Wine 
item3=Shotglass 
item4-Spices 
item5=Vegetables 
trivial=122 

[Brut Champagne] 
item1=Champagne Magnum 
item2=Grapes 
item3=Grapes 
item4-Grapes 
item5=Soda Water 
item6=Wine Yeast 
trivial=250 

[Caynar Nut Brown Ale] 
item1=Bag of Caynar nuts 
item2=Barley 
item3=Cask 
item4=Hops 
item5=Malt 
trivial=41 

[Demi-sec Champagne] 
item1=Champagne Magnum 
item2=Grapes 
item3=Grapes 
item4=Soda Water 
item5=Wine Yeast 
trivial=250 

[Egg Nog Xxx] 
item1=Bottle 
item2=Brandy 
item3=Egg Nog 
trivial=55 

[Faydwer Shaker]
item1=Elven Wine
item2=Dwarven Ale
item3=Gnomish Spirits
item4=Mead
item5=Cask
trivial=188

[Fetid Essence]
item1=Fishing Grubs
item2=water
trivial=122

[Fish Wine]
item1=Fresh Fish
item2=Water
item3=Grapes
item4=bottle
trivial=62

[Honey Mead] 
item1=Cask 
item2=Hops 
item3=Royal Jelly 
item4=Water Flask 
trivial=40 

[Malted Milk]
item1=malt
item2=milk
item3=Bottle
trivial=26

[Mead] 
item1=Cask 
item2=Hops 
item3=Malt 
item4=Yeast 
trivial=41 

[Minotaur Hero's Brew] 
item1=Cask 
item2=Malt 
item3=Malt 
item4=Malt 
item5=Short Beer 
item6=Short Beer 
Item7=Water Flask 
Item8=Water Flask 
Item9=Yeast 

[Ogre Swill] 
item1=Cask 
item2=Froglok Meat 
item3=Malt 
item4=Yeast 
trivial=51 

[Ol'tujim's Fierce Brew] 
item1=Barley 
item2=Cask 
item3=Hops 
item4=Malt 
item5=Yeast 
trivial=135 

[Othmir Short Beer] 
item1=Azure Algae 
item2=Cask 
item3=Ochre Algae 
item4=White Algae 
trivial=31 

[Paeala Bark Tannin]
item1=Paeala Bark
item2=water
trivial=102

[red Wine]
item1=grapes
item2=Wine yeast
item3=Foraged Berries
item4=bottle
trivial=95

[Short Beer] 
item1=Barley 
item2=Cask 
item3=Hops 
item4=Malt 
trivial=31 

[Short Ale] 
item1=Barley 
item2=Cask 
item3=Hops 
item4=Water Flask 
trivial=51

[Skull Ale]
item1=Cyclops Skull
item2=Vinegar
item3=Spices
item4=Short Beer
trivial=151

[Vegetable oil]
item1=Foraged Vegetables
item2=water
trivial=102

[White Wine]
item1=Grapes
item2=Wine yeast
item3=Foraged Fruit
item4=bottle
trivial=82

########### Baking ############ 

[Fish Fillets] 
item1=Fresh Fish 
item2=Jug of Sauces 
trivial=82

[Grilled Cheese Sandwich]
item1=Bread
item2=Cheese
item3=Non-Stick Frying Pan
trivial=57

[Fish Rolls]
item1=Fresh Fish
item2=Batwing
trivial=135

[Patty Melt]
item1=Bread
item2=Cheese
item3=Bear Meat
item4=Non-stick Frying Pan
trivial=191

[Halas 10lb Pie]
item1=Clump of Dough
item2=Clump of Dough
item3=Wolf Fillet in Cream
item4=Bear Fillet in Cream
item5=Lion Fillet in Cream
item6=Mammoth Fillet in Cream
item7=Sage Leaf
item8=Pie Tin
trivial=226

[clump of dough]
item1=basilisk egg
item2=milk
item3=cup of flour
trivial=17

#######FLETCHING#######

Well, thats it! Will edit it as i go along (if i ever get bored enough to again).

Draekz

LightKnight
decaying skeleton
decaying skeleton
Posts: 5
Joined: Mon Oct 14, 2002 2:34 am

Post by LightKnight » Tue Sep 02, 2003 8:58 am

I've modified Shin Noir's wonderful macro, to use pack items as well via an INI setting.

If any interest I will post it in this thread.

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

Post by Slice » Tue Sep 02, 2003 12:16 pm

Please do.

Light Knight
OMGFZ WARE R TEH SPAWNZ!1 I REINSTALLED
Posts: 33
Joined: Wed Apr 23, 2003 3:49 pm

Update to Shin Noir's macro to use packs.

Post by Light Knight » Wed Sep 03, 2003 6:25 pm

Code: Select all

########### Fletching ############ 

[CeramicVanes] 
item1=Field Point Arrowheads
item2=Bundled Wooden Arrow Shafts
item3=Set of Ceramic Arrow Vanes
item4=Large Groove Nocks
trivial=202
usepack=1
usepacktype=Fletching
skillused=Fletching
Added usepack,usepacktype and skillused.

Haven't got skillused working yet, but usepack needs to be 0(enviro),1(use pack), usepacktype is container type name.

Here is the code.

Code: Select all

|Shin Noir's Combine.mac Version 1.3 (8/18/03) 
| 
|Modified by Light Knight to handle packs (8/31/03)
|HOW TO SET UP FOR THIS MACRO: 
| 
|Before Starting: 
|1) Open all bags you have of the combinable items and put them all in their own area on the screen. 
|2) Close all these bags. Reopen them. (This will save their positions which is NECCESSARY for this .mac to work) 
|3) Open the Container you will be doing the combines in it's own free area. (Kiln, ect) 
|4) Close the container. Reopen it. 
|5) Double check all bags and the container needed for this macro are open are ready. 
| 
|How to Combine: 
| 
|/mac combine [CombineName] 
| 
|Please look at CombineReadMe.txt on how to get a list of Combine Names! 

#turbo 


#define StopAtTrivial "TRUE" |Set this to FALSE to do combines even if trivial. 
#define AutoWalk "FALSE" |Still in Testing Phase, Recommended FALSE 

|Don't Change These Variables Below! 
|v0 Boolean to let you continue next combine 
|v1 Current Pointer for Item list a(0,*) 
|v2 RunTime 
|v3 Used in PresetLoad 
#define OfficialName v4 
#define TrivialAt v5 
|v6 = CPH (Combines Per Hour) 
|v7 = # of Skillups 
|v8 = Fail # 
|v9 = Success # 
|v10 = combine wait 
#define OpenSpot v12 
|v13 = Old Bag Slot 
|v90 = Temp variable used for various quick comparisons 
|v91 = just like v90 
| 
|a(0,0) = Max Count of Items 
|a(0,1) = Item 1 
|..... 
|a(0,10)= Item 10 
|a(1,0) = Max Count of Delete Item List 
|a(1,1) = Delete Item 1 
|..... 
|a(1,9) = Delete Item 9 


#event CombineFail "You lacked the skills to fashion the items together." 
#event CombineSuceed "You have fashioned the items together to create something new!" 
#event CombineAlternate "You have fashioned the items together to create an alternate product" 
#event SkillTrivial "You can no longer advance your skill from making this item" 
#event SkillUp "You have become better at " 

Sub Main 

/varset v2 $running 

/call LoadPreset "$p0" "$p1" "$p2" "$p3" "$p4" "$p5" "$p6" "$p7" "$p8" "$p9" 

/if $cursor()!="NULL" { 
/echo Cannot run macro with $cursor(name) on cursor. 
/endm 
} 

/sendkey down ctrl 
| /if $ucase(Setup)=="TRUE" /call Setup 
  /varset v0 1 
/echo Press CTRL to exit at any time. 

:CombineLoop 
	/if n $v0==1 { 
    	/varset v0 0 
    	/varset t2 0 
    	/for v1 1 to $a(0,0) 
    		/varset v10 0 
     		/finditem "$a(0,$v1)" 
     		/varset t1 40 
      
     		:FindIt 

      		/if $t1<=10 /goto :NotFound 
      		/if $find()=="FALSE" /goto :NotFound 
      		/doevents 
      		/if "$cursor(name)"=="NULL" /goto :FindIt 
      		/goto :Found 

     		:Notfound 
      		/echo $a(0,$v1) was not found. 
      		/varadd v2 3 
      		/goto :Done 
     		:Found 
		/if $cursor(stack)>1 { 
      			/if $cursor(name)!="NULL" { 
       				/echo Error multiple items on cursor. ($Cursor(name) ($cursor(stack))) 
       			} else { 
       				/echo Cannot grab "$a(0,$v1)", aborting. 
       			} 
       			/goto :Done 
      		} 
		/if $v17==0 {
			/click left enviro $int($calc($v1-1)) 
		} else {
 	        	/click left pack $v19 $int($calc($v1-1))
		}
    		/doevents 
    	/next v1 
    	/if $a(0,0)<=5 /delay 4 |Code runs too fast won't register Combine when not many items lol 
     	/varset t2 50 
	/if $v17==0 {
		/click left enviro combine 
	} else {
		/delay 3
 	        /click left pack $v19 combine
	}
     	/doevents 

   } 
   :WaitForCombine 
   /doevents 
   /if $v10==0 /goto :WaitForCombine 
   /if "$cursor(name)"!="NULL" { 
   /varset v0 1 
   /call ClearCursor 
   } else { 
   /varset v0 1 
   } 
|   /if n $calc($running-$v1)>$calc($running+5) /call Done 
    /if $gm=="TRUE" /endm 
    /if $t2=="0" { 
    /echo 3 Second timeout waiting for Combine. 
    /goto :Done 
    } 

  /goto :CombineLoop 

:Done    
/echo $int($v8) Fails, $int($v9) Successes, $int($calc($v8+$v9)) Total Combines in $running secs. $calc($calc(60/$calc($running-$v2))*$calc($v8+$v9)) combines per minute. $int($v7) Skillups 
    /sendkey up ctrl    
/return 

Sub Event_CombineFail 
     /if $Cursor(name)!="NULL" { 
     /call ClearCursor 
|     /echo Error! $Cursor(name) ($cursor(stack)) is on the cursor after a fail. 
|     /endm 
     } 
     /doevents 
     |/delay 10 
     /varset v10 1 
     /varadd v8 1 
/if $int($calc($v8+$v9))==20 /echo $calc($calc(60/$running)*$calc($v8+$v9)) Combines Per Minute. 
/return 

Sub Event_CombineSuceed 
    /doevents | /delay 10 
     /varset v1 $running 
     /varadd v9 1 
     /varset v10 1 

   | /call ClearCursor 

/if $int($calc($v8+$v9))==20 /echo $calc($calc(60/$running)*$calc($v8+$v9)) Combines Per Minute. 
/return 

Sub Event_SkillTrivial 
/if StopAtTrivial=="TRUE" { 
/echo Combine has become trivial. $int($v9) Successes, $int($v8) Fails, $int($v7) skill ups 
/echo Edit Combine.mac if you want to do multiple combines of this item. 
/sendkey up ctrl 
/endm 
} 
/return 

Sub Event_SkillUp 
/varadd v7 1 
/return 

Sub Event_Timer 

/return 

sub FindOpenSlot 

|/echo Finding open slot... 
|find an open slot 
/for v91 0 to 7 |Go through packs 0 to 7 
  /if  $pack($v91,open)=="FALSE" /goto :NextPack |Go to next pack if this one isn't open. 
  /for v92 0 to $pack($v91,slots) |Search each slot for a free spot 
   /if "$item($v91,$v92,name)"=="NULL" { 
   |/echo Found slot $v92 empty of $pack($v91,name) 
   /varset OpenSpot 1 
   /goto :Bagged 
   } 
   /doevents 
   :FindNext 
   /next v92 
  
  :NextPack 
  /doevents 
/next v91 
/varset OpenSpot 0 
:Bagged 
/doevents 

/return 
Sub ClearCursor 

/varset v91 0 

|Check if item should be destroyed 
/if n $a(1,0)>0 { 
/for v91 1 to $a(1,0) 
  /echo "$lcase($a(1,$v91))"=="$lcase($Cursor(name))" 
  /if n "$lcase("$a(1,$v91)")"==$lcase("$Cursor(name)") /varset v91 1 
/next v91 
} 

/if $v91==1 { 
/echo $Cursor(name)($cursor(stack)) destroying... 
/click left destroy 
/doevents 
} else { |If an item is on the inventory that ISNT flagged as destroyable auto-equip 

|/echo $Cursor(name)($cursor(stack)) bagging... 
/if OpenSpot==0 { 
/echo Cannot Find Open Slot! 
/endm 
} 
:NextAuto 
/click left auto 
/doevents 
} 
     /if $Cursor()!="NULL" { 
|     /if $t3<>10 /goto :ErrorAuto 
     /if $t3==0 /varset t3 30 
     /goto :NextAuto 
     :ErrorAuto 
     /echo Error! $Cursor(name) ($cursor(stack)) is on the cursor after an attempt to Auto Equip
     /endm 
     } 
/return 

sub LoadPreset 

/if "$p0"=="" { 
/echo Syntax: /mac combine [name] [destroy1] [destroy2] ... [destroy9] 
/endm 
} 

|Get List of Items 
/if "$p0"=="list" { 
/if "$p1"!="" { 
  /if "$ini(tradeskill.ini,"$p1")"=="NOTFOUND" { 
   /echo Cannot find $p1. 
   /endm 
  } 

  /echo Items for $p1: 
  /for v3 1 to 10 
   /if "$ini(tradeskill.ini,"$p1","item$v3")"=="NOTFOUND" { 
    /goto :DoneList 
   } else { 
    /echo $ini(tradeskill.ini,"$p1","item$v3") 
   } 
  /next v3 
:DoneList 
  /endm 
} else { 
  /echo Syntax: /mac combine [list] [name] 
  /endm 
} 
} 

|Set Combine Items 
/for v3 1 to 10 
/if "$ini(tradeskill.ini,"$p0","item$v3")"=="NOTFOUND" { 
/varset a(0,0) $int($calc($v3-1)) 
/goto :FoundItems    
} else { 
/varset a(0,$v3) "$ini(tradeskill.ini,"$p0","item$v3")" 
} 
/next v3 
:FoundItems 

/if $v3==0 { 
/echo Invalid Combine Name! See CombineReadme.txt for how to get a list of combines 
/endm 
} 
/if "$ini(tradeskill.ini,"$p1","trivial")"=="notfound" {
/varset v16 0
/echo NoFind
} else {
/varset v16 "$ini(tradeskill.ini,"$p0","trivial")"
}

/if "$ini(tradeskill.ini,"$p1","usepack")"=="notfound" {
	/varset v17 0
	/echo NoFind
	} else {
	/varset v17 "$ini(tradeskill.ini,"$p0","usepack")"
	}

/if "$ini(tradeskill.ini,"$p1","usepacktype")"=="notfound" {
	/varset v18 0
	/echo NoFind
} else {
	/varset v18 "$ini(tradeskill.ini,"$p0","usepacktype")"
	/if $v17==1 {
		/call FindCombiner $v18
		/if $return==99 {
			/echo Cannot find "$v18"
			/endm 
		}
		/varset v19 $return
	} else {
		/varset v18 " "
	}
}

/if "$ini(tradeskill.ini,"$p1","skillused")"=="NOTFOUND" {
	/varset v20 0
	/echo NoFind
	} else {
	/varset v20 "$ini(tradeskill.ini,"$p0","skillused")"
	/varset v21 $char(skill,"$v20")
	}



|Set Delete List 
/varset a(1,0) 0 

/if "$p1"!="" { 
/varset a(1,1) "$p1" 
/varset a(1,0) 1 
} 

/if "$p2"!="" { 
/varset a(1,2) "$p2" 
/varset a(1,0) 2 
} 

/if "$p3"!="" { 
/varset a(1,3) "$p3" 
/varset a(1,0) 3 
} 

/if "$p4"!="" { 
/varset a(1,4) "$p4" 
/varset a(1,0) 4 
} 

/if "$p5"!="" { 
/varset a(1,5) "$p5" 
/varset a(1,0) 5 
} 

/if "$p6"!="" { 
/varset a(1,6) "$p6" 
/varset a(1,0) 6 
} 

/if "$p7"!="" { 
/varset a(1,7) "$p7" 
/varset a(1,0) 7 
} 

/if "$p8"!="" { 
/varset a(1,8) "$p8" 
/varset a(1,0) 8 
} 

/if "$p9"!="" { 
/varset a(1,9) "$p9" 
/varset a(1,0) 9 
} 

/return 

Sub FindCombiner 
	/varset p2 99 
	/for v99 0 to 7 
	/varset v33 $pack($v99,combine)
	/varset v33 $ucase("$v33")
	/varset v34 $ucase("$p0")
	/if $v33==$v34 /varset p2 $v99 
|	/if $ucase("$pack($v99,combine)")==$ucase("$p0") /varset p2 $v99 
	/next v99 
/return $p2 

mekaniak
a hill giant
a hill giant
Posts: 290
Joined: Thu Sep 18, 2003 3:21 pm

re

Post by mekaniak » Thu Sep 18, 2003 3:28 pm

I've been surfin around the boards for a week and a half now, so I have a pretty good understanding of whats goin on, so if you guys would like, I could throw together a list of tradeskill stuff over the next week or so...For the tradeskill.ini that is. Just let me know which tradeskill(s)/recipe(s) you want.