In response to Armiris
Typecast! >.<
var/mob/P = painter
if(usr == P)
//...
In response to Mizukouken Ketsu
Didn't work.

obj
circle
icon = 'icons.dmi'; icon_state = "circle"
Click()
if(gs)
var/mob/p = painter
if(usr.ckey == p.ckey)
src.icon_state = usr.color
MouseDrag(atom/D)
if(gs)
var/mob/p = painter
if(usr.ckey == p.ckey)
D.icon_state = usr.color


Gives me a runtime error: 'cannot read null.ckey'
In response to Armiris
.< Don't put "p.ckey" >_> It should already be the ckey!
In response to Armiris
Armiris wrote:
Gives me a runtime error: 'cannot read null.ckey'

Well then painter is null.
In response to Armiris
And it should. It doesn't look like you quite understood my previous post: you need to tell DM the type of the var (painter) when you first declare it (with the var keyword); DM needs to know it refers to an object of /mob type in order for it to know it has mob properties (such as the ckey var).
Besides, why would you attempt to compare a mob reference (which usr contains, unless its null) to a ckey?
In response to Armiris
When is this painter var even declared and used? I don't think you've shown this. As others said, it's straightforward: as the error says, it is set to null when DM tries to read its ckey, which it of course fails in doing.
In response to Mizukouken Ketsu
...

Login()
..()
world << "[src] has logged in."
pl += src
pls++
Logout()
world << "[src] has logged out."
pl -= src
pls--
del(src)


pl doesn't hold ckeys anymore.
In response to Kaioken
I defined painter under var/mob this time, and now it's not doing anything. I try to draw, nothing comes up. Here's the code now.

obj
circle
icon = 'icons.dmi'; icon_state = "circle"
Click()
if(gs)
if(usr == painter)
src.icon_state = usr.color
MouseDrag(atom/D)
if(gs)
if(usr == painter)
D.icon_state = usr.color
In response to Armiris
Stay away from semi-colon coding. I've had issues with it in the past doing the same thing you describe. Move it down a line and delete the semi-colon and I believe it'll work.
In response to Mizukouken Ketsu
Actually, a semi colon is equal to a line break in the eyes of the compiler.
In response to Jeff8500
I know it's just that sometimes during runtime the programmed snippet won't work because of that semi-colon
In response to Mizukouken Ketsu
The code with that semicolon worked before. It stopped working when I added the check for the painter.
In response to Mizukouken Ketsu
Mizukouken Ketsu wrote:
Stay away from semi-colon coding. I've had issues with it in the past doing the same thing you describe. Move it down a line and delete the semi-colon and I believe it'll work.

Please stop giving advice that is blatantly incorrect or completely useless. Its misleading people. This accounts for almost every single one of your posts attempting to help others; which is noble, but its doing more harm than good since you don't grasp enough of DM to be advising others on it.
In response to Alathon
If any number, it'd be roughly one-third, not nine-tenths (or ten-tenths depending on what you mean by "almost every single one"). And my so-called-by-you "bad" advice is either on the really minor things such as this, or on the larger problems where I ask a question/confirmation on whether or not my way would work.
Page: 1 2