thinBasic Adventure Builder (TAB)

Text Adventure Tutorial


     

Part Six: Explanations and Enhancements

 
     

I hope you have enjoyed creating or playing the small example game, but I think some explanations are needed regarding the Response and Script 2 coding entries which were devised to create the puzzles. Let us analyze the conditions and actions used in the coding entries to discover their purpose and effect...

CONDITIONS "openedX" and "closedX" will be true if container object X is open or closed respectively.
CONDITION "hereX" is true if Object X is carried or worn by the player or in the player's current location. "absentX" is its opposite condition.
CONDITION "room=X" will be true if the current room = X and "objlocX=Y" is true if the current location of object X is room Y.
CONDITION "objlocn1=here" checks that whatever object noun was typed as the first noun in the phrase is present in the current room or carried or worn by the player.
CONDITION "charpresentX" is true if Character number X is present in the player's current room.

ACTION "closeobjX" ensures that the object container contents cannot be accessed; neither will its contents be listed if the player tries to "look in the <container>". In other words it is "locked".
ACTION "openobjX" simply clears the container object status to unlocked/open. The contents of the container are now viewable by "look in <container>" or in an inventory listing if the container is carried.
ACTION "cmessX$" (custom message) simply prints text to the adventure window.
ACTIONS "createX" and "destroyX" create an object in the current room or destroy/remove an object to location 0. (does not exist in the game)
ACTION "done" stops processing of any further commands that may be waiting to be dealt with. It is normally the last action in a Response entry.
ACTION "score" prints player's current score and turns taken.. "score+X" increases players score by X. "pauseX" halts the game by X seconds and "gameover" ends the game and asks the player if they wish to play again or quit.

Also used in the tutorial game were flag conditions and actions... There are 500 user flags that can be used by authors.
Flags have many uses but their main use is to tell TAB whether a thing has been done or not. eg: "flag15=1" could be used to indicate that a gate was open. "flag15=0" could indicate that the gate was closed. You may find it handy to keep a note of the flags you use.
Flags are very useful when devising the puzzles and problems which must be solved in a game and their values can be altered to show that a particular obstacle has been successfully overcome. The simplest flag condition is "flagX=Y" which checks that flag X holds a value of Y, and the simplest flag action is "flagX=Y" which sets flag X to contain a value of Y. There are other flag conditions and actions which are useful as well.
TAB also allows you to refer to a flag value in a cmess action. eg:

cmessThe number %flag16% was inscribed on the wall.

TAB would convert the contents of flag 16 and alter the message to maybe:
"The number 26 was inscribed on the wall." depending on the number held in flag 16.

Normally TAB will print the location text, exits and list objects in response to the command 'look' or when movement is accomplished via a direction noun such as 'north' or 'go se' etc.

However, sometimes you may wish to force TAB to do the location describe because of an action which moves the player to a different room and you may want to inform the player just where he is and what he can see in the new room by printing the relevant info.

For example, suppose the player found a 'magic lamp' and you had a RESPONSE entry to deal with the player 'rubbing the lamp'!
When the player rubs the lamp he may be engulfed in a swirling mist of light which clears to show the player has been transported to a new room!
To ensure that the new room is described as normal - add a call to the 'desc' action. For instance:

[start]rub lamp#obj1=501#flag20=0[acts]mess301#room=25#flag20=1#desc[end]

If the lamp is carried and f20=0 then print Message 301, change the ROOM to 25, set flag 20 to 1 and describe the room, exits & contents.

The same effect could be achieved using the 'goto' action eg:

[start]rub lamp#obj1=501#flag20=0[acts]mess301#flag20=1#goto25[end]

Action 'gotoX', where X is a location number, puts the player in the stated room and AUTOMATICALLY describes it.

TAB allows you to create entries for items referred to in location or message texts that are not classed as true objects (do not exist in Object Editor) eg:

Location Text:
"You are in a dark, dank basement. The sound of dripping water punctuates the ominous silence. A cupboard stands in the northwest corner of the room. It is icy cold in here."

The importance of the cupboard is not emphasized here, unlike a cupboard OBJECT which would be listed under the 'Also Visible:' system message.
It would be up to the player to determine or work out if the cupboard had any significance in the plot by examining it and so on...
To allow interaction with these 'hidden objects' just create an ordinary noun keyword in the Vocabulary Noun List + any relevant synonyms and create some Response entries eg:

[start]examine cupboard#room=4#flag9=0[acts]cmessYou search the cupboard and find a spanner.#obj3=room#flag9=1[end]

[start]examine cupboard#room=4#flag9=1[acts]cmessYou search the cupboard again but find nothing.[end]

You might also create entries for dealing with 'room' and 'basement'
eg:

[start]examine room/examine basement#room=4[acts]cmessThat`s just background scenery. Nothing special.[end]

Use of hidden objects can make a game more difficult to solve and the player is required to pay attention to everything in the text so as not to miss finding, discovering items or clues..

You may have already noticed that you can embed codes to cause the printed text to be formatted in bold, italic, underline or strikeout or left,center or right aligned. You can also have messages output in a different font and fontsize. Actions "fgcolor=X" and "bgcolor=X" give you some control over the color of the text and allows you to highlight bits of text and emphasise it by making it stand out...

GO TO PART SEVEN



Copyright catventure © 2006 , All Rights Reserved.