@verb #9491:":trade" this none this rxdo #7951 @program #9491:":trade" this none this {p} = args found = 0 holds = p.current_ship.holds - p.current_ship.ore - p.current_ship.organics - p.current_ship.equipment "TODO: ORGANIZE THREE TYPES SO THAT PLAYER SELLS BEFORE BUYING." for item in ({"ore", "organics", "equipment"}) if (this.(item) > 0 && holds > 0 || (this.(item) < 0 && p.current_ship.(item) > 0)) if (found == 0) p:tell("You have " + tostr(p.cash) + " credits and " + tostr(holds) + " empty cargo holds.") endif found = 1 amount = this.(item) > 0 ? this.(item) < holds ? this.(item) | holds | p.current_ship.(item) "DON'T KNOW HOW PRICING WORKS, WILL DO IT RANDOMLY." if (item == "ore") sellprice = (80.0 + tofloat(random(100))) / 10.0 buyprice = sellprice * 1.6 elseif (item == "organics") sellprice = (180.0 + tofloat(random(60))) / 10.0 buyprice = sellprice * 1.8 elseif (item == "equipment") sellprice = (280.0 + tofloat(random(40))) / 10.0 buyprice = sellprice * 2.0 endif p:Tell("") p:tell("We are " + (this.(item) > 0 ? "selling" | "buying") + " up to " + tostr(abs(this.(item))) + ". You have " + tostr(p.current_ship.(item)) + " in your holds.") p:tell("How many holds of " + (item == "ore" ? "Fuel Ore" | $su:capitalize(item)) + " do you want to " + (this.(item) > 0 ? "buy" | "sell") + " [" + tostr(amount) + "]? ") amt = $cmd_utils:read() amt = amt == "" ? amount | toint(amt) if (amt > 0) sellprice = toint(sellprice) * amt buyprice = toint(buyprice) * amt p:tell("Agreed, " + tostr(amt) + " units.") p:tell("") p:tell("We'll " + (this.(item) > 0 ? "sell" | "buy") + " them for " + tostr(this.(item) > 0 ? sellprice | buyprice) + " credits.") p:tell("Your offer [" + tostr(this.(item) > 0 ? sellprice | buyprice) + "] ?") offer = $cmd_utils:Read() offer = offer == "" ? this.(item) > 0 ? sellprice | buyprice | toint(offer) "ENTER BARGAINING CODE HERE" if (offer == 0) player:tell("Nothing in this universe is free, my friend.") else player:tell("I hate haggling, they're all yours.") endif endif endif endfor if (!found) p:tell("") p:tell("You don't have anything they want, and they don't have anything you can buy.") return endif "Last modified by Dax (#789) on Tue May 3 14:09:37 2005 MDT." .