ID:163188
 
How can I make an Item apear on the screen and as well in my inventory.. The onscreen one would act like a shortcut.
you mean like picking up an object and it shows what you picked up on your screen?
In response to Jman9901
No like... a duplicate of the item but its still the same item as a whole...
In response to Hellonagol
so you want the item to come up somewhere else instead of the inventory?
In response to Jman9901
no in the inventory AND on the screen
In response to Hellonagol
okay, but on the screen, or on a panel next to the screen?
In response to Jman9901
on the screen. My game has an inventory that is not in a panel
In response to Hellonagol
You aren't going to be able to have the object in two places at the same time. You are going to have to have a dummy object on screen that acts like the orginal.
In response to Hellonagol
okey dokey, you can just copy and paste this, but im gonna explain along the way how to do this...

mob
var
get = 0 //when we pick something up, this will be "= 1"

mob //the player mob
verb //the action/command
get(obj/O in oview(1)) //this is so you can only pick up objects within 1 tile of the mob...
get += 1 //or "get ++", but i like to specify
O.loc = usr //moves the object to the inventory...
New(client/C) //New() proc for the screen
screen_loc = "1,1" //puts the obj you got onto your screen
C.screen += src //putting it on the usr's screen only


i dont know if that'll work or not (it should), but after that, it goes onto this...

obj //the object
if(get == 1) //if they picked it up
new/obj/O(src.client) //puts it on the screen


all of that should work, im not all entirely sure about the second part... so if any of the other coders find a problem with it, feel free to edit! :)
In response to Revenant Jesus
well hazordhu has a hud and it shows the items in it... you can right click them and choose actions.. they work like the inventory one... How can I do this but just 1
In response to Revenant Jesus
exactly what i did
In response to Hellonagol
that's a grid (i think), what i asked you was if you wanted a grid (the panel)...
In response to Jman9901
K I will try your code
In response to Jman9901
The object has the get verb not the mob... How can I make this work
obj
Items
screen_loc="3,3"
icon = 'Objs.dmi'
SoundStone
icon_state = "soundstone"
description = "Used to teleport you back to Newb Town."
verb
Get()
set src in oview(0)
Move(usr)
usr << sound('sound/get.wav',,,2,)
if(usr.InventoryUp)
usr.CreateInventory()
Drop()
set src in usr
set category = null
if(usr.InventoryUp)
Move(usr.loc)
usr.CreateInventory()
view() << sound('sound/drop.wav',,,2,)
else
Move(usr.loc)
Use()
set src in usr
set category = null
if(usr.team == "Bad")
usr << "It doesn't do a thing."
return
usr:Inventory()
usr.lockinventory = 1
if(usr.sound == 1)
usr << sound(null)
usr << sound('soundstone.mid')
usr.overlays += 'soundstone.dmi'
usr.move = 0
usr.dir = SOUTH
sleep(15)
usr.dir = EAST
sleep(10)
usr.dir = NORTH
sleep(10)
usr.dir = WEST
sleep(10)
usr.dir = SOUTH
sleep(5)
usr.dir = EAST
sleep(5)
usr.dir = NORTH
sleep(5)
usr.dir = WEST
sleep(5)
usr.dir = SOUTH
sleep(5)
usr.dir = EAST
sleep(5)
usr.dir = NORTH
sleep(5)
usr.dir = WEST
sleep(5)
usr.dir = SOUTH
sleep(5)
usr.dir = EAST
sleep(5)
usr.dir = NORTH
sleep(5)
usr.dir = WEST
sleep(5)
usr.dir = SOUTH
usr.overlays -= 'soundstone.dmi'
usr.lockinventory = 0
usr.overlays += 'soundstone2.dmi'
view() << sound('sound/psi2.wav',,,2,)
sleep(15)
usr.overlays -= 'soundstone2.dmi'
usr.loc=locate(13,22,2)
usr.move = 1
if(usr.sound == 1)
usr << sound(null)
usr << sound('eb_onett.mid')
usr.lastsound = "midi/eb_onett.mid"
In response to Hellonagol
get rid of the screen loc and put it at the end of the code like this...

 //your code
New(client/C)
screen_loc = "3,3"
C.screen += src
In response to Jman9901
What happens if there's no client defined when it's created? It won't show!

It's more like he has to add the object when picked up and take it off when dropped.
Get(...)
...
usr.client.screen += src // Adds the item, will show up on screen if defined

Drop(...)
...
usr.client.screen -= src // Takes away the item from the screen
Though remember to always safety check (ex: if another item is in the same position on the screen, do 'if(src in usr.client.screen)' before removing the item from the screen (to avoid runtime errors if someone clicked the verb multiple times), etc.)
In response to GhostAnime
oooookay... i knew i was getting something messed up... thanks. :)
In response to Jman9901
Eh no problem. When you start making more projects, you learn to think about problems ahead of time, such as:

"Will this work the way I want it to?"
"Is there any obvious flaw that will reduce the # of players in my game or make it unfair?"
"What is the aftermath if I put this in?"
"What will happen if this does not exist?"
"What must I add in order to stop any runtime error that may occur?"
" [usually in the future] If there a better alternative of doing this?"

etc.