ID:146408
 
Code:
                        var/sell_stock = input("Sell what?","Sell Stock") in sell
src << "Selling [sell_stock]"
var/position = src.stock.Find(sell_stock)
var/sell_amount = input("How much?", "How Much?") as num
if(sell_amount > src.amount[position])
src << "You don't have that much"
else
src.amount -= sell_amount
var/add_position = solace_stock.Find(sell_stock)
solace_amount_available[add_position] += sell_amount
src << "Sold [sell_amount] of [sell_stock]."


Problem description:
I can't seem to work out why this piece of code skips the selection part where you select an item from the list, and goes straight to the inputting of a number. I've tried everything I can to get it to work but no matter what I do it still just keeps skipping to the amount part.


Thanks in advance guys.

- GunRunner
What does it say when it outputs "Selling [sell_stock]"?
I'm guessing that you're sell list is either empty or only has one item in it. If it has one item in it that item will automatically be selected.
In response to DarkView
I should've added that in. I'm definite that the list has more than one entry and that the list is not empty as there is a check for list length beforehand. I've had experience with lists and I know all about their behaviour as well as inputs, but no matter what it just selects the first entry in the list without prompting the user.

As for the ouput the first item in the sell list is Aluminum and hence the line "Selling [sell_stock]" outputs "Selling Aluminium".

[EDIT]

I fixed the problem by giving the user a chnace to set the option to null. For soem reason or another this changes it so that both prompts show up.

Thanks guys
- GunRunner