ID:140978
 
Code:
obj
book
icon='books.dmi'
Fire_skill_book
icon_state="fire1c"
var
open=0
close=1
Open()
if(open==0)
icon_state="fire1o"
open++
___ <<"You opened this book"
else
___ << "This book is already opened"
Close()
if(close==0)
icon_state="fire1c"
close++
___ << "You closed this book"
else
___ << "This book is already closed"


Problem description:

i really need help with this, idont know what to type in ___, i want to send this message to person who opened or closed book, but i know that you cant type usr in proc and i dont know any other ways. please help me

But what you want here are verbs, not procs, so you WILL be using usr there. Of course, you have to actually declare the verb first with the verb keyword, or you will get that error. Looks like you need to read the DM Guide.
Also, having both those 'open' and 'close' vars like that is pretty stupid. All you need is one var which can only be on/true or off/false that indicates whether e.g. the book is open, or not.
obj/item/book
var/open = 0
verb/Open_Close()
if(src.open) //if the var is true (e.g. set to 1)
usr << "You close the book."
src.open = 0
else
usr << "You open the book."
src.open = 1
In response to Kaioken (#1)
but there is one problem, you cant use this verb
In response to Martys1103 (#2)
Normally, of course not. Verbs have conditions to whether there they're accessible or not. In this case, the verb uses the default src setting for obj sources, which is set src in usr, meaning the obj (book) has to be inside the player for him to have access to it. Also refereed to as: "being inside his inventory". Otherwise, the verb won't be accessible. You could use a different src setting if you want it to be available under different circumstances. Assuming you want the book to be an inventory item (in which case it's better off as /obj/item/book instead), then the default should probably be fine, though.
In response to Kaioken (#3)
but im trying to make it openable and readable when it is on ground, not in inventory
In response to Martys1103 (#4)
Did you read what Kaioken wrote? S/He said to change the src setting if you don't want it to be in the usr's inventory. From the reference:

src setting (verb)
Format:
set src in List
set src = List
Args:
List: One of view(), oview(), world, world.contents, usr, usr.contents, or usr.loc
With the first format, if src is in List for a particular player, then that player will have access to the proc. The player must explicitly specify the name of the source on the command line.

The second format behaves the same, except the source is not read from the command line. If more than one possible source exists, one will be chosen at random.

When usr or world is specified for the first format, it will be expanded to usr.contents and world.contents respectively.

The default setting depends on the type of src:

mob: src = usr
obj: src in usr // short for usr.contents
turf: src = view(0)
area: src = view(0)

Example:
obj/verb/examine()
set src in view()
usr << "You examine [src]."

Example:
obj/MagicCloak/verb/disappear()
set src = usr.contents

usr.invisibility = 1
view() << "[usr] disappears!"
In response to Demon_F0rce (#5)
well, i dont get it very well but thanks, i understand it a bit more