ID:262938
 
Code:
turf
Shop
icon = 'NPC.dmi'
density=0
verb/Buy()
set src in oview(1)
var/Buying = input("Hi [usr] what would you like to buy?")in list("ETank(300z)","No Thanks")
if(Buying=="ETank(300z)")
usr << "You can use this to heal most of your HP."
sleep(6)
usr << "..."
if(usr.zenny >= 300)
usr.zenny -= 300
new/obj/ETank(usr)
usr <<"Here you go!"
sleep(3)
usr <<"please come again!"
sleep(3)
//Objects
mob
var
price = 0 //items worth
obj
ETank //the green orb
icon = 'Items.dmi'
icon_state = "E-Tank"
Click()
view() << "[usr] used E-Tank."
view() << "[usr] recovered some hp!"
usr.hp += 50
if(usr.hp > usr.maxhp) usr.hp = usr.maxhp
del(src)


Problem description:The problem is that the Item Appears in the stat panel but it's name doesn't show up and you can't use it.. I need some help, thanks

Um, please provide a snippet of the statpanel for the items than please :)

EDIT:
And you might want to make Click() things be a bit more protective like:
Click()
if(!src in usr.contents)return


The reason I said that is because if someone clicked the item, even if it isn't in that person's inventory, they can use that item...

That is, add it if you don't want that to happen (person's health gets refilled without it being in their inventory)

- GhostAnime
In response to GhostAnime
GhostAnime wrote:
Um, please provide a snippet of the statpanel for the items than please :)

EDIT:
And you might want to make Click() things be a bit more protective like:
> Click()
> if(!src in usr.contents)return

The reason I said that is because if someone clicked the item, even if it isn't in that person's inventory, they can use that item...

That is, add it if you don't want that to happen (person's health gets refilled without it being in their inventory)

- GhostAnime
    Stat()
statpanel("You")// This created a new statpanel
stat(usr)
statpanel("Players")
for(var/mob/M in world)
stat("[M.name]","[M.key]")
stat("")
stat(" ")
statpanel("Items") //makes a tab called Inventory
stat(usr.contents) //usr's contents is under Inventory
In response to Kiyo Takamine
Try changing
 statpanel("Items") //makes a tab called Inventory
stat(usr.contents) //usr's contents is under Inventory


to something like this:

 statpanel("Items") //makes a tab called Inventory
for(var/tmp/obj/O in src.contents)//src.contents, usr.contesnts, samething in mob/Stat()
stat(O) //usr's contents is under Inventory


Atleast I think that's how it went... or it was stat("",O)...meh, experiment.

Reason why I said to change it to that is so you can easily make exceptions to what items can be shown

That and it was all I can think of at a spur of the moment (I am at work right now).

- GhostAnime
In response to GhostAnime
mob // not turf...
Shop
icon = 'NPC.dmi'
density=0
verb/Buy()
set src in oview(1)
var/Buying = input("Hi [usr] what would you like to buy?")in list("ETank(300z)","No Thanks")
if(Buying=="ETank(300z)")
usr << "You can use this to heal most of your HP."
sleep(6)
usr << "..."
if(usr.zenny >= 299)// u had it at 300 which meaning they couldn't have exactly 300 zenny
usr.zenny -= 300
var/O = new/obj/ETank
usr.contents += O
usr <<"Here you go!"
sleep(3)
usr <<"please come again!"
sleep(3)
//Objects
mob
var
price = 0 //items worth
obj
ETank //the green orb
icon = 'Items.dmi'
icon_state = "E-Tank"
Click()
if(!src in src.contents)return
if(usr.hp == usr.maxhp)usr<<"Your health is full"return
view() << "[usr] used E-Tank."
view() << "[usr] recovered some hp!"
usr.hp += 50
if(usr.hp > usr.maxhp) usr.hp = usr.maxhp
del(src)


That should work if not im sorry im so very tired

A.T.H.K