# Cross-platform Actions

<details>

<summary>Delay</summary>

*Execute action after a delay*

```yaml
action:
    +: TJAction
    delay_1:
        message: "wtf" # This message will be sent after 10 seconds
        delay: "10s"
```

</details>

<details>

<summary>Group</summary>

*Group multiple actions together. Recommended to use with other actions.*

```yaml
action:
    +: TJAction
    random_1:
        message_1: "&cYou didn’t win :("
        group_1:
            message_1: "&aCongratulations! You got &bDiamonds &fx10&a!"
            console_1: "give %player_name% diamond 10"
```

</details>

<details>

<summary>Loop</summary>

*Repeating fun?*

```yaml
action:
    +: TJAction
    loop_1:
        time: "3" # This parameter accepts expressions, so '' is required.
        message: "&eI will run three times."
```

</details>

<details>

<summary>Random</summary>

*Pick N from multiple?*

```yaml
action:
    +: TJAction
    random_1:
        amount: 1 # (Number of selected results, optional)
        message_1: "&aI am number one."
        message_2: "&eI am number two."
        message_3: "&cI am number three."
```

</details>

<details>

<summary>Set</summary>

*Set a variable to the result of an expression (see If section).*

**Variables only exist in memory and will be lost after reboot.**

```yaml
action:
    +: TJAction
    set_1:
        id: "hello"
        expr: "%player_y% > 63"
        keep: false # Set only if not already exists (optional)
    if_1:
        expr: "{hello}" # Use "{var_name}" to access custom variable
        y:
            message: "&bYou are above sea level!"
        n:
            message: "&cYou are below sea level!"
```

</details>

<details>

<summary>Broadcast</summary>

*Delegate the action to all players*

```yaml
action:
    +: TJAction
    broadcast:
        message: "Now, everyone knows I’m noisy ><"
```

</details>

<details>

<summary>AsConsole</summary>

*Delegate the action to the console*

```yaml
action:
    +: TJAction
    asconsole:
        message: "Did the console see me??"
```

</details>

<details>

<summary>Function</summary>

*Execute a plugin-registered function*

```yaml
action:
    +: TJAction
    function: "input"
```

</details>

## Conditional Actions

<details>

<summary>HasPerm</summary>

*Checks if the player has permission*

```yaml
action:
    +: TJAction
    if_1:
        condition:
            hasperm_1: "hello.world"
        n:
            message: "&cYou don’t have hello.world permission"
        y:
            message: "Hello World!"
```

</details>

<details>

<summary>And</summary>

*Logical AND*

```yaml
action:
    +: TJAction
    if_1:
        condition:
            and_1:
                hasperm_1: "hello.world"
                hasperm_2: "goodbye.world"
        y:
            message: "Hello World!"
            message_1: "Goodbye World!"
        n:
            message: "&cYou don’t have hello.world + goodbye.world permissions"
```

</details>

<details>

<summary>Or</summary>

*Logical OR*

```yaml
action:
    +: TJAction
    if_1:
        condition:
            or_1:
                hasperm_1: "hello.world"
                hasperm_2: "hello_world"
        y:
            message: "Hello World!"
        n:
            message: "&cYou don’t have hello.world or hello_world permission"
```

</details>

<details>

<summary>Check</summary>

*Multiple conditions check*

```yaml
action:
    +: TJAction
    check:
        conditions:
            - condition: 3 > 1
              success: "Yay, 3 > 1"
              fail: "&cThis shouldn’t happen@@?"
            - condition:
                  not: "%player_health% > 10"
              fail: "Your HP is too high..."
        success: # All checks passed
            message: "&aOk"
            console: "give %this% golden_apple"
        fail: # Any check fails (optional)
            message: "&cFail"
```

</details>

<details>

<summary>If</summary>

*If?*

```yaml
action:
    +: TJAction
    if_1:
        condition:
            hasperm_1: "hello.world"
        n:
            message: "&cYou don’t have hello.world permission"
        y:
            message: "Hello World!"
```

```yaml
action:
    +: TJAction
    if_1:
        expr: "%player_y% > 63 and %player_level% >= 10" # Simple expression
        y:
            message: "&bYou are above sea level and level 10!"
        n:
            message: "&cYou're below sea level or not level 10 yet!"
```

</details>

<details>

<summary>Not</summary>

*Logical NOT*

```yaml
action:
    +: TJAction
    if_1:
        condition:
            not_1:
                hasperm_2: "hello_world"
        n:
            message: "Hello World!"
        y:
            message: "&cYou don’t have hello_world permission"
```

</details>


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.tjservice.org/readme/settings/tjaction/tong-yong-dong-zuo.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
