Programming by Example

 

A BB4W Compendium

freeman69@gmx.com

IDIC BBC_Owl2 M&P

Ramora

Ramora is a scripting language that allows the user to create and manipulate a database of 'objects'. It's original purpose was to act as a text-based adventure game engine.

Every object has a name and is unique. Every object can have any property associated with it. Any property can have any string value.

Some properties are reserved e.g. allowing objects to contain scripts. Scripts manipulate object properties and can even create new objects.

 

Ramora is not an object oriented language because there is no ecapsulation or inheritance.

 

There are 2 databases: the design level (zero) and the active/play level (one). The user can add to and update the design level database from within the game. The game itself uses Ramora code to update the play level database e.g. moving characters and testing for certain conditions.

 

The language uses tokens instead of english words:

/ = LET e.g. / object.property='value'

> = PRINT e.g. > object.property

[ = IF THEN e.g. [ object.property='value' ] > 'values are equal'

< = CALL eg. < object.command (executes ramora code associated with the 'command' defined as an object property/command scripts)

 

Assignment (LET, /) statements use '=' to set/replace a value and '+' to concatenate.

 

Multiple statements can be separated using '~', however these can confuse the parser in design mode and are therefore only executed as multi-statement lines during game play. Avoid using '~' by creating multi-line commands instead. IF ([) statements may require multiple conditions to be tested, each separated by '~'.

 

IF statements test for equality '=' and non-equality '}' only.

All statements have a fixed format for speed of processing, including spaces.

 

The most basic elements of Ramora allow the user to create and update the database, including loading and saving:

l = load (design level database)

s = save (design level database)

d object = display object properties

r = reset - copy the design level database to the active level

e = execute all scripts

 

The file structure is such that a text editor can be used for making amendments. (A necessity really, as Ramora is not user friendly and it's easy to make mistakes and amending is simpler using Notepad.)

 

 

 

Reserved object properties:

 

Active flag/property e.g. @:N This inhibits the execution of object scripts and commands.

 

Scripts e.g. $_unique:Ramora code

Where 'unique' is a unique identifier for the property. Scripts are executed every turn. The property contains Ramora code to be executed if the object is 'active'. The unique identifier does not control the order of execution.

 

Commands e.g. <_command_unique:Ramora code, are executed upon a direct CALL e.g. < object.command

Where a 'command' is an action/procedure associated with a specific object. One command can be comprised of multiple lines/properties.

The prefix '<_' identfies the property as a command so that commands can be identified and listed easily (i.e. when using 'examine')

 

 

 

Reserved Adventure object properties:

 

In order to add mobility to characters and objects in an adventure, a 'mobility' instruction was added to Ramora for use in scripts e.g.

$_walk:m fred

'm' is the active Ramora instruction that will cause 'fred' to move, if the relevant properties exist:

object.patrol = string of directions e.g. 'n00s00e00w'

object.enroute = pointer to letter in 'patrol' property e.g. '1'

 

Note that compass directions must be lower case.

Zero '0' means wait.

If a direction is invalid then it is skipped.

When the end of the patrol string is reached, the 'enroute' pointer loops back to the beginning.

 

 

Use the command 'display (obj)' to display an object's live properties, while playing.

Use the command 'design' to switch to design mode.  

 

Download:

 

 Source code of Text Adventure Game Engine

 

 Compiled Text Adventure Game Engine

 

 

 Game: 'Oldhelm' (place the 'RamoraD' text file in the same folder as the program.)