Script Editor

001 Game Creator uses “Event-Driven Programming”, which is a form of coding where pre-written pieces of code (or “Events”) are used to build scripts in a visually orientated way, rather than typing lines of code.


General

In 001 Game Creator, all scripts have a root which is the “Start” event. Events connected to “Start” will begin when the script is executed and will flow in order, like a flowchart. Anything not connected to this event will be ignored. You can view a longer list of pre-built events by clicking the “Expand Events” button at the bottom of the Script Editor. Each event comes with a small description which tells you what it does.

When adding new events, they will automatically attach themselves to the last event selected or the “Start” event (if no other events have been placed). The links between events can be broken by right-clicking them. You can reattach these links by clicking and holding the desired node and moving the cursor over an event you wish to attach, until a red line appears – showing the events being attached. Release the mouse button to attach the events.

Some events have parameters that can be changed to produce your desired result. For instance, the “Change Existence” event has the option to change whether an actor “exists” or not. To change these options, double-click on the event or right-click and select “Edit” from the drop down menu.

Some events also have a sub directory. If these events have parameters also then they can only be edited by right-clicking and selecting “Edit” from the drop down menu. Double-clicking these events will open their sub directory.


Textual Scripting

If you are a newcomer to 001 Game Creator or are unfamiliar with BASIC, it is not recommended that you use Textual Scripting. By clicking “Mode” from the menu and selecting “Textual”, all of your events will be converted into code HOWEVER once your script is saved, this action cannot be undone. If you attempt to switch back to “Graphical” scripting, your existing events will be lost. It should also be noted that textual scripting offers no advantages over visual scripting and for all intended purposes is considered legacy.


Use Value Scripting

A lot of events in Graphical Scripting will give you the option to retrieve data from different Use Values by clicking on the clear button next to an event parameter. These are used to retrieve a value from data, or an object, into the event parameter.

The “Comparison Branch” and “Multi-Comparison Branch” events can be used to compare Use Values against specified criteria. For example: you could use the “Number of Items” Use Value to check if the Player/Party is holding a specific Item(s) and then execute different scripts depending on whether the conditions have been met.


Identifiers

These include: Global Variables, Local Variables, Switches, Collections and Tables. An identifier is used for storing and retrieving information for use in-game.

For example: if I had a Global Variable that stored apples and I wanted to add to it, I would write something like: intApples + 1 – “intApples” being the identifier that I want to change.


String/Numeric Literals

When referring to string literals, enclose the string with quotations (“ ”). For example: when displaying the player’s name, you would first store the name in a Global Variable. You could then call this name in dialogue by using & strPlayersNameThe concatenate operator (&) is used alongside the name of the Global Variable to retrieve the name data from the Variable.

Since “Your name is ” is just a piece of text to display, it’s wrapped around in quotes. The concatenate operator (&) is then used alongside the Global Variable which joins the two segments together so that it looks like this to the player: “Your name is Lee.” The space between “is” and the last quotation is used so that the text prints a space between the words, instead of “Your name isLee”.

When referring to an identifier or Use Value there is no need to include quotations as the previous example showed. The Global Variable is not put in quotations because 001 Game Creator would treat it as a string and would display: “Your name is strPlayersName” instead of actually retrieving the player’s name from the Global Variable. It also needs to be inputted into a “Value” formatted text box (colored dark gray instead of white). 001 Game Creator will try to anticipate this on its own but in instances where it doesn’t automatically change, you can manually force it by selecting “(Value)” from the Use Value dialog (which you can launch by clicking the small square next to any event parameter). See images below for reference:

This rule does not apply for numeric literals however. For example: when adding a number onto a Global Variable, write the following: intApples + 3This means that it will take the value out of “intApples” (in this case 1) and then add 3 onto it so it would return the value 4.

If intApples + “3” was inputted instead, it would return 13, because “3” was being treated as a string instead of a number. It wasn’t added with the Global Variable, it was instead added as a string next to the value stored in the Global Variable. If this was done again with the first example it would return 7, and for the second example it would return 133. See image below for reference:


Operators

  • [+] – adds two values together.
  • [-] – subtracts two values from each other.
  • [*] – multiplies two values together.
  • [/] – divides two values from each other.
  • [\] – divides two values from each other and only returns the integer portion of the division.
  • [=] – determines if one value is equal to another.
  • [<] – determines if one value is less than another.
  • [>] – determines if one value is greater than another.
  • [<=] – determines if one value is less than or equal to another.
  • [>=] – determines if one value is greater than or equal to another.
  • [<>] – determines if one value is not equal to another.
  • And – determines if two or more values are true (for example: Player1.NonExistent = Existent And Player1.Name = “Bob” – the script won’t execute unless “Player1” is both existent AND called “Bob”)
  • Or – determines if one or the other value is true (for example; Player1.NonExistent = Existent Or Player1.Name = “Bob” – the script will execute if “Player1” is either existent OR called “Bob”)
  • Xor – determines if one and only one of the two values being compared is true. If you use the regular “Or” operator and both values are true it’ll return as being true however with the “Xor” operator the value will return false because only one of the two values can be true.
  • Not – used with “And” or “Or” operators to determine if a value is not true (for example: Player1.NonExistent = Existent And Not Player1.Name = “Bob” – the script will only execute if “Player1” is existent AND is NOT called “Bob”)
  • Concatenate (&) – used to join multiple values together (for example: “My name is ” & strPlayersName – with “strPlayersName” being a Global Variable that stores the main players name). Not to be mistaken by the Add operator. The Add operator will literally try to add the two values together as if it’s a mathematical equation whereas the concatenate operator is used as a means of joining values together and then comparing the expression as a whole.
  • Imp – determines if the second value is true or both are false.
  • Eqv – determines if two values are both true or both false.
  • Mod – divides two values and only returns the remainder.

Referencing Objects

When using triggers and events that specifically refer to an object (like an Actor, Timer/Spawn, Light, Item/Magic, etc.) you’re able to reference them by their unique Scripting ID, however you can also use the global terms “relate”, “this”, “main” and “party” to reference these objects as well. Their availability and usage will vary depending on the type of object and the location of the script/trigger. See below for a breakdown of what each of these terms refers to:
  • (“relate”) – returns information about the object responsible for activating an event or trigger. For example: If you have a ‘Collided with Actor’ trigger, you can use “relate” to return the Scripting ID of the Actor responsible for triggering it.
  • (“this”) – returns information about the object that the script being executed is in. For example: If you have a ‘Start/Stop Timer/Spawn’ event inside a Timer/Spawn script, you can use “this” to refer to itself, rather than needing to specify the Timer/Spawn by its Scripting ID.
  • (“main”) – returns information about the Actor that the player is currently controlling. For example: If you have a ‘Position Actor’ event, you can use “main” to move the playable character without needing to reference its Scripting ID. This is especially useful in games where you have multiple party members that the player can switch between but only want to reference the Actor that the player currently has control of.
  • (“party”) – returns information about the whole party. For example: If you have a ‘Change Health’ event, you can use “party” to change the health of every party member at once, rather than needing to manually select each party member by their Scripting ID or use multiple events.

Call By Name

The Structure.CallByName Use Value allows you to return a Variable, Switch, Collection or result of a Custom Event using an identifier containing the name. For example: If you wanted to return a Collection based on a name stored inside a Variable, then the “Call By Name” Use Value would be required, as typically 001 will use the Variable name itself (rather than its stored value) to look for the Collection.


Evaluate

The Structure.Evaluate Use Value allows you to execute text scripts and/or have it return a value. A useful purpose for this is that you can read or write to any named Table or Collection. To make use of the return function, use “Return” followed by whatever it is you wanted returned. For example: Structure.Evaluate("Return(Table.Size(" & tablename & ",1))") will return the width of a named Table stored in the Variable “tablename”


Double Quotation Marks

To add a double quotation mark (“) use Text.Char(34) instead of using two single quotation marks.


Date/Time

The Time.Now Use Value allows users to retrieve the current system Date/Time from your computer/device and format it in a variety of different ways. By typing a percentage sign (%) followed by a letter (A) into the Format text box, the Date/Time retrieved will automatically be formatted in one of the following ways:

Please note: Formats with an asterisk (*) besides them are locale-dependant. Android devices & HTML5 do not respect this and will always return a US format instead.

Specifier Replaced by Range Example
%a Abbreviated weekday name * Mon-Sun Thu
%A Full weekday name * Monday-Sunday Thursday
%b Abbreviated month name * Jan-Dec Aug
%B Full month name * January-December August
%c Date and time representation * Thu Aug 23 14:55:02 2001
%d Day of the month, zero-padded 01-31 23
%H Hour in 24h format 00-23 14
%I Hour in 12h format 01-12 02
%j Day of the year 001-366 235
%m Month as a decimal number 01-12 08
%M Minute 00-59 55
%p AM or PM designation PM
%S Second 00-59 02
%U Week number with the first Sunday as the first day of week one 00-53 33
%w Weekday as a decimal number with Sunday as 0 0-6 4
%W Week number with the first Monday as the first day of week one 00-53 34
%x Date representation * 08/23/01
%X Time representation * 14:55:02
%y Year, last two digits 00-99 01
%Y Year 0000-9999 2001
%Z Timezone name or abbreviation * (if timezone cannot be determined, no characters) CDT

Message Box Markup

Please see our Message Box Markup page to learn how to pass additional parameters to text when using either the “Message Box” or “Advanced Message Box” events or when creating Text / Graphic Fields on your Interfaces.


Units of Measurement

  • Pixels – the very small squares used to make up an image are called pixels. If you have a screen resolution of 800×600, the game will show 800 pixels running horizontally and 600 running vertically.
  • Milliseconds – this is 1/1000th of a second. 1000 milliseconds are equivalent to 1 second. When accessing time values directly, always use milliseconds. However, in scripts, time can be specified in hours, minutes, and seconds. For instance, Delay 5 seconds in script from will turn into:
    Pause(5000) ms

  • Pixels Per Millisecond (px/ms) – this is the amount of pixels an object will move by per millisecond. this is used for things such as Actor Speed. When setting a value for the event “Change Maximum Speed”, the unit specified is in “v” (velocity). For example:
  • Change Maximum Speed to 5 (v) in script form will turn into:
    SET Actor("main").Speed = 0.05 (px/ms) In other words if you divide v by “100” you get how Velocity will transform in script form.

  • Pixels Per Millisecond Squared (px/ms/ms OR px/ms²) – this is the amount of pixel an object will move by per millisecond, per millisecond. An Actor’s Acceleration and Velocity are measured using this. When setting a value for the event “Change Acceleration”, the unit specified is in “a” (acceleration). For example:
  • Change Acceleration to 5 (a) in script form will turn into:
    SET Actor("main").Acceleration = 0.00005 (px/ms²)In other words if you divide a by “100,000” you get how Acceleration will transform in script form.

    These examples illustrate the specific conversion ratio between script values and user-specified units.