beforeturn override bug?

Freak
I was using a test case, and discovered that "beforeturn override msg <in beforeturn>" in a room gives an error. Is that just Quest 4 or was that the behavior in prior versions?

Alex
What error do you get?

It works for me:


define game <test>
asl-version <400>
start <room>
beforeturn msg <global beforeturn>
end define

define room <room>
north <room2>
beforeturn override msg <in beforeturn>
end define

define room <room2>
south <room>
end define


gives:


You are in room.
You can go north.

> look
in beforeturn
You are in room.
You can go north.

> north
in beforeturn
You are in room2.
You can go south.

> look
global beforeturn
You are in room2.
You can go south.

> south
global beforeturn
You are in room.
You can go north.

Freak
Ah. "beforeturn override" only works if in the first "beforeturn" line. That's annoying.

Alex
What do you mean by the first beforeturn line?

Freak
define game <test>
asl-version <390>
start <room>
beforeturn msg <global beforeturn>
end define

define room <room>
north <room2>
beforeturn msg <in beforeturn 1>
beforeturn override msg <in beforeturn override 2>
beforeturn msg <in beforeturn 3>
end define

define room <room2>
south <room>
end define


You can go north.

> l
in beforeturn 1
in beforeturn 3
global beforeturn
You are in room.
You can go north.

> n
in beforeturn 1
in beforeturn 3
global beforeturn
You are in room2.
You can go south.

> l
global beforeturn
You are in room2.
You can go south.

> s
global beforeturn
You are in room.
You can go north.



INIT: Quest 4.0 Beta 3 (build 4.0.51)
INIT: Opening file C:\Documents and Settings\Home\My Documents\rmworld2.asl on 2/28/2007 at 8:06:27 AM
INIT: Finished loading file.
ERROR: Unrecognized keyword. Line reads: 'override msg <in beforeturn override 2>'
ERROR: Unrecognized keyword. Line reads: 'override msg <in beforeturn override 2>'


Comment out beforeturn 1 and it works fine. (I was using an older version of Quest, so I had to lower the asl-version.)

paul_one
try:
beforeturn override {
msg <code goes here>
msg <and here>
msg <and also here!>
}

Freak
I'm not interested in writing Quest games. I'm trying to write a program that runs them, and to do that, I need to know exactly what the correct behavior is.

Alex
Generally there shouldn't be multiple "beforeturn" tags in a room.

Also I notice that you're still using 4.0 Beta 3 - I'd recommend upgrading to the final release, especially as I think Beta 3 expires today!

Freak
It doesn't matter whether there "should be X" or "shouldn't be X"; in the absence of a formal specification, Quest is defined by its implementation, so what matters is "X is legal", "X is illegal", and "behavior of legal behavior X".

Since having multiple beforeturn tags is legal, I need to know what the correct behavior of that case is.

Freak
I'm curious: How is the beforeturn script stored internally? I can see plenty of ways to implement it, but none match the behaviors of:

1) If multiple beforeturn tags are listed, all are run.
2) "beforeturn override" only works with the first tag.
3) It was not explicitly designed to allow multiple tags.

Alex
Each room has one "beforeturn" script stored. When multiple "beforeturn" tags are specified, they are added to the room's "beforeturn" script.

If "override" is the first keyword in the script, Quest knows not to run the game's "beforeturn" script.

Because Quest only looks for "override" in the first keyword of the script, if you specify multiple "beforeturn" tags in a room, the "override" must be in the first tag if you want to use it.

Freak
So if you had code that adds multiple lines to the beforeturn script (instead of replacing it), why were you surprised by my mention of "first beforeturn line"?

Alex
I was just clarifying what you meant, since I'm not aware of any games actually using multiple "beforeturn" lines (since most games are created in QDK). Additionally I didn't check how it was handled until your question about how it is stored prompted me to look at the code.

Freak
Would multiple beforeturns be handled internally as a single newline separated string (as are functions / procedures), and that the various "run script" routine will handle such a string as a multiline script?

I'd been assuming (considering the way Quest deinlines braces) that "script properties" had to be a single line string, and that functions / procedures were handled as an array of single line strings.

(Also, this forum keeps accusing me of being a spambot whenever I post.)

Alex
Yes, multiple beforeturns are handled internally as a single newline separated string.

The "run script" routine handles multiline scripts - it just runs each script line in turn (it doesn't need to worry about there potentially being nested script blocks as these will have been taken care of when Quest initially loaded the file and they were converted into intprocs).

Freak
The conversion to intprocs is what I meant by deinlining.

This topic is now closed. Topics are closed after 60 days of inactivity.

Support

Forums