Skip to main content

Module screens

Module screens 

Source
Expand description

The screens of the game: every message the player sees, as lines of text.

Each function builds one screen from plain data and a Term and returns it as Vec<String> (one entry per output line, trailing blank lines included, exactly as the Python Display printed them). Nothing is written here: the session prints the lines with print_lines, and tests compare them with Term::plain.

The Czech texts are exact ports of display.py, session.py and commands.py, minus the Rich markup. Hints, answers’ feedback, success messages, user names and paths are printed verbatim: they are wrapped as plain text, never interpreted as Markdown or markup, so [ab]*.txt and `ls` come out exactly as written. Only the level assignment itself (Level::text) goes through the Markdown renderer.

The palette follows the Python UI: cyan level panels, yellow hints, green success, red failures, dim notes with violet commands.

Constants§

INSTALL_COMMAND
The command that reinstalls ShellGame, for when update cannot do it itself.

Functions§

already_initialized
init on a game that exists already.
bonus_note
The note under the panel of a bonus level.
cd_block
The red panel for a cd the level forbids, printed on stderr by the cd hook: titled ShellGame (<level id>), with the recovery tip below it.
current_directory
The directory the player starts in.
exiting
shellgame exit.
failure
The red panel for a wrong answer or an unmet requirement, and the pointer to hint.
format_duration
37s, 2m 5s, 1h 2m 3s: a duration the way the Python UI wrote it.
format_stats
The statistics line of the success panel: Čas: 12s | Nápovědy: 1 | Chybné pokusy: 2. Failed attempts are mentioned only when there were any.
game_complete
The player finished the last level.
hint
A newly revealed hint: its panel, the tip about --repeat, the pointer to the next hint (when there is one) and a blank line. index counts from 0.
init_success
A new game was created.
intro_page
One page of a section intro: a cyan panel titled with the intro’s title, and (strana i/N) when the intro has several pages. number counts from 1.
invalid_level_format
The saved level id is not of the form S.N, so its section cannot be found.
launch_failed
The game shell could not be started.
level_missing
The saved level no longer exists in this version of the game.
level_not_found
The catalog has no level with this id.
level_panel
The assignment of a regular level: a cyan panel titled <id>: <title> holding the rendered Markdown, followed (for a bonus level) by the note that it may be skipped.
level_reloaded
dev reload finished.
level_setup_error
The next level could not be prepared; the player’s progress is kept.
no_hints_available
The level has no hints at all.
no_hints_revealed
hint --repeat before any hint was shown.
no_levels_available
The game has no levels at all.
no_levels_registered
dev start on a game without levels.
no_more_hints
All hints have been shown already.
no_next_level
dev next on the last level.
no_previous_level
dev prev on the first level.
not_initialized
There is no saved game.
not_skippable
skip on a required level.
plain_line
An ordinary line in style, for the few messages that have no screen of their own (the progress and the result of update).
removal_declined
The player declined the confirmation of remove.
removal_refused
remove refuses to delete a workspace outside the temporary directories.
removed
The state and the workspace were deleted.
repeated_hints
Every hint revealed so far (hint --repeat): the first revealed of hints, then the tips. Nothing revealed yet has its own message.
reset_failed
reset could not rebuild the level.
reset_notice
The level was rebuilt by reset.
show_usage
show without exactly one of --level and --section.
skipped
A bonus level was skipped.
state_error
The red panel for a failure of the game itself (unreadable state, a filesystem error).
status
The progress screen: the current level, when the game started, a table of finished levels (numerically sorted, so 1.10 follows 1.2) and totals.
success
The green panel shown when a level is completed: the level’s own message and, with a completion record, the line of statistics.
teleport_notice
The player was moved to the start directory of the level.
unknown_level
dev jump to an id that does not exist.
update_current
update found nothing newer than the running version.
update_done
update succeeded: the version before and after.
update_failed
update failed. With reinstall, the installer command is shown on a line of its own (so it can be copied), as the way to update by hand.
workspace_restored
The workspace was gone (a cleared /tmp) and has been rebuilt.