Here is an updated copy of my high score app with score, name, and datetime.
Data entry consists of score and name.
Date and Time come from Clock1, at time of entry.
Note the last entry was for score 15, filed in the middle.
The datetime format can be changed to shorten the lines, per taste.
This is a constant tag in TinyDB where the actual high scores list is kept.
This is the Add button. It calls a procedure add_a_hi_score
with the score and player name. (datetime is taken from the Clock, so it is not needed as a parameter.) After updating the high scores, we retrieve them using a value procedure highScores
, show them in CSV form, and reset the Score textbox.
This value procedure gets the high scores list from TinyDB.
If it is not there or is not a list, a fresh list with a stopper is returned.
This value procedure returns a stopper for the high scores list, with a 3 item list:
- 0 points (I hope no one ever submits a negative score!)
- a challenge for a name
- today() for starters
Date formatting is concentrated here, so it can be customized all in one place. I took the lazy way out.
A local copy of the high scores list is taken using the retrieval procedure listed above.
When the proper insertion point is found, a new 3 item list is inserted there, and the high score list is rewritten into TinyDB.
P.S. These blocks can be dragged directly into your Blocks Editor workspace.
See A way to group projects by theme
for a demo.
max_score_dated.aia (2.9 KB)