Illegal Object Number

Dear all,
I keep getting a runtime error:

[** Programming error: (object number 128) is not of class <illegal object number 1> to apply ‘ofclass’ for **]

[** Programming error: In Front of the House (object number 541881) has no property <illegal object number 128>::s_to (and nor has any other object) to read **]

The code snippet that maybe causes the error could be this one:

source=parent(player);
target=source.w_obj;
i=0;
if(source provides w_to) i=1;
if(i==1 && source.w_obj==nothing) i=0;
if(~~(target ofclass Busy_Street) && ~~(target ofclass Quiet_Street)) i=0;

The origin of the problem was that I switched from z8 to Glulx. And it’s maybe got something to do with the *_to and *_obj properties, those caused me quite some troubles already after the switch.

Does anyone know what could be the source of my problem, or what information I’d need to provide for a better assessment?

Thanks and kind regards,
Grues

You want w_to, not w_obj. w_obj is the object representing the direction “west”, while w_to is the property that says which room is to the west from a given place.

The eternal problem with I6 direction handling!

3 Likes

Oh. That was… way easier than I thought. Like, I imagined this would turn into a day-long discussion with me understanding nothing of it, but - problem solved AND understood. Thanks a very lot!

2 Likes