Event Types

## chat

Will display whatever is after it in chat. Formatting is available using the ampersand symbol (&) rather than the section sign (§). To place a value of a string in chat, use "{string<sn>}"

**Example:**

```
  chat &1Hello! &2This &3Is &4An &5Example.

```

This is one of the core abilities of the mod. Using this chat type, you can modify the way messages appear in your chat. Do note though that messages sent via this event type are completely client side, meaning that you are the only person that can see them. Strings are very valuable used in this way

## cancel

Used to prevent certain messages from sending. It has no parameters, and will cancel the message that activated the trigger it is in.

**Example:**

```
trigger chat(<c>Hello!) {
  cancel
}

```

This will prevent any message containing the phrase "Hello!" from appearing in your chat.

## killfeed

Will display whatever is after it in the killfeed (default top left).

**Example:**

```
 killfeed You Killed &aKerbybit!

```

The positioning of the killfeed can be modified by pressing the K key.

## notify

Similar to the killfeed event type, however it has a slightly different animation. The default location for notifications is the bottom right.

## sound

Plays minecraft sounds. Accepts valid sound references, including those in custom resource packs, as well as <vol=#> and <pitch=#> tags.

**Example:**

```
  sound <vol=50><pitch=1>random.orb

```

<vol=#> must be an integer number between 0 and 100.

<pitch=#> must be 0, 1, or 2.

## trigger

Activates a trigger with type "other" and the given name.

**Example:**

```
  trigger MenuSlideOne

```

## copy

Copies whatever text is after it into the users computer clipboard, in the same way that pressing Control + C does.

## url

Opens the specified webpage. This event respects the vanilla client setting "Prompt on Links".

**Example:**

```
  url google.com

```

do
--

As implied, it is used to *do* things within a trigger. This is primarily used to modify strings using built in (and custom) string functions. You can do multiple actions in the same *do* event.

**Example:**

```
  do {string<sn>}.set(123)  {string<sn>}.add(1).set(~)

```

When using the do event, if the character following the "do " is an open curly bracket, it is possible to omit the actual word "do". This means that if you are modifying the value of a string, you can omit the "do".

**Example:**

```
trigger other(StringChange) {
  {string<str>}.set(123)
}

```

if
--

**NOTE: CONDITIONAL LOGIC IS DUE FOR A REVAMP. INFORMATION MAY CHANGE.**

One of the logic events. This is the most basic logic event. It tests whether a certain condition is true, and if it is, it runs specified code.

**Example:**

```
  do {string<str>}.set(hello)
  if ({string<str>} == hello)
    do //stuff
  end

```

Because {string<str>} is indeed equals to *hello*, the condition *{string<str>} == hello* returns true. Because the statement is true, the if statement will go ahead and run the specific code (which, in this example, is *do //stuff*).

Note: When comparing string that have text values in them, do **not** surround the text with quotes. If you surround the text with quotes, the if statement will search for those quotes inside the string (and likely return false every time).

If the string itself is set to *true* or *false*, no logic functions are necessary.

**Example:**

```
  do {string<str>}.set(true)
  if {string<str>}
    do //stuff
  end

```

This will run the specified code because the value of *{string<str>}* is true.

 If statements can also have multiple conditions. If you are testing whether both conditions are true, use *&&*. If you are testing whether either condition is true, use ||. If you are testing whether only one of the conditions is true, use *^^*.

**Example:**

```
  do {string<sn>}.set (true) {string<sn2>}.set(false)
  if ({string<sn>} && {string<sn2>})
    chat Both True!
  elseif ({string<sn>} || {string<sn2>})
    chat One True!
  end

```

This series of events will return *One True!* because only one of the strings is set to true.

 If statements can also test if a condition is not true.

**Example:**

```
  do {string<sn>}.set(false)
  if (!{string<sn>})
    chat False!
  end

```

This series of events will return *False!* because the string was not set to true.

If statements can utilize complex parenthesis grouping, as well as many different types of operators and string functions.

**Example:**

```
  {string<sn>}.set(true) {string<sn2>}.set(false) {string<sn3>}.set(5) {string<sn4>}.set(6)
  if (({string<sn>} && !{string<sn2>}) && !({string<sn3>} < {string<sn4>}))
    chat Success!
  end

```

This series of events will return *Success!. ({string<sn>} && !{string<sn2>})* is first evaluated to be true. Next, *!({string<sn3>} < {string<sn4>})* is evaluated to be true. Finally, *true && true* returns *true*.

## else/elseif

One of the logic events. elseif is used to test additional conditions if the initial ifstatement was false. else is the default for the if statement if no other conditions are true.

**Example:**

```
  do {string<str>}.set(hello)
  if ({string<str>} == Hi)
    chat 1
  elseif ({string<str>} == hello)
    chat 2
  else
    chat All conditions are false :(
  end

```

In this case, the trigger will output *2*.

## for

One of the logic events. Best explained with an example first.

**Example:**

```
  for $value from 1 to 10
    chat $value
  end

```

This series of events will output the numbers 1 through 10 in the user's chat.

*$value* can be any text, but it must begin with a dollar sign ($). Once you have defined it, you can use it in the inner code of the for loop. In this series of events, we have used it to output the number.

The second two parameters are the numbers to run through. The spacing is set to 1 (meaning that it will count from 1 to 2 to 3, etc, rather than, say, 1 to 3 to 5). Every time the for loop runs again, *$value* is set to the iteration (number) that it is on. On the fifth iteration of this for loop, for example, *$value* will equal 5, and the event will output *5* into the user's chat.

This event has more features, however, and is especially useful when working with lists.

**Example:**

Say we have a list {list<li>} with the following values: a, b, c, 3, 8.

```
  for $value in li
    chat $value
  end

```

This series of events will output all of the values of the array in order into the user's chat (a, b, c, 3, 8). When a list is used in a for loop, the for loop goes through every index (value) of the list in order, and assigns it's value to *$value*. This can of course be used inside the loop to perform actions based on the contents of the array

This form can also be written as *for $value : li*

Additionally, you can add an optional delay between the iterations of the for loop by adding a wait event

```
  for $value from 1 to 10 wait 20
    chat $value
  end

```

This for loop will output the numbers 1 through 10 into the user's chat, but will wait one second in between iterations. Wait time is in client ticks (20 client ticks = 1 second)

## wait

One of the logic events. Waits a specified amount of time before executing code. Time is in client ticks (20 client ticks = 1 second).

**Example:**

```
  wait 60
    chat Hello!
  end

```

This series of events will output the text *Hello!* into the user's chat after three seconds of time have elapsed.

## choose

One of the logic events.

**TODO: Example of syntax**

## async

One of the logic events.

**TODO: Get kerby to word this description cause I have no idea what this event *actually does*.**

## end

Closes out all of the logic events. Every logic event must be closed out with an *end* event. See above event types for examples of how to properly use *end*.

## return

Used in function trigger types. Details on this type's usage are listed in the linked trigger types page.

## debug

Functions exactly like *do*, except that it will output what it is doing to the user's chat if debug mode**TODO: Redirect** is enabled.

## log

Outputs text to the Minecraft logs/launcher.

## simulate

**NOTE: BROKEN AS OF THE 4.1.7\_BETA BUILDS**

As the name would imply, it simulates text going through the mod. Extremely useful if you are testing triggers that require certain chat messages to activate them. Can also be used as a command: */t simulate <text>*