Halo 5 Scripting Infodump

cocookies4youDec 18 2015733.3K116
    Halo and Forge Discussion

Now that I've spent some time with Halo 5's Forge, I think it's time for another one of these threads. When I come back tomorrow, I'll update it with more information and work on making sense.

General Terminology:
- A, B, C... Z : Halo 5's scripting channels, which go from Alpha to Zulu.
- 1, 0, T : 1 and 0 refer to the power states of a channel, being on and off. T stands for toggle.
- @ : Stands for message.
- & : The "Minimum to Trigger" counter for the "Multi" condition.
- Event : Special conditions that do not rely on variables.

Important Terminology: Channel, Power, Message
A channel runs from <A> to <Z>.

A channel's power state can be 1 or 0, default at 0. Scripts can use this data for their conditions, and unlike H2A, they can detect both 1 and 0 states.

A channel message is like a signal.

Condition-Based Scripting:
Halo 5's scripting is based on conditions and actions. I'll be using the following form for scripts:

(Condition) {Action}

When the condition is true, then the action occurs. Let's look at an example:

(A = 1) {B = T}

All this means is that if (channel <A> is powered on) then {channel <B> will be toggled}.

Events and Send/Receive Message:
We have the (<A> = 1, 0, T) as options for the power state condition. We know what 1 and 0 are, but you may be wondering, how does T work? Well, T is a special kind of condition I like to call an event.

Events are conditions that do not rely on existing variables, but rather, trigger on actions. For instance:

(A = 1) triggers when channel A becomes 1.

(A = T) triggers whenever channel A is changed.

As an added note, all messages, denoted as @, are events.

(A = @) {B = @}

This translates as if (channel A receives a message), then {send a message to channel B}.

On Message/Power Multi Condition:
I'm calling it the Multi condition for short. When you choose it, you're given 5 inputs: "Minimum to Trigger" aka &, and "Condition 1-4". All #& means is that for the action to occur, at least # number of conditions must be true. Here's an example:

(& = 4;A = 1;B = 1;C = 1) (<D> = 1) {E = 1}

Starting from the beginning, you need at least 2 conditions to be true in order for the action to occur, which will set channel E to 1.

If A = 1, B = 0, C = 0, and D = 0, then the action {E = 1} will not occur. But if any of the variables at 0 become 1, then the action will occur.

Event Condition Action Scripting:
The Multi condition allows normal conditions to be mixed with events.

(& = 4;A = $;A = 1;B = 1;C = 1) {D = 1}

If A receives a message and the following are true: A = 1, B = 1, and C = 1, then D = 1.

Scripting Order:
Scripts check through all conditions first, and then activate actions. In other words, the order of your scripts do not matter. As for how it's relevant, here's an example:

Initial Conditions : A = 1, B = 0, C = 0
Script 1 : (A = 1) {B = 1}
Script 2 : (& = 2;A = 1;B = 0) {C = 1}

Here's what happens:

0. B and C begin at 0.
1. A becomes 1.
2. Script 1's conditions are checked.
3. Script 1's conditions are met.
4. Script 2's conditions are checked.
5. Script 2's conditions are met.
6. Script 1's actions occur, setting B to 1.
7. Script 2's actions occur, setting C to 1.

As such, the order of your scripts do not matter. If it did, here's what would've happened.

1. Script 1's conditions are checked.
2. Script 1's conditions are met.
2. Script 1's actions occur, setting B to 1.
3. Script 2's conditions are checked.
4. Since B is 1, Script 2's conditions are not met.
5. Script 2's actions do not occur.

As for the actual order for condition checks and actions, Script 1 goes first, then Script 2, etc. I'll have to test the global hierarchy later, but I presume that older scripts are prioritized. As for the implications, it doesn't actually matter. Although it'll come into play if you have overlapping actions such as {A = 0} for one script and {A = 1} for another script with the same conditions, that kind of thing is a logic error, meaning you should probably clean it up for efficiency's sake.

Other Trivia:
- Most objects can hold scripts. The limit is 7 scripts per normal objects.
- Thanks to the Multi condition, you can have up to 4 conditions per script.
- You can only have 1 action per script.
- Certain objects have the "Interact" condition, most notably Switches.
- When using the "Move" action, objects normally move according to their angle. If the "Local" option is disabled, they will ignore their angles and move according to the absolute XYZ axis.