Scripts, Script Files, and the Script Editor
What Are Scripts?
A script is a line of data that corresponds to a certain action. This allows you to customize your experience with text boxes, bosses, teleporting, etc., further livening up your map-pack. A script looks something like this:
{5,0,864,48,48,48,[1/48/48]}
or {scriptID, mapID, x, y, w, h, extraData}
scriptID
designates what action should be taken when the script is triggered. mapID, x, y, w, h
designate in what map, at what (x,y) coordinate, and within an area (w,h) wide, is the script triggered. extraData
is essentially the arguments passed to execution when the script is run.
In the example, a script type 5, or gateway script, is run when the player gets within (48,48) of (864,48) on map 0. If they do, they are teleported to map 1, with an x/y of (48,48).
What Is A Script File?
A script file is the file that holds all of your scripts. Each script only uses one line (or two in the case of a boss). These scripts are bundled together for your map-pack in the script file. Note that only one script per line will be read. If you have two joined next to each other, they won't be read, and could perhaps cause errors with your scripts running.
How Do I Make Scripts?
To create a script, pick the Script Editor option in the Tools menu. Select which type of action you would like to program and hit start. Maneuver the cursor using Up/Down/Left/Right (default WASD), and place the X,Y coordinate of your script using Interact (default Space).
Then, you must set the width and height of your script. To change the amount your w/h increment and decrement by from a 1/8 of a tile to a full tile, press Attack (default Left Shift). To switch back, press it again. This option is especially useful for defining the size of a boss.
Press Interact again to place your width and height. Depending on what script you chose, you'll have to input extra data. After that, it'll append your script to your script file. If you loaded a script instead of creating a new one, remember to remove the old script from your file. If the second number, the mapID
, is -1, change that number to the map ID of the map it's occuring on. The map ID is equal to the line number of the map - 1.
If you require any more help, go to the Script Editor menu, select the option you need to check, then select Help.
What Are All The Script Types And What Do They Do?
- script_none - Default, do nothing. No real use.
- script_trigger_dialogue - If player steps in coords & presses Interact, triggers a dialogue/text box.
- script_force_dialogue - Forces a dialogue (no pressing Interact required)
- script_force_dialogue_once - Same as above, but just once.
- script_trigger_boss - If player steps in coords, spawn the map's boss. This should only be placed in the same map as the boss.
- script_switch_maps - Triggers a switching of rooms. Map borders do this by default so only use this when you are using some sort of other warp tile. Like a silent use_gateway.
- script_use_gateway - Triggers a playing of an animation followed by a switching of rooms, to a certain location in the next map. Only activated when on top of a gateway.
- script_use_teleporter - Teleports to a location in the same map. Also only activated when on top of a teleporter.
- script_toggle_door - If player steps in coords, open/close doors or flip their state.
- script_animation - If player steps in coords, do an animation involving dialogue boxes and sprites moving. Only activates once.
- script_boss_actions - If boss is still alive, execute boss movement actions. This also holds boss HP and tile data, as well as coords and size.
- script_gain_money - Gives player some money. Please don't abuse this, for obvious reasons.
extraData
can't be more than 20 or less than 1.
- script_player_hurt - Hurts the player by
extraData
amount when inside. Make extraData
negative to create a healing field instead.
- script_placeholder - TBD