@verb #1409:"sell" none none none rxdo #8084 @program #1409:"sell" none none none caller_perms() == player || raise(E_PERM) index = player in this.user_objs if (!index) return player:tell("error: not a user of the FO.") endif ui = this.user_info[index] this:portfolio() symbol = $cmd_utils:read("stock symbol to sell") if (!(li = listassoc(symbol, ui[2]))) return player:tell("You don't own any shares with that symbol.") endif amount = $cmd_utils:read("number of shares to sell") amount = toint(amount) if (amount <= 0) return player:tell("Come on, be a player, sell more than that.") elseif (amount > li[2]) return player:tell("You don't own /that/ many!!!") endif this:force_update(symbol) value = listassoc(li[1], this.quotes)[2] if (value == -1) value = this:_get_index() endif if (!$cmd_utils:yes_or_no("You will make " + $su:currency(value * tofloat(amount)) + ". Continue? ")) return player:tell("Fine, be that way.") endif if (amount == li[2]) ui[2] = listdelete(ui[2], li in ui[2]) else liindex = li in ui[2] ui[2][liindex][2] = ui[2][liindex][2] - amount ui[2][liindex][3] = ui[2][liindex][3] - tofloat(amount) * value endif ui[1] = ui[1] + tofloat(amount) * value this.user_info[index] = ui player:tell("Sale complete.") "Last modified by Dax (#789) on Tue May 3 14:09:33 2005 MDT." .