ID:722407
 
(See the best response by .screw.)
Code:
mob
npc
Poorseller
icon='Npc.dmi'
icon_state="Shoper"
verb
Shop()
set src in oview(1)
switch(input("What Do You Wish To Buy","","Batman Helm","OldNavyShirt","AmericanEaglePants"))
if("Batman Helm")
if(usr.Gold >= 15)
switch(input("Do you want a Batman Helm It cost $15","","Yes","No"))
if("Yes")
usr.contents += new /obj/pickup/BatmanHelm
usr.Gold -= 15
if("No")return
if("OldNavyShirt")
if(usr.Gold >= 15)
switch(input("Do you want a Old Navy Shirt It cost $15","","Yes","No"))
if("Yes")
usr.contents += new /obj/pickup/OldNavyShirt
usr.Gold -= 15
if("No")return
if("AmericanEaglePants")
if(src.Gold >= 50)
switch(input("Do you want a American Eagle Pants It cost $50","","Yes","No"))
if("Yes")
usr.contents += new /obj/pickup/AmericanEaglePants
usr.Gold -= 50
if("No")return


Problem description: Yes you guys helped me with this but the thing is the input is not appearing( the list of items to buy and the yes or no) but when i change it to something else like alert it works but i really want mines to be input how can i fix this?

switch(input("Do you want a Batman Helm It cost $15","","Yes","No"))


Wrong .. completely wrong..

This is an example from the DM Reference I suggest you use it... You should also read the DM Guide personally I am sick of seeing people code grabbing from the forums because they won't learn it themselves ..

Example:
mob/verb/create_character()
usr.name = input("Choose a name for your character.",
"Your Name",
usr.name)

usr.gender = input("Select a gender for your character.",
"Your Gender",
usr.gender) in list("male","female","neuter")
Best response
Instead of:
input("What Do You Wish To Buy","","Batman Helm","OldNavyShirt","AmericanEaglePants")


You need to do:
input("What Do You Wish To Buy?","Buy Menu") in list("Batman Helm","OldNavyShirt","AmericanEaglePants")



As a recommendation, look at the reference to see how you should format a procedure.

Input format:
input(Usr=usr,Message,Title,Default) as Type in List

- - - - - - - - - -
Once again, ATHK beat me to the punch!
Just to mention, this whole system you have here is very convoluted and entirely ignores object-orientated programming. For every single time you want a merchant, you're going to have to write up a circuitous routine to determine what items they have and the price by hand in a monstrous switch() statement.
Hi Whybe.

As I mentioned in a previous post in one of your Developer Help topics - I'm not sure where that post went, as I can't seem to find it - you seem to be misunderstanding a little what it's here for.

As .screw has said - and ATHK has note a little less politely - you really need to consult the Reference when using a function, and spend some time trying to learn DM on your own. You could have fixed your problems with Input() by taking a look at the reference page on Input() accessible by;

-Pressing F1 in Dream Maker
-Going to "Search."
-Typing in "Input" and selecting it in the search results panel.
-Reading.


Currently, you've submitted 13 Dev Help requests for answers to very simple logic problems in a month; you could have avoided all or most of these by simply following one of the many guides available.

Yes, I know there is a lot to read. Yes, it is a lot of work. And yes, it might be "boring," but if you want to make a game you have to put the effort in.
I've had a chat with another Mod, and...

Realistically, I'd like to see some improvement on your own skills before another Developer Help request appears from you, or we're going to have to see about having you take an enforced break from posting for a bit.