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"