Inventory Manager (tinyfugue)

From 3kWiki
Revision as of 13:52, 3 June 2013 by imported>Tuon
Jump to navigation Jump to search

Overview

Tinyfugue macros to manage and easily restock farming supplies.

Inventory Management Tools

/restock

Buys any items that are running low.

/def restock = \
	/supplies %;\
	/repeat -2 1 /buylow %; 

/display_totals

Formatted Inventory Results

/def display_totals = \
	/test echo(pad("+============",-13,"===",3,"=+=",3,"============",-12,"===",3,"=+=",3,"===========",-11,"===",3,"=+=",3,"==========",-10,"===",3,"=+=",3,"==========",-10,"===",3,"=+",2)) %;\
	/test echo(pad("| Fertilizer",-13,"Qty",3," | ",3,"Neutralizer",-12,"Qty",3," | ",3,"Water",-11,"Qty",3," | ",3,"Air",-10,"Qty",3," | ",3,"Pesticide",-10,"Qty",3," |",2)) %;\
	/test echo(pad("| ----------",-13,"---",3," | ",3,"-----------",-12,"---",3," | ",3,"----------",-11,"---",3," | ",3,"---------",-10,"---",3," | ",3,"--------",-10,"---",3," |",2)) %;\
	/test echo(pad("| Happy Ed's",-13,%{happy_tot},3," | ",3,"Cowville",-12,%{cowville_tot},3," | ",3,"Gulf Mex",-11,%{mexico_tot},3," | ",3,"Genlab",-10,%{genlab_tot},3," | ",3,"Hunch",-10,%{hunch_tot},3," |",2)) %;\
	/test echo(pad("| Alphabet",-13,%{alphabet_tot},3," | ",3,"Derthalas",-12,%{derthalas_tot},3," | ",3,"Wayhaven",-11,%{wayhaven_tot},3," | ",3,"Ryogi-Pei",-10,%{ryogi_tot},3," | ",3,"Ant Cave",-10,%{antcave_tot},3," |",2)) %;\
	/test echo(pad("| Hippie",-13,%{hippie_tot},3," | ",3,"Garou",-12,%{garou_tot},3," | ",3,"Atlantis",-11,%{atlantis_tot},3," | ",3,"Serinth",-10,%{serinth_tot},3," | ",3,"Faralain",-10,%{murus_tot},3," |",2)) %;\
	/test echo(pad("| Smurfy",-13,%{smurfy_tot},3," | ",3,"Burns Brand",-12,%{burns_tot},3," | ",3,"R'lyeh",-11,%{rlyeh_tot},3," | ",3,"Detroit",-10,%{detroit_tot},3," | ",3,"Perplexus",-10,%{perplexus_tot},3," |",2)) %;\
	/test echo(pad("+============",-13,"===",3,"=+=",3,"============",-12,"===",3,"=+=",3,"===========",-11,"===",3,"=+=",3,"==========",-10,"===",3,"=+=",3,"==========",-10,"===",3,"=+",2)) %;\

/supplies

Lists inventory of farming supplies.

/def supplies = \
	/set happy_tot 0 %;\
	/set alphabet_tot 0 %;\
	/set smurfy_tot 0 %;\
	/set hippie_tot 0 %;\
	/set cowville_tot 0 %;\
	/set derthalas_tot 0 %;\
	/set garou_tot 0 %;\
	/set burns_tot 0 %;\
	/set mexico_tot 0 %;\
	/set wayhaven_tot 0 %;\
	/set atlantis_tot 0 %;\
	/set rlyeh_tot 0 %;\
	/set genlab_tot 0 %;\
	/set ryogi_tot 0 %;\
	/set serinth_tot 0 %;\
	/set detroit_tot 0 %;\
	/set hunch_tot 0 %;\
	/set antcave_tot 0 %;\
	/set murus_tot 0 %;\
	/set perplexus_tot 0 %;\
	/send i %;\
	/repeat -1 1 /display_totals %; 

/buylow

Buys any item that is below 5 (full)

/def buylow = \
	/if (%{happy_tot} <5) /send buy happy ed %; /endif %;\
	/if ({alphabet_tot} <5) /send buy alphabet%;/endif %;\
	/if ({smurfy_tot} <5) /send buy smurfy%;/endif %;\
	/if ({hippie_tot} <5) /send buy hippie%;/endif %;\
	/if ({cowville_tot} <5) /send buy cowville%;/endif %;\
	/if ({derthalas_tot} <5) /send buy der'thalas%;/endif %;\
	/if ({garou_tot} <5) /send buy garou%;/endif %;\
	/if ({burns_tot} <5) /send buy burns%;/endif %;\
	/if ({mexico_tot} <5) /send buy gulf of mexico%;/endif %;\
	/if ({wayhaven_tot} <5) /send buy wayhaven%;/endif %;\
	/if ({rlyeh_tot} <5) /send buy r'lyeh%;/endif %;\
	/if ({genlab_tot} <5) /send buy genlab%;/endif %;\
	/if ({ryogi_tot} <5) /send buy ryogi%;/endif %;\
	/if ({serinth_tot} <5) /send buy serinth%;/endif %;\
	/if ({detroit_tot} <5) /send buy detroit%;/endif %;\
	/if ({hunch_tot} <5) /send buy hunch%;/endif %;\
	/if ({antcave_tot} <5) /send buy ant cave%;/endif %;\
	/if ({murus_tot} <5) /send buy murus faralain%;/endif %;\
	/if ({perplexus_tot} <5) /send buy mount perplexus%;/endif %;\
	/if ({atlantis_tot} <5) /send buy atlantis%;/endif %;\
	swoop all %;


Inventory Parsers

/def -p50 -mregexp -t"(\d)(.*)A bag of (.*) fertilizer \((.*)\)\." = \
	/set fert_name %{P3} %;\
	/set fert_name_tot 0 %;\
	/if ({P4} =~ "somewhat empty") /set fert_name_tot $[(fert_name_tot + 1)*%{P1}] %; /endif %;\
	/if ({P4} =~ "half-full") /set fert_name_tot $[(fert_name_tot + 2)*%{P1}] %; /endif %;\
	/if ({P4} =~ "somewhat full") /set fert_name_tot $[(fert_name_tot + 3)*%{P1}] %;  /endif %;\
	/if ({P4} =~ "almost full") /set fert_name_tot $[(fert_name_tot + 4)*%{P1}] %;  /endif %;\
	/if ({P4} =~ "full") /set fert_name_tot $[(fert_name_tot + 5)*%{P1}] %;  /endif %;\
	/if ({P3} =~ "Happy Ed's") /set happy_tot  $[happy_tot + fert_name_tot]%; /endif %;\
	/if ({P3} =~ "alphabet") /set alphabet_tot  $[alphabet_tot + fert_name_tot]%; /endif %;\
	/if ({P3} =~ "hippie") /set hippie_tot  $[hippie_tot + fert_name_tot]%; /endif %;\
	/if ({P3} =~ "smurfy") /set smurfy_tot  $[smurfy_tot + fert_name_tot]%; /endif %;\

/def -p50 -mregexp -t"(\d)(.*)A barrel of (.*) neutralizer \((.*)\)\." = \
	/set neut_name %{P3} %;\
	/set neut_name_tot 0 %;\
	/if ({P4} =~ "somewhat empty") /set neut_name_tot $[(neut_name_tot + 1)*%{P1}] %; /endif %;\
	/if ({P4} =~ "half-full") /set neut_name_tot $[(neut_name_tot + 2)*%{P1}] %; /endif %;\
	/if ({P4} =~ "somewhat full") /set neut_name_tot $[(neut_name_tot + 3)*%{P1}] %;  /endif %;\
	/if ({P4} =~ "almost full") /set neut_name_tot $[(neut_name_tot + 4)*%{P1}] %;  /endif %;\
	/if ({P4} =~ "full") /set neut_name_tot $[(neut_name_tot + 5)*%{P1}] %;  /endif %;\
	/if ({P3} =~ "Cowville") /set cowville_tot  $[cowville_tot + neut_name_tot]%; /endif %;\
	/if ({P3} =~ "Der'thalas") /set derthalas_tot  $[derthalas_tot + neut_name_tot]%; /endif %;\
	/if ({P3} =~ "Garou") /set garou_tot  $[garou_tot + neut_name_tot]%; /endif %;\
	/if ({P3} =~ "Burns brand") /set burns_tot  $[burns_tot + neut_name_tot]%; /endif %;\

/def -p50 -mregexp -t"(\d)(.*)A (barrel of|conch filled with) (.*) water \((.*)\)\." = \
	/set water_name %{P4} %;\
	/set water_name_tot 0 %;\
	/if ({P5} =~ "somewhat empty") /set water_name_tot $[(water_name_tot + 1)*%{P1}] %; /endif %;\
	/if ({P5} =~ "half-full") /set water_name_tot $[(water_name_tot + 2)*%{P1}] %; /endif %;\
	/if ({P5} =~ "somewhat full") /set water_name_tot $[(water_name_tot + 3)*%{P1}] %;  /endif %;\
	/if ({P5} =~ "almost full") /set water_name_tot $[(water_name_tot + 4)*%{P1}] %;  /endif %;\
	/if ({P5} =~ "full") /set water_name_tot $[(water_name_tot + 5)*%{P1}] %;  /endif %;\
	/if ({P4} =~ "Gulf of Mexico") /set mexico_tot  $[mexico_tot + water_name_tot]%; /endif %;\
	/if ({P4} =~ "Wayhaven") /set wayhaven_tot  $[wayhaven_tot + water_name_tot]%; /endif %;\
	/if ({P4} =~ "Atlantis") /set atlantis_tot  $[atlantis_tot + water_name_tot]%; /endif %;\
	/if ({P4} =~ "R'lyeh") /set rlyeh_tot  $[rlyeh_tot + water_name_tot]%; /endif %;\

/def -p50 -mregexp -t"(\d)(.*)A tank of (.*) air \((.*)\)\." = \
	/set air_name %{P3} %;\
	/set air_name_tot 0 %;\
	/if ({P4} =~ "somewhat empty") /set air_name_tot $[(air_name_tot + 1)*%{P1}] %; /endif %;\
	/if ({P4} =~ "half-full") /set air_name_tot $[(air_name_tot + 2)*%{P1}] %; /endif %;\
	/if ({P4} =~ "somewhat full") /set air_name_tot $[(air_name_tot + 3)*%{P1}] %;  /endif %;\
	/if ({P4} =~ "almost full") /set air_name_tot $[(air_name_tot + 4)*%{P1}] %;  /endif %;\
	/if ({P4} =~ "full") /set air_name_tot $[(air_name_tot + 5)*%{P1}] %;  /endif %;\
	/if ({P3} =~ "Genlab") /set genlab_tot  $[genlab_tot + air_name_tot]%; /endif %;\
	/if ({P3} =~ "Ryogi-Pei") /set ryogi_tot  $[ryogi_tot + air_name_tot]%; /endif %;\
	/if ({P3} =~ "Serinth") /set serinth_tot  $[serinth_tot + air_name_tot]%; /endif %;\
	/if ({P3} =~ "Detroit") /set detroit_tot  $[detroit_tot + air_name_tot]%; /endif %;\

/def -p50 -mregexp -t"(\d)(.*)A barrel of (.*) pesticide \((.*)\)\." = \
	/set pest_name %{P3} %;\
	/set pest_name_tot 0 %;\
	/if ({P4} =~ "somewhat empty") /set pest_name_tot $[(pest_name_tot + 1)*%{P1}] %; /endif %;\
	/if ({P4} =~ "half-full") /set pest_name_tot $[(pest_name_tot + 2)*%{P1}] %; /endif %;\
	/if ({P4} =~ "somewhat full") /set pest_name_tot $[(pest_name_tot + 3)*%{P1}] %;  /endif %;\
	/if ({P4} =~ "almost full") /set pest_name_tot $[(pest_name_tot + 4)*%{P1}] %;  /endif %;\
	/if ({P4} =~ "full") /set pest_name_tot $[(pest_name_tot + 5)*%{P1}] %;  /endif %;\
	/if ({P3} =~ "Hunch") /set hunch_tot  $[hunch_tot + pest_name_tot]%; /endif %;\
	/if ({P3} =~ "Ant Cave") /set antcave_tot  $[antcave_tot + pest_name_tot]%; /endif %;\
	/if ({P3} =~ "Murus Faralain") /set murus_tot  $[murus_tot + pest_name_tot]%; /endif %;\
	/if ({P3} =~ "Mount Perplexus") /set perplexus_tot  $[perplexus_tot + pest_name_tot]%; /endif %;\