Delayed Score Increase Report

Hello Generous Community,

Problem: Increase score is executed and the “[Your score has increased]” report is delayed by one turn.

I apologize for the length of the sample and the frequency with which i ask questions. I’m almost ready to release this silly thing.

Context: I have a carnival; there are several carnival games. In order to consolidate code, I feed the list of prizes from a table for display and then ask the player to choose the number corresponding to their selected prize. To “receive a prize”, the actual “thing” is looked up in the same table, assigned to the player, and a truth state is set indicating a prize was selected and taken.

The scoring mechanism was the outcome of this earlier topic of mine: When is a pushing action a switching on action and vice versa.

In the Table of Scored Circumstances are 5 entries. 4 for the prizes, and 1 for the widget. During the “every turn” points are awarded for observing potential world states. In this case, all the points awarded are a result of the player carrying the object.

So why does “taking the widget” report the score increase immediately (as do all my other entries in the full game) when selecting from my prize table delays the report?

I’ve tried playing with stopping, continuing, and rejecting the command to no avail.

Thanks in advance,
d.

use scoring. The maximum score is 20.

The high striker is a room. The widget, teddy bear, Swiss Army knife, poster of Taylor Swift, and magenta fuse are here.

HighStrikerWin is a truth state that varies.
prize taken is a truth state that varies. prize taken is false.

starting is an action applying to nothing. Understand "start" as starting.
after starting:
	now HighStrikerWin is true;
	show the high striker prizes.

Every turn (this is the award points rule):
	repeat through Table of Scored Circumstances:
		if the turn stamp entry is -1:
			if the criteria entry is "Y":
				now turn stamp entry is turn count;
				increase the score by point value entry.

after reading a command when the location is the high striker and HighStrikerWin is true:
	receive a prize;
	if prize taken is true:
		now HighStrikerWin is false;
		stop the action.

To receive a prize:
	let C be "[the player's command]";
	if there is an index of C in the Table of High Striker Prizes:
		choose a row with an index of C in Table of High Striker Prizes;
		say "You are now holding [description entry].";
		now the player carries the object entry;
		now prize taken is true;
		reject the player's command;
	otherwise:
		now prize taken is false;
		continue the action.

To show the High Striker prizes:
	say "Which prize would you like? [run paragraph on]";
	repeat with N running from 1 to the number of rows in the Table of High Striker Prizes:
		say "[index in row N of the Table of High Striker Prizes]) [description in row N of the Table of High Striker Prizes][if N < number of rows in the Table of High Striker Prizes], [otherwise]?[end if]".
		
Table of High Striker Prizes
index	object	description
"1"	teddy bear	"a teddy bear"
"2"	Swiss army knife	"a Swiss Army knife"
"3"	poster of Taylor Swift	"a poster of Taylor Swift"
"4"	magenta fuse	"a magenta fuse"	

Table of Scored Circumstances
criteria	point value	description	turn stamp
"[if the player is carrying the teddy bear]Y[otherwise]N[end if]"	10	"Winning the teddy bear"	-1
"[if the player is carrying the Swiss Army knife]Y[otherwise]N[end if]"	20	"Winning the Swiss Army knife"	-1
"[if the player is carrying the poster of Taylor Swift]Y[otherwise]N[end if]"	30	"Winning the poster of Taylor Swift"	-1
"[if the player is carrying the magenta fuse]Y[otherwise]N[end if]"	40	"Winning the Magenta fuse"	-1
"[if the player is carrying the widget]Y[otherwise]N[end if]"	50	"Taking the widget"	-1

test me with "start / 2 / look / take widget / i"

You can always put in the line:

follow the notify score changes rule;

to force the display of score notification.

1 Like

Tried that here, but the notification was still delayed.

	let C be "[the player's command]";
	if there is an index of C in the Table of High Striker Prizes:
		choose a row with an index of C in Table of High Striker Prizes;
		say "You are now holding [description entry].";
		now the player carries the object entry;
		now prize taken is true;
		follow the notify score changes rule;
		reject the player's command;
	otherwise:
		now prize taken is false;
		continue the action.

I just realized that you don’t increase the score until your “award points rule”. If you reject the player’s command the turn sequence rules are not carried out. Also, you need the rule to be listed earlier in the turn sequence rules:

The award points rule is listed before the notify score changes rule in the turn sequence rules.
3 Likes

Rejecting the player’s command means no parsing happens, so no action happens, so no turn happens.

1 Like

In my initial exampled, turns out the score report wasn’t delayed, it was canceled by the “reject the player’s command”. (as you all know).

My confusion was that on the next turn the points were being awarded for THAT turn, not the previous one.

It’s confusing. But the Every Turn rulebook is the last thing to process. So it sounds like what’s happening: rule runs, score changes internally, player’s command is rejected so the turn “doesn’t count” and everything resets waiting for a new command.
Then…

I found this quote on our forum from a Mad Scientist so I’d assume it’s true. Does the score notification rule happen at the beginning of the turn? In that case it waits for the player to put in a new command and then the notification would happen.

1 Like

Pretty sure what’s happening is this:

  • Score is (e.g.) 100 points
  • Player chooses a prize
  • Game follows the notify score changes rule, but the score is still 100 points, so no notification is printed
  • The player’s command is rejected, returning to the start of the turn cycle (end of turn rules are not followed)
  • Player enters another, unrelated command
  • The new command is carried out
  • End of turn rules begin
  • The award points rule is followed
  • Player is carrying a prize that hasn’t been scored yet, so the score increases to (e.g.) 120
  • The notify score changes rule is followed
  • Since the score has now increased from 100 to 120, a notification is printed
3 Likes

this is exactly what was happening.

1 Like