ID:146862
 
I made this code and it comes up an errror that i dont understand, can anyone help??
mob
verb
Destroy(obj/O in oview(6))
if(usr.key == usr.owner)
del(O)
else
if(usr.key == usr.key)
usr << "Sorry, this does not belong to you!"
return(0)

mob/verb/Bed_Top2()
set category = "Build"
new/obj/bedtop(src.loc)
owner = [usr.key]<--this is where it says the error is

mob
var
owner = ""
and it says error::expected 1 arg
Dont do = [usr.key] just do = usr.key.
In response to Dession
Elaborating on that, you only need to use [blah blah] when using an embedded expression- eg, with text strings.

src<<"OMFG! You just lost [healthlost] health leaving you with only [src.limbnumber] limbs left!"


In your case, there's no need to embed it, as Dreammaker doesn't need to be able to see that it's a var among lots of text.
In response to Elation
ok, but i also have anouther problem with my doors, i want it so when you build a door u r the onley one that can use this verb that is on the door.
obj/var/open = 0
obj/Door
icon = 'door.dmi'
icon_state = "closed"
density = 1
opacity = 1
layer = MOB_LAYER + 99
name = "Door"
if(usr.key == usr.owner)
verb/open_close()
set name = "Open/Close"
set category = null
set src in oview(1)
if(src.open == 0)
src.open = 1
src.density = 0
src.opacity = 0
src.icon_state = "open"
else
src.open = 0
src.density = 1
src.opacity = 1
src.icon_state = "close"
In response to Tsonic112
if(usr.key==usr.owner)

?

Can't see a use for that...
But meh.

obj
mohawk_hat
var/guywhomadethemohawk
verb
makingthemohawk()
src.guywhomadethemohawk==usr.key
//(blah blah rest of makingness)
wearingthemohawk()
if(src.guywhomadethemohawk==usr.key)
usr<<"OMFG YOU WEAR THE MOHAWK HAT BABY!!"
else
usr<<"No, brother, you ain't never done make this hat, moooO!"


This is the solution I've come up with (untested, obviously), but if someone knows better?
In response to Elation
ok wth was that, i cant even understand what you put because you fill it with nonsense.make my code so that onley the owner can use the open/close verb plz.I would understand that better.
In response to Tsonic112
*sigh* fine.
obj/var/open = 0
obj/Door
icon = 'door.dmi'
icon_state = "closed"
density = 1
opacity = 1
layer = MOB_LAYER + 99
name = "Door"
var/ownerofthedoor // - LOOK! A new var
verb/makethedoor() // making the door
new/obj/Door(src.loc) //We've put it down!
src.ownerofthedoor==usr.key //we've made the var equal the usrs key

verb/open_close()
set name = "Open/Close"
set category = null
set src in oview(1)
if(src.ownerofthedoor==usr.key) //if the new usr's key matches that which was assigned to the var when the door was made
if(src.open == 0)
src.open = 1
src.density = 0
src.opacity = 0
src.icon_state = "open"
else
src.open = 0
src.density = 1
src.opacity = 1
src.icon_state = "close"


You might have to edit it a bit. Etc.
In response to Tsonic112
He showed you how to do it using an example with the mohawk bit. Study it and see what he did and implent it into your code with your own variables.
In response to Dession
Dession wrote:
He showed you how to do it using an example with the mohawk bit. Study it and see what he did and implent it into your code with your own variables.

Mmmm, yes.

But don't worry, we've spoken over pager and got the whole thing worked out.