Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

print grabs wrong strings and displays out of order #37

Open
jpcompton opened this issue May 23, 2020 · 7 comments
Open

print grabs wrong strings and displays out of order #37

jpcompton opened this issue May 23, 2020 · 7 comments

Comments

@jpcompton
Copy link

I'm running into a problem where certain printed strings are appearing out-of-order and with substitutions of other strings from elsewhere in the code (generally from the first block of strings, used in the occur when !flag 1 section of the game.)

The output shown is:

Tell me what to do ? read book
Paper you used as a bookmark FALLS out!
You are PRINCE HAMLET # this is a bad line
Tell me what to do ? read script

about fratricide & other TERRIBLE acts
What are you going to DO about it? # this is a bad line
CLAUDIUS is also guilty of!
Tell me what to do ? 

But I would expect, based on my code:

action read book when carried book and !exists script
	print "Words words words" # This line isn't being displayed
	print "Paper you used as a bookmark FALLS out!" # This line is first instead of second, then followed by the "You are" bit!
	put_with script book

and

action read script when carried script
	print "Play script: The MURDER of GONZAGO!" # Not displayed, note that it's also the first line in this sequence
	print "about fratricide & other TERRIBLE acts" # Displayed first instead of second
	print "CLAUDIUS is also guilty of!" # Correctly displayed third, but with that "What are you" line inbetween!

This behavior is identical in scottkit -p and in scottfree.

Apologies for the critical path to replicate being a bit cumbersome...

OPEN WAR
GET ROB
GET DAG
OPEN DOR
GO DOR
n
w
get money
w
get book
e
e
u
w # small chance of random death here, sry
talk ghost
e
d
n
n
buy flowers
n
give flowers
yell ophelia
read book
read script

@jpcompton
Copy link
Author

(.sck and .sao in zip)
rotten.zip

@jpcompton
Copy link
Author

jpcompton commented May 23, 2020

(I've confirmed that the format limits us to 99 messages and solved my own problem with multi-line strings and kept the project under 99 unique messages. However, a compiler warn about breaching this limit would be very useful.)

@jpcompton
Copy link
Author

jpcompton commented May 26, 2020

...but maybe the issue is more complicated! Adventshark's pdxiv comes up with a proof-of-concept with hundreds of (successfully) printed messages.

https://intfiction.org/t/scottkit-producing-misplaced-out-of-order-strings/45507/13

Archive.zip

@pdxiv
Copy link

pdxiv commented Jun 4, 2020

The most optimal way to handle this whole limitation, in my opinion, would be a two-fold approach:

The first part of the approach would be to only allow "even" print commands use up to 99 messages.
The second part of the approach would be to give "even" print statements precedence in the messages list. For example, in the following "occurrence":

occur
    print "odd message 1"
    print "even message 1"
    print "odd message 2"
    print "even message 2"

The messages list would be populated with the entries in the following order, to make sure that "even" messages have a higher chance of being within the first 99 message entries:

"even message 1"
"even message 2"
"odd message 1"
"odd message 2"

@MikeTaylor
Copy link
Owner

@pdxiv I am not following this at all. Why should even-numbered messages get priority? How would the writer even be expected to know which messages are even numbered and which are odd numbered?

@pdxiv
Copy link

pdxiv commented Jun 4, 2020

Even-numbered messages should get priority, because it would reduce the chance of them addressing a message with an index higher than 99. Odd-numbered print commands don't have this limitation, because of how they are encoded (150*command 1 + command 2, 150*command 3 + command 4).

Sadly, the author of a game can't be expected to know this beforehand, unless they have more intimate knowledge of how the Scott Adams engine encodes data. The way I see it, the ScottKit language is a sort of "assembly language" for the engine, and perhaps that could be a moral justification. An author could perhaps be made aware of how the messages work, via suitable error messages for when the situation arises.

My apologies if I'm completely off on this one.

@MikeTaylor
Copy link
Owner

Ah, I see. Yes, that makes sense. I will think on this.

Sorry for the slow responses to these recently filed issues, BTW. I have a lot on at the moment, but I do intend to get to this and the other issues.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants