ID:177540
 
I've attempted and failed many time already. could you explain how or give me the code. How would I make a sell system that when you choose the verb sell First thing it asks you is what you want to sell. When you choose mineral it asks you how much you want to sell. You can put any whole number non negative. It sell each mineral for 5 gold. And if you don't have enough minerals it tells you that you don't have enough minerals. the number can range from 1 to 10,000. That other question I asked I don't count as being from today.
i am still a new to coding but i think it goes like this

mob/verb/sell(obj/o in usr.contents)
if(!o)
usr << "You dont have anything to sell"
return
else
if(istype(o,/obj/mineral))
var/amount = input("How much to sell?") as num
if(amount == 0 || amount == null)
return
if(amount < 0)
usr << "You can't sell negative number of [o]"
return
else
usr << "You sell [amount] of [o]for [amount*5]"
usr:contents -= o
usr.money += amount * 5
i am not really sure how to subtract the amount :-P sorry
hope that much helps
Vortezz has a shopkeeper demo for the BCC...

http://www.byond.com/hub/Sariat/BYONDcodeclient
Codesterz wrote:
I've attempted and failed many time already. could you explain how or give me the code. How would I make a sell system that when you choose the verb sell First thing it asks you is what you want to sell. When you choose mineral it asks you how much you want to sell. You can put any whole number non negative. It sell each mineral for 5 gold. And if you don't have enough minerals it tells you that you don't have enough minerals. the number can range from 1 to 10,000. That other question I asked I don't count as being from today.

I can give you a leg up on the number question: A lot of people don't think about the consequences of a player putting in a bogus number, or if they do they only think about negatives, but not decimals. You definitely were on the ball spotting this.

Here's the lowdown:
var/n = input("How many?","How many?",0) as num
n=max(round(n,1),0)
if(!n) return // Selling 0? Guess they're not interested.

Lummox JR