Is there away to add a name when you award points?
Can you give an example of what you mean, like a “fake transcript” of your expected results?
not sure if this can be done. award 5 points when player finds object. when player look at score have it say 5 points for finding object.
It can be done. Counterfeit Monkey did it. Hold on, I’ll find you the source code.
thank you
code snippet (edited from Emily Short's Counterfeit Monkey)
"Points"
Lab is a room. Use scoring.
Table of Tasks Achieved
Points (a number) Citation (some text) Time (a time)
1 "pushing the one-point button"
3 "pushing the three-point button"
5 "pushing the five-point button"
To record (T - text) as achieved:
choose row with a citation of T in the Table of Tasks Achieved;
if there is no time entry begin;
now time entry is the time of day;
increase score by points entry;
end if.
The announce the score rule is not listed in any rulebook.
Carry out requesting the score:
if the score is 0:
say "So far you are without points.";
otherwise:
say "You have earned [score] point[s]:";
repeat through the Table of Tasks Achieved in time order:
say "[line break] [points entry] point[s] for [citation entry]";
say paragraph break.
[—--]
A 1-point button, a 3-point button, and a 5-point button are in the Lab.
Check pushing the 1-point button:
record "pushing the one-point button" as achieved.
Check pushing the 3-point button:
record "pushing the three-point button" as achieved.
Check pushing the 5-point button:
record "pushing the five-point button" as achieved.
Test me with "score/push 1-point/score/push 3-point/score/push 5-point/score".
transcript
Points
An Interactive Fiction
Release 1 / Serial number 250315 / Inform 7 v10.1.2 / D
Lab
You can see a 1-point button, a 3-point button and a 5-point button here.
>test me
(Testing.)
>[1] score
So far you are without points.
>[2] push 1-point
Nothing obvious happens.
[Your score has just gone up by one point.]
>[3] score
You have earned 1 point:
1 point for pushing the one-point button
>[4] push 3-point
Nothing obvious happens.
[Your score has just gone up by three points.]
>[5] score
You have earned 4 points:
1 point for pushing the one-point button
3 points for pushing the three-point button
>[6] push 5-point
Nothing obvious happens.
[Your score has just gone up by five points.]
>[7] score
You have earned 9 points:
1 point for pushing the one-point button
3 points for pushing the three-point button
5 points for pushing the five-point button
thank you very much
I’m getting runtime errors from that. I think the names in the table don’t match the item names. No, that’s not it. Hm. E: ok, It’s that the citation entries don’t match the texts in the check rules.
This (done differently) has become a recipe in the documentation. Let’s see if I can copy a snippet.
I also wonder which would be better for a beginner to take on. Both have challenges, I think.
It ran in Borogrove (Vorple without the extensions because the regular one doesn’t work) just fine for me.
They do basically the same thing: make a table of the achievements and point values, and a way to check if they’ve been done (time [based on turn count] or turn count), then report it with SCORE
.
it does run, yes, but it does this?
>test me
(Testing.)
>[1] score
So far you are without points.
>[2] push 1-point
*** Run-time problem P21: Attempt to look up a non-existent correspondence in the table 'Table of Tasks Achieved'.
the issue, I think is the mismatch between the check rules and the entries in the table.
I get what you’re saying, since they have similar outcomes, but I wouldn’t say they do the same thing. One uses a definition and check rules, the other checks actions during the after phase and updates things automatically.
Which is why I wondered which would be better for a beginner to take on. Both have challenges, I think.
Oops, that’s me editing the code after running it because I thought “1 point for gaining one point” was too vague. If you fix the check rules (like I just did) it works.
@Jammy.Presley Pick whichever you prefer. Emily has a function that will, once you do an important action, update the score based on the table. Drew checks after every action if that action was important by checking the table, then updating the score.
thank you
Thanks all, I have now implemented this feature in my game.
I started out using this for my scoring but found I couldn’t capture every achievement event in an action. Instead I went for state that triggers the points.
e.g.
Table of Scored Circumstances
criteria point value description turn stamp
"[if the blueberries are consumed]Y[otherwise]N[end if]" 5 "Eating the blueberries: " -1
an every turn rule that iterates over this table will award the points when the condition exists. the turn stamp entry is then set to the turn count so that the points are only awarded once.
Thank you very much.