Refreshing the screen display when entering a location
When anyone is playing your adventure, the default screen display is set so that the screen will scroll up as the Player Character (PC) moves around. However, some players prefer that the location text should refresh when moving into a new location. If you want to allow the player the option to do this in your game, this is one way that you should do it:
First of all, define a new variable. You can call this what you like, in my games I just call it "scroll" but you should put an underscore in front (i.e. "_scroll") so that it will always be at the top of the variable list when you need to put it into a restriction or an action. This variable will be initally 0 and will be set to 1 when the player choses the "SCROFF" option we will be programming later.
You will also need a "keypress" message for when the location text changes as a result of an action by the player. You want the player to be able to read any messages that a task will display before the screen refreshes with the new location description. In my adventures I have a message that appears in green under the text like so:
<centre>Press the Space Bar to Continue.....</center>
The <waitkey> line will pause the Runner until a key is pressed. As you will be inserting this message in lots of tasks, you do not want to have to type the whole message every time. The easiest way of doing this is to define a text override with something like <mytext> as the original text and the replacement text as the "keypress" message as above.
Now, whenever the player moves to another location, the LOOK task is activated to display the location description, so if we want the screen to refresh when the PC moves to another room, we must redefine this task. The Look task is in the "Look and Examine" folder within the Standard Library folder in the Folders window on the left of the screen, as below.
When you open this task you will see in the default message box DisplayLocation[%LocationOf[%Player%]%]% in blue, plus an alternate description which is displayed if the location is dark and the PC is not carrying a light source. What is useful at this stage is if you rename this alternate description, so just right-click on the "alternate description" tab and rename it to something like "Dark Locations".
Next you should open a new alternate description, so either right-click on the task and select "Add Alternate Description" or move your cursor to the right of the "Dark Locations" tab and you will see a tab appear which when you click on it will add and open an alternate description. Rename the tab for this description as (for example) "Scroll On". What you should do now is go back to the default description and highlight %DisplayLocation[%LocationOf[%Player%]%]%. You need to copy this then delete it from the default description window. Now open the new "Scroll On" tab and paste what you have just copied into the message box. In the restriction box above the message window you should define the restriction as "Variable _scroll must be equal to 0" then "Start Description with". After you have done this click on the "Apply" button to save the changes without closing the task.
Now you repeat the above step to create a second alternate description, calling this one (e.g.) "Scroll Off". However, before you paste the completion message into the box type <cls> first then paste the message immediately after this so that it reads:
The restriction for this message must be "Variable _scroll must be equal to 1" then "Start Description with". Now open the Actions tab and add the action "Set variable _scroll to 1". Click apply to save what you have done,
The final step before we save and close the re-defined task is to move the "Dark Locations" tab to the right so that it is after the two new tabs, so just click on it and while holding the mouse button down drag it to the right. You will see two red arrows above and below the bar which indicate where it is to be placed, so when these are visible to the right of the "Scroll On" and "Scroll Off" tabs, release the mouse button.You can now click on OK to save and close the task.
Now we need to create the two tasks which will either turn the screen scrolling off or on again. You will have to decide what commands you want the player to use, I myself use SCROFF (for Scroll Off) and SCRON (to turn screen scrolling back on again). So in the folder that you want these tasks to reside, right-click and choose NEW TASK. Call the first one Scroll Off (as screen scrolling is on by default) and in the command line box you just type scroff, and in the message box underneath type your completion message, e.g. "Screen Scrolling is now turned off, as below:
" Click "Apply" to save what you have just done. Now click on the Restrictions tab and add the restriction "Variable _scroll must be equal to 0". In the message box for this restriction you should type "Screen Scrolling is already turned off." in case the player types "Scroff" when it is already off. Next you should click on the Actions tab and enter the action "Set variable _scroll to 1", then click on OK to save and close this new task.
To create the task for "Scroll On" you can do it the proper way and create a new task. However, one shortcut I frequently use is to copy and paste the first task you created and alter it accordingly. So right-click on the "Scroll Off" task and paste it into the same folder. Open the copied task and make the following changes: Change the title from "Scroll Off" to "Scroll On", the command line to "scron" and the completion message to "Screen Scrolling has now been turned back on." On the Restrictions tab alter the restriction to "Variable _scroll must be equal to 1" and the default message to "Screen Scrolling is already turned on." On the Actions tab change the action to "Set variable _scroll to 0". You can now click OK to save and close the task.
We will of course need to tell the player about the new options that are available to them and the simplest way of doing this can be a couple of lines At the bottom of the title page for your adventure, e.g. "To turn Screen Scrolling Off, type SCROFF and press Enter." and below that "To turn Screen Scrolling On again, type SCRON and press Enter."
Now you have given the player the option to turn screen scrolling off, you must allow for this when creating any task which alters the location text in any way with a LOOK action, for example if a previously hidden object is found by the PC and appears in the current location. What you need to do is make sure there is at least one blank line after the completion message for any such task, then create an alternate description. This is where we type the shortcut <mytext> into the message box for the alternate description so that the "keypress" message is substituted by the text override we created. Set the restriction for this message to "variable _scroll must be equal to 1 then display after default".
Now, if the player has chosen to turn screen scrolling off, when he or she performs an action which alters the location text, the screen will look like the image on the left and when any key is pressed the screen will refresh to the image on the right with the updated location text:
|<<< Climbing a Tree||Main Page||Character Walks >>>|