The Script Browser

From FleshWorks

Jump to: navigation, search

By ProjectX


A lot of this has been touched on in other tutorials, but it is easier for someone to learn about it from one single place.

Contents

Basic Information

- To access the Trigger Script Browser in T3ED go to View -> TriggerScripts. It may take a shorttime to load, so don't worry, it hasn't crashed. - Information detailing all of the actions and conditions can be found here: Scripting Reference - TriggerScripts can be added to an actor by adding the property "TriggerScripts" found under "Scripts".

The Browser

By now the browser should have loaded and your presented with a tree-view of all the scripts available. To the left is a menu. Most of the buttons are to do with development in a team cross a network, so we won't worry about them. The buttns we will be concerned with are "New", "Edit" and "Remove". These, obviously, add a new script, edit an existing script, and remove an existing script. Try to guess which ones do what. There are also "Group" and "UnGroup" buttons which will organize and disorganize groups of scripts into the folders that you can see on the tree-browser.

The Script Editor

Go ahead, press the "New" button. Almost instantaneously a new window has opened. On the left is another menu, this time containing moreimportant buttons. The tree-view looks slightly different too, it contains two coloured "branches" "Conditions" and "Actions". Conditions are the things required for the script to run and actons are what the script does. We'll have a look at these in a bit more detail later.

At the top you will see a text box for entering the name for a script. Add a name now, don't wory it will tell you if that name is being used.

It is important to realize that scripts are applied to actors (the name given to any object in the game, i.e. an ambient sound, or a static mesh). Therefore any conditions or actors that refer to "me" or "MYSELF" indicate the actor the script has been added to.

The second important thing to remember is that actions are executed in the order that they appear on the script browser. If you have the action "Play SoundSchema At My Position" and then the Action "Wait 2.0 Seconds Game Time" the schema would play before the script waited two seconds. If the script was "Wait 2.0 Seconds Game Time" and then "Play SoundSchema At My Position" then the script would wait two seconds before playing the schema.

Conditions

Click the "Condition" button and you'll see that another tree-browser appears for you. There are loads of these conditions, as there are actions, so it can seem quite daunting, but (most of the time) they are arranged into logically-named folders for ease of use. If you hover over a condition you will often find that a helpful tooltip appears to describe the purpose of the condition, but not always, which is why the wiki has a Scripting Reference, which you can add to at any time.

Conditions and actions have a format that follows plain text, however every now and then you will notice a pair of [] and inside a descripton of a datatype. These are the parameters that let you customize the condition to suit your script. When you add a condition you click on the entry inside the [] and a menu opens for filling in the box. The Script Editor will not let you save a script unless all parameters are filled in.

There are two types of Conditions, the "when" conditions and the "Query if" conditions. "When" conditions will fire the script as soon as the condition is met, whereas "Query if" conditions require a previous "when" condition to be met and then the script won't do anything unless the query if turns out to equal true.

One final condition (which can be found under scripts) is the logic condition. This lets you group conditions under one logical function (i.e OR or AND) to allow more flexibility in the scripting.

Actions

If you click the Action button the same window will open, but with actions in instead of condiions, as such there is no real need for me to describe it to you.

When adding actions you must bear in mind that there is a chance that some of them will not work, if this is the case then you may have to find anothr way around. Any actions or conditions found in the tutorials on this wiki, however will have been tried and tested to work.

If you want to repeat a script after it has been done once add "rest scrip condition and actions" to the end. This can be found under "scripts".



Back to Mission Design: Scripting Tutorials Page

Back to Mission Design Tutorials Page

Back to Main Tutorials Page