ID:148403
 
Code snippet:
mob/proc/i_open(var/obj/O)
var/i_open ={"<HTML>
<body bgcolor="#006633" text="#FFFFFF" link="#FFFFFF">
<div id="Layer1" style="position:absolute; left:10px; top:10px; width:114px; height:64px; z-index:1">
<table width="99%" height="71" cellpadding="0">
<tr>
<td width="32" height="32"><img src=item_
[O].png ALT=[O]></td>
<td width="76" bgcolor="#999999"><div align="center">
[O.name]</div></td>
</tr>
<tr bgcolor="#999966">
<td colspan="2"></td>
</tr>
</table>
"}

usr << browse(i_open,"window=i_open,size=200x200")

error:
runtime error: Cannot read null.name
proc name: i open (/mob/proc/i_open)
usr: Cryptic (/mob/characters/Archer)
src: Cryptic (/mob/characters/Archer)
call stack:
Cryptic (/mob/characters/Archer): i open(null)
Cryptic (/client): Topic("src=\[0x0];action=I_open;I_ope...", /list (/list), null)

I cannot figure out what is wrong... all vars have been defined, etc. It looks liek it should work, but it doesn't =/
Cryptic wrote:
runtime error: Cannot read null.name
proc name: i open (/mob/proc/i_open)
usr: Cryptic (/mob/characters/Archer)
src: Cryptic (/mob/characters/Archer)
call stack:
Cryptic (/mob/characters/Archer): i open(null)
Cryptic (/client): Topic("src=\[0x0];action=I_open;I_ope...", /list (/list), null)

I cannot figure out what is wrong... all vars have been defined, etc. It looks liek it should work, but it doesn't =/

The code snippet you posted looks fine. I suspect the problem is where you define the link that triggers it. If you notice, it is calling topic with "src=\[0x0]" which means it is null.

Can you post the section that creates that link? It should contain something like "<a href=BYOND://?src=\ref[some_var];action=I_open"
Cryptic wrote:
error:
runtime error: Cannot read null.name
proc name: i open (/mob/proc/i_open)
usr: Cryptic (/mob/characters/Archer)
src: Cryptic (/mob/characters/Archer)
call stack:
Cryptic (/mob/characters/Archer): i open(null)
Cryptic (/client): Topic("src=\[0x0];action=I_open;I_ope...", /list (/list), null)

I cannot figure out what is wrong... all vars have been defined, etc. It looks liek it should work, but it doesn't =/

I can give you a few pointers on how to diagnose this problem in the future. "Cannot read null.var" errors are often the easiest to fix. One thing you should do, though, is to get a line number by compiling with debug information turned on.

First: It says "Cannot read null.name". So that means something is trying to access the name var of an object, and the object isn't what the proc was expecting. Coincidentally enough, there is a place in i_open() where the name var is used: In the line that puts O.name into a text string. Therefore, O is null.

Second: You'll find this confirmed by looking at the next-to-last line of the error message: "Cryptic (/mob/characters/Archer): i open(null)" -- O is being set to null because i_open() is being called without an object. Either it's just being called as i_open(), or the object you're passing to it isn't valid.

That means that whatever is causing this problem is in the proc that called i_open(), not in i_open() itself. So then you can go to that proc, client/Topic(), and see the line where i_open() was called. My guess is that if you set up the call correctly as i_open(hsrc), then hsrc is null because the link isn't being created with a "src=\ref[item]" part like Shadowdarke suggested.

Lummox JR
In response to Lummox JR
I've been working on this game with Cryptic and I thought of the same things you guys suggested. I scoured the procs looking for where I forgot to include the obj and I finally founnd it. Here is where I think we goofed:
<a href='?src=\ref[src];action=I_open;I_open=\ref[Rhand]'>
//Rhand == usr.righthand an object

if("I_open")
var/obj/O = locate(href_list["i_open"])
usr.i_open(O)

//the var for the href_list is wrong


Thanks for your guys' help, we simply overlooked the obvious, probably because it was so late...

Canar