8000 Getting Started · TriggerReactor/TriggerReactor Wiki · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content
gerzytet edited this page Oct 7, 2019 · 42 revisions

Getting Started

Overview

Trigger Reactor (TR) has two main components: Triggers and Scripts.

Triggers

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:

  1. Do the command /trg walk #MESSAGE "Hello!"
  2. Click on a block on the ground
  3. 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

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

Very Useful Tip:

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

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

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

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

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


Methods

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


How TR Interprets your Scripts

Script Syntax

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.

Read Order

Trigger Reactor will read your script from left to right, then top to bottom.

#MESSAGE "First"; #MESSAGE "Second"
#MESSAGE "Third"

Statement

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)

Data Types

There are three main data types in Trigger Reactor:

  • Numbers
  • Strings (Text)
  • Boolean Values (True/False)

Numbers

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 (Text)

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 output My name is Bob.
  • "I am " + 10 + " years old." will output I am 10 years old.

Boolean Values (True/False)

Boolean is value either be true or false. They are most often used in Conditions.

Comments

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:

Single-Line 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."

Multi-Line Comments

You can comment multiple scripts by using /* and */.

/*#MESSAGE "This script will not be run"
#MESSAGE "Nor will this one."*/

Plugin Description / 목차

1. Getting Started () (рус)

S.L. In-game Editor () (рус)

2. Triggers () (рус)

List and usage of Triggers / 트리거 목록과 사용 방법:

  • 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 조건

6. Variables () (рус)

  • Local Variables / 지역 변수
  • Global Variables / 전역 변수

Advanced

Timings () (рус)

7. Methods () (рус)

  • Using Methods / 메소드 사용법
  • Special Data Types / 특수한 데이터 형식
  • Reading Javadocs / Javadoc 읽기
  • Handling Enum / Enum 데이터 처리
  • Lambda Expresion / Lambda(람다) 식 사용법

8. Array () (рус)

  • Creating an empty array / 빈 배열 만들기
  • Storing data into array / 배열에 데이터값 저장하기
  • Read data from array / 배열에서 데이터 읽기(불러오기)

9. Loops () (рус)

  • WHILE loop / WHILE 반복문
  • FOR loop / FOR 반복문
    • Iterating Collection / Collection 형식의 변수 순회법
    • #BREAK executor / #BREAK 실행자
    • #CONTINUE executor / #CONTINUE 실행자

10. Sync Mode () (рус)

  • #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 예외처리 이해하기

Misc

16. Interface Casting () (рус)

module x.x does not "opens x.x" problem

  • List of Custom Events

Examples

Trigger

Trigger Example () (рус)

More Examples: Bukkit, Sponge

Case Specific

Clone this wiki locally
0