ID:150057
 
Was wondering, say you have an inventory list and in there you have say a burger, and you have a burger icon. How would you get that icon to show in the list in the game rather then text
You have to move it to the persons contents, like so;

obj
Burger
verb
Get()
set src in oview(1)
src.loc = usr.contents //Put it in their contents
del(src)

I hope I helped.

?The Wizard of How¿
In response to The Wizard of How
Hey, yea you did kind of, this is the code in my 'mobs.dmi'


mob/teach
Burgerguy
pl= 10
str = 10
def = 10
HP = 25
MAXHP = 250
icon='teach.dmi'
icon_state = "Burgerguy"
verb
Talk()
setcategory= "CoMmUnIcAtIoN"
set src in oview(1)
switch(input("You wana burger?",text) in list("Yes Please", "No ill leave"))
if("Yes Please")
usr << "Here you go, Eat up!"
usr:verbs += /obj/pod/verb/burger <----- something here?
if("No ill leave")
usr << "Hmph, Fine then!"


then in my other 'world.dm' file i have.(Below). so the code wizard gave me is if i was picking it up, but this way you dont see the burger on the ground you are getting it from an NPC, so how do i make it come up in the inventory in this way?


obj/burger
icon = 'burger.dmi'
verb
burger() <----- something here??
set category = "ItEmS"
src.loc = usr.contents
switch(input("How do u eat ur burger",text) in list ("Nicely","Like a pig","i dont"))
if("Nicely")
usr<<"You eat ur burger
if("Like a pig")
usr<<"You stuff ur face"
if("i dont")
usr<<"You save ur burger till later"
In response to Rukawa
mob/teach
Burgerguy
pl= 10
str = 10
def = 10
HP = 25
MAXHP = 250
icon='teach.dmi'
icon_state = "Burgerguy"
verb
Talk()
setcategory= "CoMmUnIcAtIoN"
set src in oview(1)
switch(input("You wana burger?",text) in list("Yes Please", "No ill leave"))
if("Yes Please")
usr << "Here you go, Eat up!"
usr:verbs += /obj/pod/verb/burger <----- something here?
<font color = #ffff00>var/obj/B = new /obj/burger() ---> Make a new burger item in the world.
B.Move(usr) ----> move the burger to the user's inventory</font>
if("No ill leave")
usr << "Hmph, Fine then!"


obj/burger
icon = 'burger.dmi'
verb
burger() <----- something here??
set category = "ItEmS"
src.loc = usr.contents
switch(input("How do u eat ur burger",text) in list ("Nicely","Like a pig","i dont"))
if("Nicely")
usr<<"You eat ur burger
if("Like a pig")
usr<<"You stuff ur face"
if("i dont")
usr<<"You save ur burger till later"


That should solve any problems you have with getting the burger to the user. However, if you're looking to actually see the burger in the inventory, you'll need to add this to your mobs:

mob
  ... //rest of mob code
  Stat()
    if(statpanel("Inventory"))
      stat(contents)


That should add a panel for your inventory, listing everything contained within it =P

<font color = #0000FF>Sapphiremagus</font>
<font color = #FF0000>Merry</font> <font color = #009900>Christmas</font> to those who observe it
Happy Holidays and Best Wishes to those who dont =)
In response to sapphiremagus
thats right but not what i was looking for =P~...i mean when i get the burger the user the WORD "burger" (as in TEXT) show up in the 'Inventory' ...i want my icon of the burger to show up in the Inventory not words...unless its the icon with the word underneath then its ok hehe...

thanks and merry xmas =D
In response to Rukawa
Rukawa wrote:
thats right but not what i was looking for =P~...i mean when i get the burger the user the WORD "burger" (as in TEXT) show up in the 'Inventory' ...i want my icon of the burger to show up in the Inventory not words...unless its the icon with the word underneath then its ok hehe...

thanks and merry xmas =D

An easy way to get the icon, and the suffix and be able to Click() it is, stat() a reference to the atom itself. Heres an example:

obj/Food/Burger
icon = 'Burger.dmi'
Click()
usr << "Mmmm! Cheeseburger!"
del(src)

mob/Stat()
statpanel("Food Articles")
for(var/obj/Food/F in src) // for everything in a sublevel or /obj/Food itself
stat(F) // now we are pointing directly at the food, instead of using it in a text string


Also note that, thanks to Dantom lists are supported in a lot of nice ways(If you stat a list, it works as a direct reference to the atoms within the list, ie this can be shortened to stat(contents) if the burger goes in your contents list)

Hope that helps,
Alathon
In response to Rukawa
Rukawa wrote:
Hey, yea you did kind of, this is the code in my 'mobs.dmi'


mob/teach
Burgerguy
pl= 10
str = 10
def = 10
HP = 25
MAXHP = 250
icon='teach.dmi'
icon_state = "Burgerguy"

You're making a dbz game aren't you.