ID:2098048
 
I need to make a verb that can examine an object. But I need it so you can right click it or make a hotkey for it like shift+click, just like in Space Station 13. And I want it to show the exact description. When I tried to do it like this:

verb
examine(obj as obj)
world << "[obj]"




I know the code is stupid, but aint I getting somewhere? when I launch it and push the examine verb, it shows me "The rock" (my obj)
Those results make sense, as you are outputting the object itself, not the object's description.

Related:
Nono, but I need to output the description, not the object itself. I'm just a noob at coding.
In response to CoolGod1198
CoolGod1198 wrote:
Nono, but I need to output the description, not the object itself. I'm just a noob at coding.

Exactly. Read my previous response and make sure you look at the link provided. You have the information you need to reach your goal.

To be succinct in restating my initial post: You need to output the object's description (i.e. the desc variable, for example) instead of the object. However, outputting the object always results in the name of the object -- that can't be changed.
How do I make desc a variable? Byond doesn't seem to find it at all.
In response to CoolGod1198
CoolGod1198 wrote:
How do I make desc a variable? Byond doesn't seem to find it at all.

The desc variable is part of the atom tree. This means only atoms and derivatives of atoms have said variable.

If you are getting errors, you either are accessing it incorrectly, or the source object is not an atom type.

Showing your code would help though.
mob
icon = 'player.dmi'

verb
smile()
world << "[usr] smiles."

deathgasp()
world << "[usr] seizes up and falls limp, his eyes dead and lifeless."

say(txt as text)
world << "[usr] says [txt]"

frown()
world << "[usr] frowns."

cry()
world << "[usr] cries \his eyes out."

look()
world << "[desc]"


turf
floor
icon = 'floor.dmi'

wall
icon = 'wall.dmi'
density = 1

obj
rock
icon = 'rock.dmi'
density = 0
desc = "A rock that doesn't do anything yet."







I am trying to output the rock's desc.
I failed to mention that you want to wrap all code in <dm> </dm> tags to ensure it displays properly.
mob
icon = 'player.dmi'

verb
smile()
world << "[usr] smiles."

deathgasp()
world << "[usr] seizes up and falls limp, his eyes dead and lifeless."

say(txt as text)
world << "[usr] says [txt]"

frown()
world << "[usr] frowns."

cry()
world << "[usr] cries \his eyes out."

look()
world << "[desc]"


turf
floor
icon = 'floor.dmi'

wall
icon = 'wall.dmi'
density = 1

obj
rock
icon = 'rock.dmi'
density = 0
desc = "A rock that doesn't do anything yet."
test
test
If that is how your code actually looks, your indentation is all wrong. An example of how you can fix your type tree:

turf
ground
desc = "A ground turf."
grass
dirt

floor

wall

obj
rock


In your code's current state, your rock object isn't an obj type, it's a datum. On second thought, I'd be surprised if that let you compile.
I have to go now, talk to ya later. But how is it wrong? It is good for coding.
And yes, it let me compile.
In response to CoolGod1198
CoolGod1198 wrote:
I have to go now, talk to ya later. But how is it wrong? It is good for coding.

I told you how it's wrong in my last post. But no, it's not "good for coding" -- it's messy and incorrect, hence why you are getting unexpected results.

I'll be around though when you come back to this. It's my weekend off anyway.
In response to CoolGod1198
And you are still having problems?

What does the examine verb look like.
In response to CoolGod1198
Unless you have a time(input) proc, then using time(1) is wrong; sleep() is the correct syntax.