@program housemice.muf 1 1000 d i $include $lib/rp $include $lib/alynna $include $lib/market lvar param : housecalc var basecost var numrooms var numfronts var numunits var numlaborers var efficiency var laborcost var labortotal var buildtime var totaladdl var marketfood var totalfood var tfoodcost var tcost var mode ( grab the mode ) mode ! ( set base cost ) mode @ case "slum" smatch when 0.0 basecost ! end "common" smatch when 10.0 basecost ! end "merchant" smatch when 15.0 basecost ! end "noble" smatch when 20.0 basecost ! end endcase ( Number of rooms? ) "Number of rooms?" "Housemice" pretty tellme read tofloat numrooms ! ( Number of storefronts? ) mode @ "merchant" smatch if "Number of storefronts?" "Housemice" pretty tellme read tofloat numfronts ! else 0 numfronts ! then ( Number of units? ) mode @ "merchant" smatch if numfronts @ if numfronts @ 1 + else 0 then numrooms @ 1.0 + + numunits ! else numrooms @ 1.0 + numunits ! then ( Number of laborers? ) "Number of laborers?" "Housemice" pretty tellme read tofloat numlaborers ! ( Efficiency of laborers? ) "Number of laborers (0 for the default 100%)?" "Housemice" pretty tellme read tofloat efficiency ! efficiency @ 0.0 = if 1 efficiency ! else efficiency @ 100.0 / efficiency ! then ( Build time? ) numunits @ numlaborers @ / 1.0 efficiency @ / * 1.0 + int float buildtime ! ( Labor cost? ) "slaves" find-price 2 / efficiency @ efficiency @ efficiency @ * * * laborcost ! ( Labor total? ) numlaborers @ buildtime @ laborcost @ * * labortotal ! ( Cost of chow ) "Average food" find-price marketfood ! ( Total chow required ) buildtime @ numlaborers @ * efficiency @ efficiency @ * * totalfood ! ( Total cost of chow ) marketfood @ totalfood @ * tfoodcost ! ( total cost to build ) basecost @ labortotal @ tfoodcost @ + + tcost ! { "Costs and time for house, type " mode @ strcat str "Base Cost................................................. " basecost @ 2 fchop " gil" cat "-[ House specs ]------------------------------------------ " str "Number of rooms........................................... " numrooms @ 2 fchop " rooms" cat mode @ "merchant" smatch if str "Number of storefronts..................................... " numfronts @ 2 fchop " storefronts" cat then str "Number of units........................................... " numunits @ 2 fchop " units" cat str "Laborers.................................................. " numlaborers @ 2 fchop " laborers" cat str "Labor efficiency.......................................... " efficiency @ 100 * 2 fchop "%" cat "-[ Labor costs ]------------------------------------------ " str "Build time................................................ " buildtime @ 2 fchop " days" cat str "Going wage for labor...................................... " laborcost @ 2 fchop " gil" cat str "Total wages to pay to laborers............................ " labortotal @ 2 fchop " gil" cat "-[ Food costs ]------------------------------------------- " str "Current market price of average food...................... " marketfood @ 2 fchop " gil" cat str "Food units required to feed crews......................... " totalfood @ 2 fchop " units" cat str "Total cost of food........................................ " tfoodcost @ 2 fchop " gil" cat " " str "Total cost to build house................................. " tcost @ 2 fchop " gil" cat } array_make atellhere ; : main param ! me @ "B" flag? me @ staff? not if "Must be builder or on staff to use." "House" pretty tellme exit then command @ tolower case "+house/slum" smatch when "slum" housecalc end "+house/common" smatch when "common" housecalc end "+house/merchant" smatch when "merchant" housecalc end "+house/noble" smatch when "noble" housecalc end endcase ; . c q