MakeYourOwnBlocks

Scripts

How to script

Syntax

NOTE: To modify the specific script for an item, modify the config.yml file in the plugin's folder. Please see configuration for information on how to do that.

Cmd

Syntax: cmd COMMAND_NAME arg1 arg2 ect...

Example: /tp playername <x> 1000 <z>

Executes the command as the CONSOLE.

Setdmg

Syntax: setdmg DAMAGE_VALUE

Example: setdmg 20

Sets the damage of the item that caused the script to execute

Item Scripts Only!

Dmgminus

Syntax: dmgminus DAMAGE_TO_CAUSE_THE_ITEM_TO_HAVE

Example: setdmg 10

Actually, this item damages the item more by the amount given

Item Scripts Only!

Setblock

Syntax: setblock X Y Z BLOCK_ID [BLOCK_DATA]

Example: setblock <x> <y> <z> 1

Sets the block at the x, y, and z

Say

Syntax: say MESSAGE_TO_TELL_PLAYER

Example: say Thank you for right clicking the item!

Says the message to the player

Kill

Syntax: kill

Example: kill

Kills the player holding the item that executed the script

Hurt

Syntax: hurt <HALF_HEARTS_TO_TAKE_AWAY>

Example: hurt 5

Hurts the player the amount of half hearts given. May or may not work with negative numbers.

Cancel Event

Syntax: cancelevent

Example: cancelevent

Cancels the placing or destroying of the block.

Item Amount Manipulation

Minus

Syntax: itemstackminus <amount>

Example: itemstackminus 1

Removes the amount of items from the itemstack

Add

Syntax: itemstackadd <amount>

Example: itemstackadd 1

Adds amount items to the itemstack.

Set

Syntax: itemstackset <amount>

Example: itemstackset 0

Sets the amount of items in the item stack.

Values Given

These are markers that are replaced for certain values when the script is executed.

<x>

Replaced with the player who used the item which executes the script's X coordinate.

<y>

Replaced with the player who used the item which executes the script's Y coordinate.

<z>

Replaced with the player who used the item which executes the script's Z coordinate.

<player>

Replaced with the player who used the item which executes the script's username.

<isop>

Indev, 1 if the person triggering the event is a op

<true>

Simplifies to 1

<false>

Simplifies to 0

<block>

Replaced by 1 if a block was clicked, 0 if the air was clicked.

Item Scripts Only!

<right>

Replaced by 1 if the item was right clicked, 0 if it was left clicked. DEPRECATED, no longer needed.

Item Scripts Only!

<amount>

Replaced by the amount of items in the item stack

Item Scripts Only!

Evaluating Expressions

Ok, this is a work in progress. If you need expressions evaluated anywhere that isn't in a if statement, try using this method:

say !CMDIT:<block>+<right>=2:!

That would say "1".

NEW!!!! THE "if" STATEMENT!!!!

OK, so if you're a programmer like me, you know no language should be without a "if" statement. I have finally fixed evaluating expressions (see evaluating expressions) so I am now able to implement an "if" statement. It works as follows:

if 1=1 say This code is executed right here!

Or, more likely...

if <block>=1&&<right>=1 say WOW! GOOD JOB!

Programming References

Ok, just FYI, these are some things in the script language that are constant in normal programming languages, but you may not know.

1. When a if statement executes, the value must be 1.

2. When you time 1=1, that simplifies into 1. In programming, 1 equals true, 0 equals false.

You must login to post a comment. Don't have an account? Register to get one!

Facts

Date created
Jan 23, 2013
Last updated
Jun 14, 2013

Author