Once again I approach my fellow coders for advice, as I have bumped into yet another problem. I have searched the entire BYOND website and found shopkeeping demos, but none of which are suting my needs. I created my own and have run into a small problem. Heres the code, and the problem will be stated bellow it.
////////////////////////////////////////////////////////////
mob
Bartender
icon = 'bartender.dmi'
density = 1
verb
Talk_to_Bartender()
set src in oview(3)
switch(input("Hi, plz buy something","shopkeeper",text)in list("Boxy","Ball"))
if("Boxy")
alert("You pay 50 gold for a boxy")
usr.gold-=50
usr.contents+= new/obj/boxy
if("Ball")
alert("You pay 20 gold for a ball")
usr.gold-=20
usr.contents+= new/obj/ball
..()
obj/boxy
icon = 'boxy.dmi'
obj/ball
icon = 'ball.dmi'
////////////////////////////////////////////////////////////
Ypu see, where it says usr.contents+= new/obj/(name of object" is where the problem lies. I am using the onscreen inventory demo, if i use usr.contents nothing appears in my inventory boxes on the screen. When I use usr.items a runtime error appears when buying the object, and when I use usr.inventory or user.Inventory I come up with an undefined var error. So you see I am lost, I know this may seem confusing but this is why I am asking for help. If you need the onscreen inventory code plz just ask. As usuall, any help granted will be included on my special thanks coloumn of my game.Thanks for any help possible,
The Conjuror.
ID:261775
![]() May 31 2003, 1:20 pm
|
|
That should fix ur problem, and u might want to make it check if u have enouph gold or not. And tell how much each item is worth. (Just advice) BTW, put DM around ur code with <> around the DM. At the end of code put /DM with the <> around it.