docs/Getting Started

Getting Started With VariableTriggers

VariableTriggers is a plugin for the CraftBukkit Server. With it you can create Triggers that respond to in game events and actions by adding one or more lines of text to a trigger. These lines of text are called script lines and are run when the trigger they are attached to is activated. For instance if we had a walk trigger set on a certain block, then when a player walks over that block the trigger is activated and all the script lines attached to the trigger are exicuted(run).

Installing

Lets start off by talking about installing VariableTriggers on your server.

CraftBukkit has a folder called /plugins/ All you need to do is copy the VariableTriggers.jar file to this folder and start your server. Everything else is done automatically for you. The config.yml file can be found in a folder call /plugins/VariableTrigger/ and in this file you can change some of the functionality. Also you should open your permissins file with whatever permissions plugin you use and give yourself the vtrigger.admin permission node.

Hooking Vault

Vault is an optional dependency. Read more.

Before we cover some of the basics, lets first go over the main points and familiarize ourselves with them.

Permissions

By default op's have all vtrigger permissions and everyone else only has player permissions. See Permissions to read more about them.

What Are Triggers

Triggers are the heart if this plugin. See Triggers to read about them.

In-Game Commands

These are the prompt commands that you type in. To create a Walk Trigger you would type /vtwalk along with a line of script. The complete list can be found here.

Script Commands

These are the one line commands you add to a trigger. Read more about them here.

Place Holders

Place holders are simply a way to place data values from the game in your script command. Read more about Place Holders.

Functional Place Holders

These are similar to Place Holders except they are replaced with the in game data at the moment they are interpeted, and some take arguments.Read more about Functional Place Holders.

Dynamic Object Variables

Undoubtedly the most powerful part of this plugin. You can create your own Object Variables at any time in the game and name them anything you want to. Read more about Dynamic Object Variables.

Scripts

Scripts are made up of one or more script commands. Read more about scripts.


Making Your First Trigger

Once you have familiarize yourself with the topics above we can show you how to create some triggers and then expand on that.

You will need the Wand(bone) for this.

In the game lets type the following in the comand prompt.
/vtclick @PLAYER Hello <playername> you are in <worldname>.
Hit Enter. You will be asked to right click a block with the wand(bone) to set or add to a trigger. Click a block, you should be told Trigger Created. Now click the block and a message is displayed to only the player that clicked the block. The place holders <playername> and <worldname> will be automatically replaced with the player's name and the world name.

Now type the followin and hit Enter.
/vtclick @POOF 3
You will be asked to Click a block to set the location, click the same block as before. You will see Location Set and be asked to click a block to set or add to a trigger. Click the same block again. We just added a second script line to the trigger. Now click it again and you will se the message but you will also see a poof of smoke from the trigger.

The 3 in @POOF 3 is the volume of smoke.

You can keep using /vtclick and add line after line to the trigger, but once you get the hang of it you will probably want to start writing some of your scripts first and save them in a separete file. Then you can @CALL the script from a trigger or from another script.

To view the script on a trigger you type /vtclickview or /vtwalkview you will be asked to click on a trigger to view it. For an Event trigger you type /vteventview PlayerDeath


Lets make an event trigger.

Type the following lines and hit enter after each.

/vtevent Join @ADDINT $<playername>.joincount 1
/vtevent Join @IF i $<playername>.joincount = 1
/vtevent Join @BROADCAST Welcome <playername> This is the first time we have seen you. Have a sword.
/vtevent Join @DROPITEM Iron_Sword 1 FireAspect:2 <playerloc>
/vtevent Join @ELSE
/vtevent Join @BROADCAST Welcome <playername>, you have joined $<playername>.joincount times
/vtevent join @ENDIF

You have just created your first Event Trigger. This is the Join event and whenever a player joins the server it will run whatever lines of script you have on it. To remove the Event trigger type /vteventremove Join


Using Area Triggers

Area triggers are very useful and can be used in many ways. Lets go over the proccess of defining an area and setting its triggers.

First we must define an area by seting two locations to define a cube. We do this by using the /vt setarea command. This will let you use the wand(bone) to Left click for position 1 Right click for possition 2

Once we have set the two positions we type /vt definearea MyFirstArea
We have just defined an area named MyFirstArea. You may only use a name once per world for an area.

Now type /vtarea MyFirstArea Enter @PLAYER Welcome to <areaentered> <playername>
We have just created our first Enter area trigger, lets add another script line to this trigger.
Type /vtarea MyFirstArea Enter @LIGHTNING false <playerloc>

OK lets creat an Exit trigger on this area. Type /vtarea MyFirstArea Exit @PLAYER Now leaving <areaexited>

You now have an area with an enter and exit trigger. you may add as many lines of script as you want.

More to come when I write it.