RAGG page

Scripting in RAGG

The scripting language is Scheme but without most primitives. To understand how RAGG scripting works it is probably a good idea to read through some basic scheme-tutorial first.

Events

Scheme-functions are triggered by events. The name/identifer of a function tells the enginee what event it corresponds to.

A function named kitchen::sink::LOOKAT, will be executed when the player looks at the hotspot sink in the room kitchen.

The events available are:

Commands

A command is a piece of code that tells the enginee something. Commands are built up by two parts, a function-name and arguments.
(function-name argument argument ...)

Available commads

add-item, begin, hide-hotspot, hide-object, remove-item, run-script, set-character-property, set-music, set-room, show-hotspot, show-object, speak


add-item

(add-item character item)

This will give the character with identifier character the item identified by item.

begin

(begin cmd1 cmd2 ... cmdn)

This will execute the commands cmd1,cmd2 e.t.c. in a sequence.

hide-hotspot

(hide-hotspot full-id)

This will deactivate the hotspot identified by full-id, i.e. "kitchen.sink" means the hotspot sink in the room kitchen.

hide-object

(hide-object full-id)

This will hide the object identified by full-id, i.e. "kitchen.sink" means the object sink in the room kitchen.

remove-item

(remove-item character item)

The character with identifier character will loose the item identified by item. If the character doesn't have the item nothing happens.

run-script (no point..)

(run-script script-id)

This will execute the script identified by script-id.

set-character-property

(set-character-property id property value)

set-music

(set-music file-name)

Plays a song, file-name could be for instance "muppets.mp3". To stop the music use (set-music "").

set-room

(set-room id)

Changes which room is shown in the game. id is the identifier of the room.

show-hotspot

(show-hotspot full-id)

This will activate the hotspot identified by full-id, i.e. "kitchen.sink" means the hotspot sink in the room kitchen.

show-object

(show-object full-id)

This will show the object identified by full-id, i.e. "kitchen.sink" means the object sink in the room kitchen.

speak

(speak character speach)

This will make the character with identifier character speak the words of speach for a while.


Examples

Making a character say something:
(define (harbor::sailor::TALKTO)
(speak "player" "hello there old man!"))

Switching rooms: (obsolete)
(begin
(set-character-property "player" "room" "kitchen")
(set-character-property "player" "position" "32,90")
(set-room "kitchen"))