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 ""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
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
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"



