Introduction

Welcome Adventure Author!

Welcome to the Mr. Robot editor reference.
Please note - this documentation is work in progress and many pages still need to be written. For the latest version, please visit the Mr. Robot forum.

New users

  • Try out the Getting Started tutorial

Advanced Users

Read up on advanced topics:

  • lua scripting.
  • Complete editor reference.

EDITOR DOCUMENTATION REVISION 1.2

Changelog:
  • 1.2
    • Further commands listed in script command reference.
    • Switch/bollard tutorial
    • Scripting introduction page.
  • 1.1
    • tutorial 2 - connecting rooms.
    • Script Command Reference basic commands.
    • Chat Image Reference.
  • 1.0 Initial release


Default Keyboard Shortcuts

Function | Shortcut
Save Current Room | S
Save World | SHIFT+S
Quit Editor | Q


Copyrights & Trademarks

Copyright © 2006-2007 Moonpod Ltd. All rights reserved.


Untitled Document

Editor Limitations

We have tried extremely hard to make as much of the game open to editing as possible. However, due to time constraints, some parts of the game are not built in a way that can be easily changed via external files. It is not possible to recreate in your own levels some of the functionality that the game exhibits.

Most notably:

  • In game chat: User Adventures support in game pop-up text with two limitations:
    • User created adventures do not recognise the currently intalled language - so it is not possible to create multiple language versions avaiable from the same adventure (although this is possible by creating copies of the same adventure with different translations.)
    • User adventures do not support voiceover files.
  • User created objects. There is currently no support for users to add their own models to the game.

Disclaimer

The editor is provided 'as is' without warranty of any kind, either express or implied, including, but not limited to, the implied warranty of fitness for a purpose.

Use the editor at your own risk - it may crash, or what you create with it may crash the game. We are however dedicated to improving the editing experience and are interested in any feedback you may have.


Getting Started

So, you've decided to take the plunge and author your own adventure?

We can't wait to see what you come up with.

Lets fire up the editor, and get started!
Remember, if you get stuck or have any questions, don't be shy to post on the Moonpod forums.
We are on hand to help along with a helpful and friendly community.

  • On the Main menu, click the EDITOR button to launch the editor.

    Editor Launch Button

  • Select an existing user adventure, or enter the name for a new one and click the OK button.

    Select Adventures Panel

When you are ready, continue to the next step: Creating A Room...


Creating A Room

To start with, we need to add a room to our adventure.

  • From The Rooms tab of the editor panel, click Create Room

     Create Room Button

  • Fill in the Room Name as 'FIRST ROOM' (without quotes). As you add more rooms, having descriptive room names helps when searching for a specific room.
    Set each of the room's dimensions (W, L, H) to 15.
    Create Room Panel
  • Click OK
  • IMPORTANT NOTE:
    The editor will currently crash at this point if you try to add any scenery to the room because even though you have added a room, you have not yet selected it for editing. We hope to iron out some of these issues for adventure authors with future updates..
    Trying to add scenery when no room is selected causes the crash, so the following step is very important!
  • From the Rooms dropdown list, select the room you have just created.
  • Save the world configuration (SHIFT+S).
  • You are now ready to start adding scenery to the room.

When you are ready, continue to the next step: Adding Scenery.


Adding Scenery

Now that you have selected a room, let's get started building it.
For this we will need to use the Static tab of the editor panel. Static stands for 'static object' - basically anything in a scene that does not move.

  • Select the Static tab of the editor panel. At the top of the static pane, there are three drop down lists which are used to select which static 'brush' object you will 'paint' the scene with. The first dropdown selects a global category, the second groups objects by type, and the third selects the object itself. We need to make a floor, so set the 3 dropdowns to:
    Storage>Floors>Floor #1

    Select Block
  • Click on the Create Block button (or press C) to enter create block mode.
  • In the main window, you can now move the block position about using the cursor keys.
    Note that when starting, the brush may be off screen. Use the XYZ CURRENT POSITION indicator (bottom left) to find the brush. A position of x4, y0, z6 should be visible. You can also use the + and - keys to zoom the scene in and out, and CTRL + cursor keys to scroll the scene about.
  • By Pressing ENTER (or RETURN) you can 'paint' the block at the current position. Have a go now by moving the block about with the cursor keys and pressing ENTER. You can press ENTER once, or hold it down and move with the cursor keys to paint the blocks down.
  • To delete the block at the current position, press BACKSPACE.
  • Use the cursor keys, ENTER and BACKSPACE to create a 6X6 floorspace of tiles in the middle of your room:
    6 by 6 floor
  • Now let's add some walls to our room. On the static pane, set the 3 dropdowns to Storage>Walls>Wall #1 Down . At this point you will also need to rotate blocks and move them vertically. Use the Page Up / Page Down keys to move the block position vertically, and the Home / End keys to rotate the block in 90° increments. Practice this now, then when you are ready, add walls to your room as in the image below:
    Room with Walls
  • Notice that we left a gap. This is so we can add a door.
  • On the static pane, set the 3 dropdowns to Storage>Doors>Door #1 down . Place the door as show below:

    Add Door
  • Lastly, we need to add a start position for the player, otherwise the game won't know where to initially place players when they run your game.
    The player start is a special object that is only visible in the editor. It's the position your robot will appear in when you run the room.
    On the static pane, set the 3 dropdowns to Script Objects >Player>Player Start .
    Place the player start icon anywhere in the room which is immediately above the floor.
    aDD pLAYER

When you are ready, continue to the next step: Test Your Room .


Test Your Room

Now it's time for some fun! Let's test out your user adventure!

  • Quit the editor by pressing the Q key.
  • From the main menu of the game, choose PROFILES
  • Create a new game by Clicking the new button in the Game window (bottom left).
    New Game
  • From the Choose an adventure list find the name of the adventure you created and select it, then in the Choose mode window click Start (there is only one mode for user adventures, which will be automatically selected).

    Choose User Adventure
  • You will be transported into your own user adventure.
    Wander around, see the sights! Well, ok, there's nothing much to see right now. Time to go back to the editor and add some objects.
  • Press ESCAPE to bring up the in game menu, and choose Go To Main Menu, and OK.

Note: this adventure is now your current game, so you can quickly enter it in the future by clicking CONTINUE on the game's main menu.

When you are ready, click on the EDITOR button, select your custom adventure from the list and click OK, then continue to the next step: Add Some Objects


Add Some Objects

To add any objects that the player will interact with, we need to use the Dynamic tab of the editor panel. Dynamic stands for 'Dynamic Objects'. Dynamic objects are anything in the scene that can move, or the player can interact with. Crates, switches, keys, even other robots.

Let's start by adding two crates and some energon.

  • Select the Dynamic tab of the editor panel.
  • From the dropdown list choose Crate: Storage (the last item on the list) then click the Create Dynamic Object button.
    Add a Crate
  • Adding dynamic objects works in a similar way to adding static objects: Cursor keys to move horizontally, Page Up / Page Down to move vertically, Home / End to rotate, and ENTER to place the object.
  • Add a storage crate close to the uppermost corner of the room:
    Room: Add Crate
  • On hitting ENTER to place the crate, you will be prompted for additional data about the object:
    Set Object Parameters
    just leave the default settings for now and click the Done button.
  • Now let's give the room a simple goal and add some energon for the player to pick up. Select Energon from the dynamic objects list and place one energon on top of the crate as below:
    Add Energon
  • As before, just use the default settings, and click the Done button:
    Set Energon Parameters

  • Hmm, there's no way for the player to reach the energon right now, so we need to add a half crate 'step' for them.
  • Select HalfCrate: Storage and place the 'step' crate as below:
    Add Half Crate Step
  • Press S to save the room, and then test it out (Q to quit the editor, then click CONTINUE from the game's main menu)

The player needs to push the half-height crate over to the larger crate to be able to jump to the energon. Ok, it's not much of a puzzle is it? However, it illustrates the basic mechanics of a room.

When you are ready, switch back to the editor, and continue to the next step: Adding Some Enemies.


Add Some Enemies

Adding Enemies is done via the dynamic objects panel, and works just like adding any other dynamic object. Try adding a few Robot: Patroller dynamic objects to the scene, then test it out.

Each of the enemies behaves in a different way:

Grid Runner

Robot: Grid Runner

Moves around on raised walkways taking random turns down junctions.

Maniac

Robot: Maniac

Move in a straight line until they hit something at which point they turn a random amount and move off again.

Patroller

Robot: Patroller

Move in a straight line until they hit something at which point they try to do a 90 degree left turn before carrying on.
If they are blocked they try a 90degree right turn and if that doesn't work they just reverse their course.

Guardian

Robot: Guardian

They follow the edge of whatever they are touching so they tend to move in circles around obstacles.

Defender

Robot: Defender

Move in a straight line between two obstacles.

Stalker

Robot: Stalker

Come straight towards the player and try to grab him.

Turret

WaveBlaster Turret

Spins around firing lethal energy pulses.

When you are ready, switch back to the editor, and continue to the next step: Light Your Room .


Light Your Room

Ok, the room looks a little bland right now - time to set up some lights.

There are three types of light used in Mr. Robot: ambient, directional and point lights.

Each Room can have:

  • An ambient light level. This can be set to black if it is not needed.
  • A directional light (think 'sunlight'). You can just set this to black if you do not wish to use it.
  • Up to 5 point lights, which have a falloff. These are the most useful. Be careful not to use more than 5, bad things may happen! Although the game should prioritise the nearest lights, so it should still work.

Lighting is done in a X2 mode. What that basically means, is that if you want to set a light level where the room's textures are lit at their base level, you should set the light colors to 50% grey. Higher than that allows you to 'overbrighten' the textures.

You can set point lights to be displayed (or not) all the time if you wish by ticking the Show Lights box in the Options panel.
Show Point Lights Option

By default, all new rooms are lit with faint ambient light, and a grey directional light pointing straight down.

How to edit the 3 light types:

First, open the Lights tab of the editor panel.

Ambient Light

This is the easiest to use. Ambient light is applied evenly across all surfaces of the model, so if you overuse it the room can look very washed out.

  • Click the Set Ambient button to open a color picker:

    Set Ambient Light Colour
    Just pick a color (a faint blue looks interesting), and then click OK.
    You should see something similar to the image below:
    Blue Ambient Light

Directional Light

A room's directional light is an infinite parallel light. Similar to ambient light, it is applied across all objects with no attenuation (light falloff with distance), however due to being directional, it only lights one side of the objects.

  • Click the Set Main Directional Direction button to change the light direction.
    A direction line appears in the main window. Left click and drag the mouse to rotate the main directional light. Moving the mouse left and right spins horizontally, up and down spins the light vertically.
    If we angle the light down and left, it should bring out the 3 dimensions of the scene by lighting surfaces differently.
    Set Main Directional Light Direction
  • Click the Set Main Directional Color button to open a color picker and change the directional light color.
    Main Directional Colour
    Pick a color (A warm color such as yellow, colpimenting the blue ambient can look good) and click the OK button.
    The room should now look similar to the image below:
    Directional Light Result

You can get some pretty interesting results by just using an ambient light and a directional light with two complimentary colors like blue and yellow or red and green. If you don't need the directional light, it can also be used to give the effect of floor reflected light, by pointing it straight up and setting it to a darker color. That way it doesn't go to waste.

Point Lights

Point lights are a little more complicated, as you have to position them and also set their attenuation - a sphere defining the maximum range that light will travel to.
Light Attenuation
Point Light Attenuation

  • From the Lights panel, click the Create Light button.
  • A light diagram will appear in the main window (note, you may need to zoom out using '-' to see it if the room's origin is off screen)
    Editor Light Representation
    The central rectangle represents the point that light will radiate from, and will also be used to select the light later for editing. The outer rings represent the boundary at which the light intensity will fall to zero.
  • Move the light in the same way you move other objects - horizontally using the cursor keys, and vertically using Page Up / Page Down. To increase or decrease the light's attenuation, use the Home / End keys . The default attenuation range is very small, so to start with, increase the range to three times default to make sure you will be able to see the result.
  • Move the light into the center of the room and press ENTER to choose its color.
  • The light should now be in position (looking something like the image below) . Press ESCAPE to exit light creation mode, or continue to add more lights.
    Point Light

To alter point lights use the Edit Light, Move Light and Delete Light buttons:

  • Edit Light: Click on central rectangle of any light you would like to change the color of.
  • Move Light: Click on any light you would like to move and/or change the attenuation range for. Use cursor keys, Page Up / Page Down. Home / End. Press ESCAPE to exit move light mode.
  • Delete Light: Click on any point lights you would like to delete.

Remember - hardly any light in the real world is grey, so don't be scared to add color!


Connecting Rooms

Now we have one room up and running, let's make another and connect them up.
First, make a basic second room (click Create Room on the Rooms tab), put a floor down in it (using Create Block from the Static tab).
*Note: if you haven't completed the first tutorial, you'll need to make two rooms.

Don't forget to save your world config (SHIFT+S)

There's two ways to connect rooms - doors and teleporters.
Doors are the most common way you'll join rooms together so let's look at them first:

Doors

  • Make sure you have added a door to each of your rooms, then from the Static tab of the editor panel click Edit Settings
    Edit Settings
  • In the main window a yellow selection block will appear. You can position the selection block using the cursor keys/PageUP/PageDN.
    Note that when starting, the selection block may be off screen. Use the XYZ CURRENT POSITION indicator (bottom left) to find the brush.
    You can also use the + and - keys to zoom the scene in and out, and CTRL + cursor keys to scroll the scene about.
  • Position the cursor in the bottom corner of the door as shown below and press ENTER.
    Edit Settings Block
  • Each door in a room has an automatically assigned ID number which is shown at the top under Door ID.
    Below that you will find a drop down list Target Room of all the rooms in your adventure.
    Select the other room in your adventure from this list.
    The second drop down list Target Door ID allows you to select different doors within a room. For now, just leave it as the default since you only have one door in each room.
    Connecting Doors
  • Leave the option Hook up target door to this door ticked so that the other door will be automatically linked back (doors can actually be linked differently depending on from which side you pass through them
  • Ignore the lower settings (these are used to set up doors and keys which we'll cover later) and click OK
  • Your doors should now be hooked up. Make sure you have saved both rooms by pressing S and you should be able to test them out.

Important Notes About Doors:

You must ensure that there is always two tiles deep of empty space in front of every door. This includes ensuring dynamic objects such as crates cannot be pushed into position in front of a door.

Teleporters

Teleporters allow you to instantaneiously warp between two rooms, or even two teleporters in the same room.

  • Open up a room.
  • Add a teleporter from the Dynamic tab by selecting Teleporter from the dropdown list and using the Create Dynamic Object Button.
    Add a Teleporter
  • Set the name of the teleporter to teleport1 and set the destination of the teleporter to teleport2
    Teleporter Settings
  • Repeat the process by adding another teleporter to the room, but this time set the name to teleport2 and the desination to teleport1
  • Save the room and switch back to the game to test it. You should be able to teleport between the two positions.

Important Notes About Teleporters:

  • Teleporter Names are global to the entire adventure, so every single teleporter in your adventure needs to have a unique name.
  • Destination must always be set to another valid teleporter else the game will crash when you try to use the teleporter.
  • You must ensure that there is always three tiles of clear space above every teleporter. This includes ensuring dynamic objects such as crates cannot be pushed into position in front of a door.


Bollards & Switches

Let's add a bollard/switch combination to one of the rooms.

  • Pick one of the rooms you made earlier, then from the Dynamic tab of the editor panel choose Bollard: Storage from the dropdown list.
  • Click Create Dynamic Object
    Create bollard
  • In the main window the dynamic object will appear ready to be positioned. You can position the selection block using the cursor keys/PageUP/PageDN.
    Note that when starting, the selection block may be off screen. Use the XYZ CURRENT POSITION indicator (bottom left) to find the brush.
    You can also use the + and - keys to zoom the scene in and out, and CTRL + cursor keys to scroll the scene about.
  • Position the bollard in the position shown below (raised one tile above the floor) then press ENTER to fix the bollard in place.
  • Set the bollard's name to bollard1 and click Done
    bollard parameters
  • Returning to the dynamic objects panel, select Floor Switch from the drop down list.
  • Position the switch as shown below then press ENTER to fix it in place.
    add switch

  • Set the switch's target to bollard1 then click Done
    switch settings
  • Save your room and then go back to the main game to test it out. Now, when you stand on the switch, the bollard will go down.

You can change the behaviour by altering the settings of the bollard and switch:

Bollard Settings:

  • name : used to assign a unique string to identify the bollard with. Switches can target this, and scripts can access the object by name.
  • initstate : set to either up or down to set the bollard's starting position.
  • numpingson : every time a switch sends a message the bollard is 'pinged'. You can set how many pings are needed to make a bollard activate - multiple switches can then be targetted to the bollard and all are required to enable it.
  • numpingsoff : as above but to disable the bollard.
  • persist : set to yes or no. Decides whether the bollard's current state is stored if you exit the room.

Switch Settings:

  • name : Assign a unique string to identify the switch with so scripts can access the switch.
  • target : name of another dynamic object the switch will send messages to when it is pressed (usually bollards).
  • type :
    • push : Switch needs to be held down to change state.
    • toggle : The switch stays permanently in the state you leave it
    • timed, 1000 : The switch will change state for the number of milliseconds specified.
  • initstate : on or off. Set's whether the switch starts enabled or disabled.
  • persist : set to yes or no. Decides whether the switch's current state is stored if you exit the room.

Important Note About Dynamic Objects:

When a room is entered it is scanned in plan and any 'holes' - places where there are no static objects, are walled off so the player cannot go there.
In fig1 below, the bottom corner of the floor is missing, so the player won't be able to go walk into that square. The player is restricted to the area marked in yellow and bordered red as seen in fig2. If we add a dynamic object into that space such as the bollard in fig3, then the player will still not be able to enter that space (when the bollard is down of course!).
To fix this, you will need to add a hidden static object under the dynamic object. Invisiblocks are great for this as they show up only in the editor but are otherwise invisible. Adding one underneath the bollard as in fig4 means that tile of space is now accessible to the player, and when the bollard is down the player will be able to walk on it.

dynamic object walling


Room Scripts

Mr Robot implements a scripting system for rooms to allow precise control over all the objects and how they interact. Many of the more complicated puzzles in the game use the scripting system which is based on a language called 'lua'.

Create your First Room Script

  1. Make a room and call it ScriptTest . Add the usual requirements as you see fit - some floor space, a player start and a door.
  2. In your prefered text editor (notepad is fine) create a text file containing the following:
    function sequence()
    return false
    end

    function completed()
    return false
    end
  3. Save this text file as ScriptTest.lua in the rooms sub folder of your adventure (e.g: My Documents\MrRobot\data\user\ad000\rooms\ ). As you may have guessed, room scripts are loaded based on the name of the room.

Sequence and Completed Functions - the foundation of room scripts

You now have a working script for your room, however only the framework is in place - the script essentially does nothing at this point! So, what is going on so far? The script at this present time contains two functions called sequence and completed . The game requires these two functions to be there or else it won't run. The sequence function is called every frame until it returns true after which the completed function is called every frame. When sequence() returns true, this is also saved out so if you re-enter a room completed() will run and sequence() will be ignored.

A Note For Non-Programmers

At this point, anyone with programming experience will understand what is going on, however if you are a non-programmer (like me!) you may need a few hints to be clear what is happening. A common issue for non-programmers is that we tend to think in a very linear fashion.
Let's say you wanted to make a room where you enter, a character talks to you, and then restore the player to max health.
You might think you should just add the playConversation() and then restorePlayer() commands to the sequence() function. However, because the game loops through the sequence() function every frame, the conversation will be called every frame and also the player will be set to max health every frame! the only way to get away from the conversation will be to exit the room. What you need is a way to store where you are in a series of events. That's where the next section: finite state machines helps. I encourage all non-programmers to read through it and not be put off by the scary sounding name! It's just programmers trying to sound clever by calling something that's really quite straightforward by a fancy sounding term. Once you get the hand of working this way you'll be able to add your ideas to rooms far more easily and with more control.

Finite State Machines

A common progamming method which we use a lot in our own scripts is a finite state machine. As usual with programming - that's just a complicated term for a very simple programming method. With most rooms, you will want to execute a relatively linear set of events, so we use a variable to store where we are (the state) in that set of events. We then loop though the available states and execute the relevant one during which we may pass control over to another state by updating the control variable.

Here's a quick example:

--Initialise states
START = 1
WAIT = 2
ENERGON = 3

--Set Initial state
g_state = START

function sequence()

if ( g_state == START) then
playConversation("ComeHereForEnergon")
overrideAsimov( true )
g_state = WAIT
elseif ( g_state == WAIT ) then
if ( not isConversationActive() ) then
overrideAsimov( false )
g_state = ENERGON
end
end

elseif ( g_state == ENERGON ) then
player = getDynamicObject( "PLAYER" )
player_x, player_y, player_z = getWorldPos( player )
if ( player_x > 6 ) then
givePlayer( "EXTEND", "" )
return true
end
end

return false
end

function completed()
return false
end

The variable g_state stores where we are in the sequence of events. Note that state names are initialised to a unique number at the top of the script - if you set a state to an uninitialised variable, lua tries to 'help you out' by initialising it to zero - which generally messes things up.

In the above script we begin in the START state which plays the conversation ComeHereForEnergon.txt and disables the player before passing control over to the WAIT state by setting g_state = WAIT . On the next frame, the WAIT state is executed - this checks that no conversations are active and if so re-enables the player and then hands control to the ENERGON state. The Energon check if the player has walked into the right-hand side of the room (player's x position is greater than 6) and if so awards some energon then marks the room script as completed with return true . From now on, the completed() function will be called instead.

As you can see, states are useful control structures for series of events in a room.


Script Command Reference

As well as the full lua scripting system, special extension functions written by the Moonpod team allow you to control parts of the game.
Here we detail the complete command reference of Mr. Robot specific lua extensions.

General Commands

(can be used in both 'ghost' and 'normal' modes)

  • getTime()
    Get the game clock time in milliseconds.
  • timerExpired( int period , int start )
    Return true if the desired time period in milliseconds has elapsed.
    Example >>
    A simple room script that waits 3 seconds after entering the room before launching the 'hello' conversation:
    g_timer = getTime()
    function sequence()
    if( timerExpired( 3000, g_timer ) ) then
    playConversation("hello")
    return true
    end
    return false
    end

    function completed()
    return false
    end
  • playConversation( string conversation_file )
    Play the named conversation file from the chat folder.
    Example >>
    conversation_file is the name part of a text file found in the adventure/chat sub folder of your adventure..
    E.g: if the file is called hello.txt then you need :
    playConversation("hello")

    The chat files need to be of the following format or they will not work.

    {
    PrecacheImages
    {
    0 data\chat\nanomeks\neutral2.tga
    1 data\chat\nanomeks\neutral2.tga
    }
    text
    {
    page0
    {
    textidstring [0]Insert a single line of text here.
    }
    page1
    {
    textidstring [1]Insert a single line of text here.
    }
    }
    x 45
    y 453
    width 350
    imageheight 128
    textheight 160
    }

    The line:
    0 data\chat\nanomeks\neutral2.tga
    is used to specify chat head images to be used.
    These are loaded from the selection available in the main game.
    See the chat image reference sheet for more info.
  • isConversationActive()
    Returns true if any conversation is running, false if not.
  • launchEffectSimple( float x, float y, float z, string name )
    Start up the effect name in the desired world position and then just leave it alone, if the effect respawns you wont be able to stop it ever. If it doesn't then it will stop itself when it has finished.
  • inflictDamage( string name, int damage ) Hurt something.
  • getDynamicObject( string name )
    Returns an identifier for a named dynamic object.
    Example >>

    Get the robot named Huey
    getDynamicObject( "Huey" )
  • getWorldDir()
    Returns the current world folder of the game. Useful for including files
    Example >>

    Include the file 'common_functions.lua' in the 'rooms' folder of the current adventure:
    dofile(getWorldDir().."/rooms/common_functions.lua")
  • debugOut( string output )
    Forces an assertion and writes a string out to the debug window. Useful when debugging scripts. Asserts can safely be ignored to continue.
    Examples >>

    Output "Hello World!":
    debugOut("Hello World!")

    Output variables x,y,z :
    x = 3
    y = 6
    z = 9
    debugOut("X:"..x.." Y:"..y.." Z:"..z)
  • setGravity( float gravity )
     Changes the gravity value in a room. Expects a value between 1 (normal) and something very small, but don't put zero in, that would be mad!
  • sendMessage( string from_object, string to_object, string message, string flags )
    Send an object a message with optional flags.
    Expects a 'from object' identifier (This is almost always set to SYSTEM), a 'to object' identifier and the message with any associated flags, it may return a string as a reply if one is required.
    "PLAYER" always means the player.

    Messages:
    Player
    NUM_LIVES - how many lives does the player have?
    NUM_ENERGON - how much energon does the player have?
    Examples >>

    Set variable 'energon' to the amount of energon the player has.
    energon = tonumber( sendMessage( "PLAYER", "SYSTEM", "NUM_ENERGON", "" ) )

    Set variable 'lives' to the amount of lives the player has.
    lives = toNumber( sendMessage( "PLAYER", "SYSTEM", "NUM_LIVES", "" ) )

    Anything dynamic
    ENABLE - starts running its updateAI function
    DISABLE - stops running its updateAI function
    SHOW - if you pass FALSE it goes invisible, pass anything else and it becomes visible
    INSTANT_MOVE - expects to receive "x,y,z" tile space coordinates and just sticks the object right there
    Examples >>

    Disable a waypoint named 'room3waypoint'
    sendMessage( "room3waypoint", "SYSTEM", "DISABLE", "" )

    Hide a Crate named 'crate3'

    sendMessage( "room3waypoint", "SYSTEM", "SHOW", "FALSE" )

    Robots
    WATCH - tells a robot to watch a named dynamic object
    STOP - robot runs its normal ai routines but doesn't move around of its own accord
    WANDER - move between the specified "x,z" coordinate string, if you are ever facing a control panel then go beep, beep
    ANIMATE - override and run the specified animation, can be sent ANIM_FREE to allow it to return to internal control
    NEEDS - initially just supports "NOTHING" to force it have whatever it wants
    Examples >>

    Tell the robot named 'Raistlin' to always look at the player's position
    sendMessage( "Raistlin", "SYSTEM", "WATCH", "PLAYER" )

    Make the robot 'dumbot3' wander between thee coordinates: 2,1,5 | 1,5,3 | 10,3,10 | 1,13,1

    sendMessage( "dumbot3", "SYSTEM", "WANDER", "2,1,5,1,5,3,10,3,10,1,13,1" )

    Play Samson's 'ACTIVATE' animation then revert back to playing any required animations after 2 seconds

    g_state = START
    g_timer = 0

    function sequence()

    if( g_state == START ) then
    sendMessage( "Samson", "SYSTEM", "ANIMATE", "ACTIVATE" )
    g_timer = getTime()
    g_state = END
    elseif( g_state == END ) then
    if ( timerExpired( 2000, g_timer ) )
    sendMessage( "Samson", "SYSTEM", "ANIMATE", "ANIM_FREE" )
    return true
    end
    end

    return false
    end
    function completed()
    return false
    end

    Bollards
    IS_UP - returns whether the bollard is either UP, DOWN, TRANSIT
    GO_UP - make it go up if not already
    GO_DOWN - make it go down if not already

    Waypoints
    HAVE_SAVED - returns whether the waypoint has been used TRUE, FALSE

    Floor switches
    IS_DOWN - returns TRUE or FALSE

    platforms/lifts
    PING - make it start moving (message = ON) or make it stop (message = OFF)
  • openDoor( int doorID, bool instant ) Get the door of given ID from the current room and force it open.
    doorID is the integer ID number of a door in the current room (you can find this value by using the static object - edit settings tool in the editor to examine a door).
    instant is set to either true of false and determines whether the door will be opened instantaneously (true) or whether it will animate close (false).
    Examples >>

    Open Door 2 with animation:
    openDoor( 2, false )

    Open Door 1 instantly:
    openDoor( 1, true )
  • closeDoor( int doorID, bool instant ) Get the door of given ID from the current room and force it closed.
    doorID is the integer ID number of a door in the current room (you can find this value by using the static object - edit settings tool in the editor to examine a door).
    instant is set to either true of false and determines whether the door will be closed instantaneously (true) or whether it will animate close (false).
    Examples >>

    Close Door 2 with animation:
    closeDoor( 2, false )

    Close Door 1 instantly:
    closeDoor( 1, true )
  • gameComplete() Tells the front end to mark this adventure as completed.
  • saveKeyVal( string name, string data )
    Anything put here is permanent and saved out with the game
  • getKeyVal( string name )
    pull back a value from permanent storage given a key
  • isDoorOpen()
    returns true if the door is open else false.
  • getWaterHeight()
    Return the current height of water in the room. Note that the game can't identify individual water so assume if the script runs it treats it as just one
  • setWaterHeight( float height )
    Sets the height of water in the room.
    Example >>
    Complete room script which sets the height based on a whether switch named 'flood_control' has been enabled.
    *Make sure to set the switch type to 'toggle' in the editor.
    --Water raise/lower speed, upper and lower heights.
    -- Set these to whatever you need.
    g_waterInc = 0.04
    g_waterLower = 1
    g_waterUpper = 3

    function sequence()

    desiredHeight = g_waterLower
    if( sendMessage( "flood_control", "SYSTEM", "IS_DOWN", "" ) == "TRUE" ) then
    desiredHeight = g_waterUpper
    end

    actualHeight = getWaterHeight()
    if( actualHeight < desiredHeight ) then
    frac = desiredHeight - actualHeight
    if( frac < g_waterInc ) then
    actualHeight = desiredHeight
    else
    actualHeight = actualHeight + g_waterInc
    end
    elseif( actualHeight > desiredHeight ) then
    frac = actualHeight - desiredHeight
    if( frac < g_waterInc ) then
    actualHeight = desiredHeight
    else
    actualHeight = actualHeight - g_waterInc
    end
    end

    setWaterHeight( actualHeight )
    return false
    end

    function completed()
    return false
    end

  • restorePlayer()
    Put player's health back to max.
  • overrideAsimov( bool override )
    If set to true then the player cannot move. set back to false to allow player movement.
    Example >>
    Simple room script which, on entering the room, disables the player, plays the conversation file hello.txt then waits for the player to cancel the conversation before enabling movement again.
    --Initialise states
    START = 1
    WAIT = 2

    --Set Initial state
    g_state = START

    function sequence()

    if ( g_state == START) then
    playConversation("Hello")
    overrideAsimov( true )
    g_state = WAIT

    elseif( g_state == WAIT) then
    if ( not isConversationActive() ) then
    overrideAsimov( false )
    return true
    end
    end

    return false
    end

    function completed()
    return false
    end

  • takeFromPlayer( string item, string sub_type )
    Look through the player's inventory and grab one item that matches.
    Needs a string passing in containing the item type.
    A sub type can also be specified to lock in on the exact item required (optional).
  • givePlayer( string item, string sub_type )
    Given an object type and a sub type (if appropriate) then put said object into the players inventory.
    KEY - subtype specifies exactly which key and adds it to the player inventory
    SERVICE_DROID - subtype equals droid name, sets up as ghost and adds some items
    SECURITY_BOT - ditto

    other - assumes you are refering to a ghost item, first string is type, second string is name
    ###need item reference here.
  • getDynamicObjectName( string indentifier )
    Return the name of a dynamic object given its identifier.
  • getDynamicObjectTypeName( string indentifier )
    Return the type of a dynamic object given its identifier.
    ###type reference needed
  • getWorldPos( string identifier )
    Get the world position in tile space of the dynamic object identified by identifier
    Example >>
    set the variables player_x, player_y, player_z to the player's x,y,x position
    player = getDynamicObject( "PLAYER" )
    player_x, player_y, player_z = getWorldPos( player )
  • loadSFX( string filename, float volume, bool loop, bool fixed, string parent_identifier )
    Preload a sound effect.
    filename sets the relative path to the wav. volume should be set between 0 and 1, but go up to 9 (and will likely distort). loop should be set to true or false and set whether the wav will continually loop when played. fixed should b set to true of false, and determines whether the sound will attenuate based on the relative distance between the player and the sound's owner, or whether it will play at a fixed volume. If set to false then parent_identifier must also be present. parent_identifier is a pointer to another object (such as a robot) that owns the sound.
  • stopSFX( string filename )
    Stop a sound. Useful if it is looping.
  • playSFX( string filename )
    play a pre-loaded sound effect when given a filename
    sound effects filename reference.
    Example >>
    Load the crate-drop wav and play it.
    loadSFX( "data/sounds/crate-drop.wav", 0.9, false, false )
    playSFX( "data/sounds/crate-drop.wav" )
    See the sound effects filename reference sheet for more info.
  • more to come in the next update to the editor docs...


LUA Resources

  • The official lua reference manual.
  • http://www.lua.org/pil/index.html A nice free book on lua.


Chat Image Reference

Chat images available in Mr. Robot and their associates paths.

Asimov chat head 1 data\chat\asimov\neutral1.tga | Asimov chat head 1 data\chat\asimov\neutral2.tga | Asimov chat head 1 data\chat\asimov\neutral3.tga
Brutus chat head 1 data\chat\brutus\neutral1.tga | Brutus chat head 1 data\chat\brutus\neutral2.tga | Brutus chat head 1 data\chat\brutus\neutral3.tga
Dyson chat head 1 data\chat\Dyson\neutral1.tga | Dyson chat head 1 data\chat\Dyson\neutral2.tga | Dyson chat head 1 data\chat\Dyson\neutral3.tga
Asimov chat head 1 data\chat\eve\neutral1.tga | HELchat head 1 data\chat\hel\neutral1.tga | HEL chat head 2 data\chat\hel\neutral2.tga
HEL chat head 2 data\chat\hel\neutral3.tga | HEL chat head4 data\chat\hel\neutral4.tga | Bollard chat icon data\chat\help\bollard.tga
Conveyor chat icon data\chat\help\conveyor.tga | Crane chat icon data\chat\help\crane.tga | Cryo chat icon data\chat\help\cryo.tga
Energon chat icon data\chat\help\energon.tga | Fragile crate chat icon data\chat\help\fragile.tga | Half Crate chat icon data\chat\help\halfcrate.tga
Lift chat icon data\chat\help\lift.tga | locker chat icon data\chat\help\locker.tga | Login Console chat icon data\chat\help\halfcrate.tga
Press chat icon data\chat\help\press.tga | Replciator chat icon data\chat\help\replicator.tga | Shop chat icon data\chat\help\shop.tga
Switch chat icon data\chat\help\switch.tga | System chat icon data\chat\help\system.tga | Teleporter chat icon data\chat\help\teleporter.tga
Terminal chat icon data\chat\help\terminal.tga | Transit icon chat icon data\chat\help\transit_icon.tga | collapsing walkway chat icon data\chat\help\walkway_fadeable.tga
Waypoint chat icon data\chat\help\waypoint.tga | Shop chat icon data\chat\help\shop.tga | Shop chat icon data\chat\help\shop.tga


Chat Image Reference

Sound Effect Filename Reference

data/sounds/crate-drop.wav
data/sounds/lift-loop.wav
data/sounds/crate-drop.wav
data/sounds/doors/airlock_wind_loop.wav
data/sounds/doors/airlock-alarm.wav
data/sounds/robots/dyson.wav
data/sounds/doors/crusher_door_open.wav

###full directory dump of release version required