Understand the script editor

From Game Editor

Jump to: navigation, search

Utilizing the script editor will allow you to reach gameEditor's full potential. The script editor allows you to run custom functions and all of the built in functions that you are used to. Script Editor is one of the response choices when selecting an actor's event. When in script editor, you can create variables, internal to script, and global. Simple variable understanding will greatly increase your game making capabilities. Script Editor uses user made functions as well as the built in functions like ChangeAnimation. gameEditor will run through the script when the event is triggered, reading it line by line. You can manipulate variables and use them to trigger certain events. That way, you can decide how events should react.

There are several buttons on the lower end of the editor. [actors] [variables/functions] [Variables] [Global code] [File] [OK]

[actors]

When clicked this will show you all actors, and clones. If you click a certain actor, the actor's name will appear in the script editor. This can be helpful when determine the actor for specific events.

[variables/functions]

This is the master list of functions that can be used, along with built in actor variables(x, y, xprevious, and so on), and user variables, either made from the variable button or global code. Some events, like ChangeAnimation, will prompt you with what the function needs, but not all of them do this. The more you use script editor, the more functions you will use, eventually making custom functions from Global Code.

[Variables]

The main reason users start using Script Editor is for variable manipulation, as it is a very basic yet versatile technique. To make your own variables, click this and fill in information about the variable. You can either edit an exsisting variable, make a new one, or delete one. To make a new one, click add. It will then prompt you for a variable name. This should be descriptive enough so you will remember what you are using the variable for. The next is variable type, it is preset to integer. Integers are any whole number, with some limitation. Real depicts a double, which allows decimal values. Last is a string which holds characters. One really important use for these variables instead of global code, is actor variables. It gives you a choice between global and actor. Global means there is only one copy of this variable, and any actor/code can see and use this. Actor variables can also be seen by all actors and used, but each actor has its own specific variable. A common use of actor variables would be HP. Each actor will have their own HP. Array is set to no, but can be switched. Before you use arrays, you should familiarize yourself with them. The basic idea is a set of similar variables, accesed by the variablename[x]. If you select array size to be 5, then this creates 5 variables with the same name, to access them, use [0]-[4]. The last section is Save group. Entering a name will allow you to save certain variables. Basically, enter a name, and this will allow you to save and load any variables within the save group. After choosing, click add.

[Global code]

Global code is a space where you can declare variables and functions. You should have a pretty good grasp of scripting to use this. The main use of this space is to declare functions that you can use in actor scripts. You must name the script and press add to save.

[File]

This allows you to load and save your scripts into .c files. If you prefer to use a different editor, you can save your existing code and edit it elsewhere. Then load it back in. This can be used to bypass the copy save glitch.

[OK]

When you click OK to add a script, it will prompt you for :

  • Immediate Action
  • Wait for frame(s)

You can specify a frame or mulitple frames of the current actor's animation for this script to be executed on; So you can force the actor to finish attacking before he is allowed to attack again. When you choose this option, the script may ONLY be executed on the frames you specify.


More documentation on script editor http://game-editor.com/docs/scripting.htm