ID:143670
 
Code:
mob
verb
Take_Picture()
var/A = usr.loc.x
var/A1 = A-14
var/B = usr.loc.y
var/B1 = B+15
var/pic
for(var/atom/E in A1,B1)
if(!E.icon)
return
else
pic += E.icon
usr << browse(E.icon)


Problem description:

So, I call that verb.

runtime error: Cannot read null.icon
proc name: Take Picture (/mob/verb/Take_Picture)
source file: Pictures.dm,21
usr: Revojake (/mob)
src: Revojake (/mob)
call stack:
Revojake (/mob): Take Picture()

Now...I see 2 odd things here. One, I put the if seeing if E had an icon...If it didnt...Do nothing. Well, it does. And when it does have an icon, it still throws that runtime to me.... Line 21 is the if statement...
Well clearly E.icon being null is not the problem; E is what's null, not E.icon.

Now normally that shouldn't be happening, but your malformed for() loop is probably to blame for that:

var/A = usr.loc.x
var/A1 = A-14
var/B = usr.loc.y
var/B1 = B+15
var/pic
for(var/atom/E in A1,B1)


A1,B1 is not valid here. You might mean list(A1,B1), or perhaps A1 to B1, but either way you've got something fairly bogus because you can't find an atom in a list of numbers.

Lummox JR
In response to Lummox JR
No, I think they might be coordinates. In that case, use locate(A1,B1).
In response to Kaiochao2536
Kaiochao2536 wrote:
No, I think they might be coordinates. In that case, use locate(A1,B1).

Dude, not even close. If you're not familiar with the language yet, posting help in Code Problems is a bit premature.

locate() would actually be closer to what he apparently needs, but it does not under any circumstances take only two arguments.

Lummox JR
In response to Lummox JR
I believe what he's looking for is block(loc,locate(x-14,y+15,z)).

However, I have no idea why he's setting it up to be off-center. Also, the way pic is set up won't work. It should either be a list or maybe a string of HTML.