Skip to main content

Indie game storeFree gamesFun gamesHorror games
Game developmentAssetsComics
SalesBundles
Jobs
Tags

- COMPLETE SCRIPTING GUIDE - Sticky

A topic by JoBot164 created May 16, 2022 Views: 128
Viewing posts 1 to 1
Developer

When you want to add interactivity beyond dragging to your games, you must add scripts to blocks. Here is a small reference to help you with your new adventure in scripting.

The scripting format in Plastix uses lines of code formatted like this:

condition;action;parameter

If you wanted to make a cube that levitates with a factor of 2, you would write:

always;levitate;2

Here is a list of available conditions.

always - The action is always executed.

pressi - The action is run while \"I\" is held on the keyboard.

pressj - The action is run while \"J\" is held on the keyboard.

pressk - The action is run while \"K\" is held on the keyboard.

pressl - The action is run while \"L\" is held on the keyboard.

pressspace - The action is run while the spacebar is held.

notpressi - The action is run while \"I\" is NOT held on the keyboard.

notpressj - The action is run while \"J\" is NOT held on the keyboard.

notpressk - The action is run while \"K\" is NOT held on the keyboard.

notpressl - The action is run while \"L\" is NOT held on the keyboard.

notpressspace - The action is run while the spacebar is NOT held.

onhit - The action is run when the block touches something.

onhitblock - The action is run when the block touches another block.

onhitground - The action is run when the block touches the ground.

nothit - The action is run while the block isn't touching anything.

nothitblock - The action is run while the block isn't touching another block.

nothitground - The action is run while the block isn't touching the ground.

isbroken - The action is run when the block isn't attached.

notbroken - The action is run while the block is attached.

ontap - The action is run when the block is clicked.

ontouch - The action is run while the block is clicked.

nottouch - The action is run while the block isn't clicked.

Now here is a list of available actions:

levitate - The block will rise into the air.

fall - The block will be pushed downward.

thrust - Similar to levitate, but directional.

clockwise - The block rotates clockwise.

counterclockwise - The block rotates counterclockwise.

upright - The block is forced to stay upright.

jump - The block bounces from whatever it is touching

forward - The block moves forward.

backward - The block moves backward.

left - The block moves left.

right - The block moves right.

break - Breaks apart the model that the block is a part of.

hide - Makes the block invisible.

show - Makes the block visible.

freeze - Makes the block immobile.

unfreeze - Makes the block mobile.

honk - Makes the block honk like a horn.

beep - Makes the block beep.

wait - Pauses execution of the script for X seconds.

stop - The script stops execution.

camera - The camera will be put X units above the block.

Blocks that appear orange in the toybox have special actions all to themselves. For example, the wheel has:

drive - Drives the wheel forward via rotation.

reverse - Drives the wheel backward via rotation.

You can also set the color of the block using these keywords:

red, green, yellow, blue, purple, orange, white, grey, black, brown, tan, peach, glass, gold, and silver

Here's a simple script you can try out now:

always;levitate;10

always;clockwise;2

What this script does is it'll make the block float upward and spin, like a helicopter blade.

Always remember: Scripts are case sensitive and need to be in lowercase. Not all actions support parameters.

Have a fun time scripting!