-
-
Notifications
You must be signed in to change notification settings - Fork 17
Getting Started
Trigger Reactor (TR) has two main components: Triggers and Scripts.
Triggers are events that you want TR to react to so it can run your scripts. For example, if we wanted TR to react to us walking over a set block we can create a walk trigger:
- Do the command
/trg walk #MESSAGE "Hello!"
- Click on a block on the ground
- Walk over it
If you did everything correctly, you should see Hello!
show up in chat.
Note: You can delete this trigger by using the bone tool, or by deleting it in the WalkTrigger folder.
There are many triggers already built into TR, but if you need to, you can use any event. Even those from third party plugins!
Here is a full list of triggers currently available: Triggers
Scripts tell TR what you want it to do. In the above example, you are using the #MESSAGE executor. This tells TR that you want to send the player a message in chat.
Scripts can contain:
- Executors
- Placeholders
- Conditions
- Variables
- Methods
- Arrays
- Loops
You can run a script without a trigger by using the command /trg run <script>
. This is useful for debugging purposing if you are experiencing errors, or if you want to see how certain variables/placeholders will be parsed.
For example:
/trg run #MESSAGE "My name is" + $playername
Run multiple scripts by using a semi-colon:
/trg run #MESSAGE "Spawning a creeper."; #SPAWN "CREEPER"
Executors are what makes things actually happen. You can set the time of day, or teleport players to a different location for example.
#MESSAGE
#SPAWN
Here is a full list of executors currently available: Executors
Placeholders are used to reference variables within your server. You can use them to get a players name for example.
$playername
A full list of placeholders is available here: Placeholders
Conditions allow you to trigger scripts only when certain criteria is met. For example, you can make it so a trigger can only happen during a specific time of day:
IF $time == 18000
#MESSAGE "It is midnight."
ENDIF
For more information on conditions: Conditions
Variables allow you to store data to be used in other triggers or scripts. For example, you can create a variable called points
and use it in your scripts.
points = 10
#MESSAGE "I have " + points + " points."
This would output I have 10 points.
For more information on variables: Variables
You can directly access all methods on spigot. With methods, there is almost no limitation with what you can do in your scripts. If there is an executor or placeholder you want but isn't listed, you can usually use methods to do what you want.
For more information on methods: Methods
Syntax is the language used by TR in order to run your scripts. If your syntax is incorrect, then you will get errors and your script will not work.
Trigger Reactor will read your script from left to right, then top to bottom.
#MESSAGE "First"; #MESSAGE "Second"
#MESSAGE "Third"
We call a form of instruction Statement. For example, in the code above, #MESSAGE "First"
is an instruction that will display First to the player when run. #MESSAGE "Second"
is another statement as well. Each statement will be executed in order, but the order can altered by control statements like the IF/ELSE statement. Otherwise, each statement run one by one, from left to right and top to bottom.
You can separate each statements by using a semi-colon, or by creating a new line. The above example has three different scripts that will run in the specified order. (First, Second, then Third)
There are three main data types in Trigger Reactor:
- Numbers
- Strings (Text)
- Boolean Values (True/False)
You can do almost any mathematical operation on numbers, using order of operations.
Operator | Usage | Example | Output |
---|---|---|---|
+ | Addition | 10 + 2 | 12 |
- | Subtraction | 10 - 2 | 8 |
* | Multiplication | 10 * 2 | 20 |
/ | Division | 10 / 2 | 5 |
% | Modulus | 11 % 2 | 1 |
() | Brackets | 10 * (3 - 2) | 10 |
Strings must always be surrounded by double quotes! If you do not put in double quotes, TR will treat as a Local Variable, or a number.
You can add strings and numbers together by using concatenation. Do this by using the + operator.
For example:
-
"My name is " + "Bob."
will outputMy name is Bob.
-
"I am " + 10 + " years old."
will outputI am 10 years old.
Boolean is value either be true or false. They are most often used in Conditions.
Comments are completely ignored by TR's compiler. So you can add notes to your scripts without throwing any errors. This is also useful for disabling scripts without having to delete them.
There are two types of comments:
You can comment out a single line by putting double slashes in front of it.
//#MESSAGE "This is a comment and will not be run."
You can comment multiple scripts by using /*
and */
.
/*#MESSAGE "This script will not be run"
#MESSAGE "Nor will this one."*/
Basic Syntax (한) (рус)
1. Getting Started (한) (рус)
S.L. In-game Editor (한) (рус)
List and usage of Triggers / 트리거 목록과 사용 방법:
- Click/Walk Trigger (한) (рус)
- Command Trigger (한) (рус)
- Area Trigger (한) (рус)
- Named Trigger (한) (рус)
- Custom Trigger (한) (рус)
- Inventory Trigger (한) (рус)
- Repeating Trigger (한) (рус)
- List of Executors / 실행자(Executor) 목록
4. Placeholders (한) (рус)
- Using PlaceholderAPI / PlaceholderAPI 사용법
- List of Placeholders / 플레이스 홀더(Placeholder) 목록
5. Conditions (한) (рус)
- Creating Conditions / 조건식 만들기
- Boolean Expressions / 부울 (Boolean) 표현 방법
- Logical Operators / 연산자 사용법
- IF statement / IF 조건문
- Null Checking / Null 검사법
- Switch Case / Switch Case 조건
- Local Variables / 지역 변수
- Global Variables / 전역 변수
S.L. Understanding Exceptions (한) (рус)
- Using Methods / 메소드 사용법
- Special Data Types / 특수한 데이터 형식
- Reading Javadocs / Javadoc 읽기
- Handling Enum / Enum 데이터 처리
- Lambda Expresion / Lambda(람다) 식 사용법
- Creating an empty array / 빈 배열 만들기
- Storing data into array / 배열에 데이터값 저장하기
- Read data from array / 배열에서 데이터 읽기(불러오기)
- WHILE loop / WHILE 반복문
- FOR loop / FOR 반복문
- Iterating Collection / Collection 형식의 변수 순회법
- #BREAK executor / #BREAK 실행자
- #CONTINUE executor / #CONTINUE 실행자
- #CANCELEVENT executor / #CANCELEVENT 실행자
- Setting Sync/Async Mode / 동기, 비동기 모드 전환
- Custom Trigger
- Area Trigger
11. Custom Executors (한) (рус)
12. Plugin Access (한) (рус)
- Check And Use / 플러그인 존재여부 확인
- Get Third Party Plugin / 제 3자 플러그인 불러오기
- Check Eligibility / 호환성 확인하기
- Use the Plugin / 플러그인 사용하기
13. IMPORT Statement (한) (рус)
- Creating new instance / 새 인스턴스 생성하기
- Accessing static method / 종속 메소드 불러오기
- Accessing static field / 종속 Enum 불러오기
14. IS Statement (한) (рус)
- Understanding / 이해하기
- Understanding Instance / 인스턴스 이해하기
- Understanding Superclass / 부모클래스 이해하기
- Understanding Subclass / 자식클래스 이해하기
- Using IS Statement / IS조건연산자 사용하기
15. TRY-CATCH Statement (한) (рус)
- Understanding TRY-CATCH Exception Handling / TRY-CATCH 예외처리 이해하기
16. Interface Casting (한) (ру 57AE )
module x.x does not "opens x.x" problem
- List of Custom Events