If the Smash engine you are using supports the use of an admin.sma file for administrative functions (Adventure Games Live's engine does), then you may, if you wish, create an admin.sma file to allow the game author and/or administrator to check up on how people are doing in the game. The admin.sma file is not used in the normal course of play; it is only used by an administrator to gather information about a game in progress. The file consists of one or more functions that the author/administrator can run from the game's admin area and view the results. When an admin function is executed, the saved game is loaded but never saved, so you can manipulate variables, text, status lines, etc, without affecting the player's saved game file. Normally, an admin function will simply set the area and/or action description text. For example, let's say you wanted to write an admin function that analyzes the game and says what the player needs to do next. Such a function has a nice practical application: if and when the game author is asked for a hint, the author can run this function and instantly know what the player needs to do next, and so the author can readily provide a suitable hint. Here's how such a function might look for The Trainer: ~ next c tree.times_thrown < 3 P The player has only thrown the rock at the rope {tree.times_thrown} times, so he doesn't have it yet. C !tied_loop P The player hasn't tied a loop in the rope yet. c !coin_visible P The player hasn't found the coin yet. C a:coin P The player hasn't bribed the orc yet. C cave.rummaged < 2 P The player hasn't rummaged for the sword enough times yet. C !kobold.kobold P The player hasn't chased the kobold off yet. C d:axe P The player hasn't taken the axe yet. C !dragon_dead P The player hasn't killed the dragon yet. C d:key P The player hasn't taken the key yet. C P The player has the key! Above, only the action description text is manipulated. This is fairly typical; however, it is also perfectly acceptable to manipulate the area description text, status lines, inventory, and variables. You can also set a return value for the function, which should be displayed when you run the function from the admin area for the game. Setting a return value can be especially useful if the admin area for the Smash engine allows you to run a function for every live game and see the return value for each one. |
|