Glulxe fatal error: Memory access out of range (507D3D87)

Argh.

I’ve looked at a bunch of threads on this which all have all the smart people talking about things I don’t understand. Dumb it down for me. Is there a testing command I can use to find the problem? Is there a line of code I can slip in to fix it? Or do I have to go through every single thing I did in the last half hour to see what happened?

OK, it was actually pretty easy to find the problem.

I created a roomXview for every room:


The lview is here. It is scenery. 
The printed name of lview is "room".
Understand "room", "library" as lview.

Instead of examining the lview:
	try looking instead.

And this one caused the problem. Commenting out specific parts of this shows that

Understand “room”, “library” as lview.

is the line that causes the problem. When I bracketed this one out, the problem went away. I checked and there are no more lviews or anything like that. All the room views mostly have the same synonyms.

Where the problem actually stopped the game was at examining the book in the library.

WTF? I’ve done this kind of thing often for rooms.

1 Like

I don’t know, but you could try turning on ACTIONS and/or RULES and then posting the transcript of what happens when it crashes.

1 Like

If it’s useful to anyone, I’ll do this and DM it to them so I’m not posting a transcript of an unreleased game openly. I only have these things because of the amount of players who insist on typing X LIBRARY instead of just LOOK. It happened so much that I finally just gave them what they wanted.

Whatever you ran into, it’s a bug, and not your bug. I can’t speculate on what it is though.

Also, if you want some code that will do the X LIBRARY trick for every room, I have a snippet I got from otistdog that I use in my games: Overly elaborate looking - #2 by otistdog

1 Like

What an unusual event. I love not being at fault-- it happens so rarely.

Thanks for the snippet!

1 Like

I’ve done this kind of thing often for rooms.

So have I.

If someone manages to reproduce the problem, please post the code. A quick copy-and-paste of the example works fine.

SO WEIRD. Now it’s gone. I don’t know what I did. I commented that out, kept working, turned it back on to see what I could post here, and now everything is fine, even though I did not work on anything in the library section. I have so many things going on in this room that it’s a monster piece of code, badly organized and done in my trademark byzantine method. But I can tell you that what failed is examining an object (book) which has an “Instead of examining the book: try book-peeping a specific booknumber” rule, and the book-peeping is more or less code Zed wrote:

book-peeping

lab is a room.
booknumber is a kind of value. #9-999-999 specifies a booknumber with parts shelf-num and book-num and page-num.

book-description relates one text to one booknumber.
The verb to book-describe means the book-description relation.

to decide what K is (v - value) cast as a/an/-- (name of kind of value K): (- {v} -).

#1-1-1 is book-described by “You learn the secret of life!”.
#2-42-963 is book-described by “You learn the secret of death!”.

the book-id-regexp is always “\s+()\s+0*(\d+)\s+0*(\d+)(\s|$)”.

after reading a command:
let pc be the substituted form of “[the player’s command]”;
if pc matches the regular expression book-id-regexp begin;
let shelfnum be 999;
let shelf-understood be the substituted form of the text matching subexpression 1;
repeat with x running from 1 to 26 begin;
let letter be “[(x + 96) cast as a unicode character]”;
if letter is shelf-understood begin;
now shelfnum is x;
break;
end if;
end repeat;
let the replacement be the substituted form of " #[shelfnum]-[text matching subexpression 2]-[text matching subexpression 3] ";
replace the regular expression book-id-regexp in pc with replacement;
change the text of the player’s command to pc;
end if;

book-peeping is an action applying to one booknumber.

understand “examine [booknumber]” as book-peeping.
understand “read [booknumber]” as book-peeping.

carry out book-peeping a booknumber (called book):
if a text relates to the book by the book-description relation, say “[text that relates to the book by the book-description relation][line break]”;
else say “Reading random passages will not be useful.”;

to say (b - booknumber): let x be 64 + shelf-num part of b; say “[x cast as a unicode character] [book-num part of b] [page-num part of b]”.

test me with “read A 1 1/read b 42 963/ read A 29 4”

Spooky. Will it return? Who can say. I wish I knew what I did that made that go away.

I would tweak Otis’ code thus for this case:

understand "room" as a room.

Library is a room.


After deciding the scope of the player while examining (this is the place the room in scope while looking rule): [limits applicability to when parsing examining action]
    place the location in scope, but not its contents. [everything else should already be in scope if applicable]

Does the player mean doing anything to the location: [still prioritizes examination of things vs rooms]
    it is unlikely.

before examining a room, instead try looking.

test me with "x room / x library".

Because there’s only ever one room in scope at a time, understand "room" as a room. means x room will work without further effort.

1 Like

Well, what I have is working now. Should I trust it? I guess I’ll leave it in and see if something else I do retriggers the problem. I’ve done so many little and big changes all over the place since commenting out those lines that I can’t even begin to guess what changed it. If it gets angry again I’ll use this snippet.

1 Like