I'm creating a game, and there is an item that increases defense and modifies a user stat called 'def'. When I log out of the game in DS with one of these items in my inventory, I get the following error:
runtime error: Cannot read null.def
proc name: Del (/obj/item/scale/Del)
usr: null
src: Dragon\'s Scale (/obj/item/scale)
call stack:
Dragon\'s Scale (/obj/item/scale): Del()
Foobar Master (/client): Del()
Is it just me, or is something trying to delete the items in my inventory upon exiting? I'm using BYOND build 334, and Deadron's character library. The only time I ever manually call del() on items is when selling or discarding them, and I'm not doing either of those in this case. What could be the problem?
ID:261754
Apr 7 2003, 6:00 pm
|
|
Since you posted no code, I have to stab in the dark here. In the future, you should post the source code related to the problem so people can provide more detailed help.
It's been a while since I used Deadron's character handling library, but I think it automatically deletes mobs when the player logs out. (Which is a very good thing. If it didn't, your world would fill up with idle mobs.) When the mob is deleted, everything in his or her possesion is deleted unless you overide the default behaviour. You should leave the Del() proc for things specifically related to the deletion of the obj. It would be better to modify the def stat in another proc or verb, then call del() from that proc. For instance: obj/item/scale verb/use() usr.def++ del(src) |
In response to LordJR
|
|
LordJR wrote:
Try assigning your mob/var/def = 0 Um... I have no idea where you're coming from on this, but you clearly have no idea what you're talking about. Making a compile-time assignment would have zero impact on a Del() proc trying to change a var belonging to a null reference at runtime. Lummox JR |
In response to Lummox JR
|
|
:(
Is it really necessary to point this out in this manner?? Not feeling the love.... LJR Lummox JR wrote: Um... I have no idea where you're coming from on this, but you clearly have no idea what you're talking about. |
In response to LordJR
|
|
LordJR wrote:
:( Yes, it is. I don't mean to be demeaning about it, but really your advice made no sense whatsoever. At best it was ignored, at worst it sowed confusion; most likely it just was a waste of time to try. This is not helpful to anyone. If you're going to try to help people through their problems, your advice shouldn't be off in left field and completely irrelevant. I don't want to discourage you from offering help, but rather to encourage you to double check that you're actually saying something helpful before you do. Knowing what you're talking about is rather important to that. Lummox JR |
In response to Lummox JR
|
|
I was going on an assumption there as Shadow already pointed out there was NO code provided. So it should be expected that I knew not what I was talking about. You act as though I saw the code, and gave wrong information.
|
In response to LordJR
|
|
LordJR wrote:
I was going on an assumption there as Shadow already pointed out there was NO code provided. So it should be expected that I knew not what I was talking about. You act as though I saw the code, and gave wrong information. If you didn't know what you were talking about, why did you offer a specific piece of advice and say that should solve the problem? That's what I'm getting at. Often enough with "cannot read null.var" errors, there actually is a rather obvious solution, which sometimes is possible to figure out without seeing the code--depending on the situation. Initializing a var to 0, however, would never be that solution. So I'm not acting as though you saw the code and gave wrong information; I'm acting as though you didn't see it, and still gave wrong information. It's demonstrably wrong just by the type of error alone. Lummox JR |
In response to Lummox JR
|
|
Understood..
You know this brings to mind.. has someone made a listing by BYOND errors? And maybe probable causes and ways to fix those errors? If not that would be a nice additon as a BYONDBwicki page. Would be nice to have an error listing page for people who get these types of alarms, and then various people could post under those error codes, fixes or explnations. I'm glad I posted, cause even if wrong, I still learned something out of it myself as I hope anyone else reading this does. http://bwicki.byond.com/ByondBwicki.dmb?ErrorCodes Ok I've acted on my suggestion. I don't have the error code at work with me, but please feel free to add to or correct what I've posted. I used my own question from a few days ago as an example. Maybe if we get this thing filled it it will be a nice reference tool for those who come in asking I'm getting XXXX!!! error messages when I try to compile, how do I fix them?? And they can look up fixes and examples by error code. LJR |
In response to LordJR
|
|
I have come to the conclusion that maybe I should change the def var before deleting the item, instead of in the item deletion product. You guys get worked up so easily over the smallest things. :-p
Yep, that worked. Thanks Shadowdarke. |
In response to LordJR
|
|
LordJR wrote:
http://bwicki.byond.com/ByondBwicki.dmb?ErrorCodes http://bwicki.byond.com/ByondBwicki.dmb?CompileErrors That one wins. ~>Volte |
This should get rid of the error.
LJR
Foobar Master wrote: