# Custom GUI

Since 2.1.0 version, it's possible to use `FrameOpenEvent` and `FrameTag`.\
To change the GUI we will cancel the event passively and then call our own inventory.

One of the way of using `FrameOpenEvent` is call `frame` from the event declaration:

```yaml
my_gui:
    type: world
    events:
        on frame clanlist open:
        - determine passively cancelled
        - inventory open d:my_inventory_script
```

List of all available frames is [here](https://ci.roinujnosde.me/job/SimpleClans/Javadoc/net/sacredlabyrinth/phaed/simpleclans/ui/frames/package-summary.html).

Another idea is get a class name by [JavaReflectedObjectTag](https://meta.denizenscript.com/Docs/ObjectTypes/JavaReflectedObjectTag#javareflectedobjecttag):&#x20;

```yaml
my_gui:
    type: world
    events:
        on frame open:
        - define frame <context.frame.reflected_internal_object.simple_class_name>
        - if <[frame]> == "MainFrame":
            - determine passively cancelled
            - inventory open d:my_inventory_script
```

You have the right to choose the method that you like best.

#### Example

<details>

<summary>MyGUI.dsc</summary>

```yaml
my_gui:
    type: world
    events:
        on frame open:
            - define frame <context.frame.reflected_internal_object.simple_class_name>
            - if <[frame]> == "MainFrame":
                - determine passively cancelled
                - inventory open d:my_inventory_script

my_inventory_gui_world:
    type: world
    events:
        after player clicks big_button_item in my_inventory_script:
        - narrate "<&[base]>Wow! You pressed the button!"
        after player clicks my_inv_gui_cancel_item in my_inventory_script:
        - inventory close

my_inventory_script:
    type: inventory
    inventory: chest
    title: <&9><bold>My Inventory GUI Sample
    gui: true
    slots:
    - [] [] [] [] [] [] [] [] []
    - [] [] [] [] [big_button_item] [] [] [] []
    - [] [] [] [] [] [] [] [] [my_inv_gui_cancel_item]

big_button_item:
    type: item
    material: beacon
    display name: <&2>Clan info
    lore:
    - <&7>Clan: <&c><player.clan.color_tag>
    - <&7>Your Rank: <clanplayer[player.uuid].rank_display_name>

my_inv_gui_cancel_item:
    type: item
    material: barrier
    display name: <&c>Cancel
    lore:
    - <&7>Click here to not press the button.
```

</details>

{% hint style="info" %}
You can read denizen guide about creation GUI [here](https://guide.denizenscript.com/guides/put-it-together/inventory-guis.html).
{% endhint %}


---

# 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://wiki.roinujnosde.me/scdenizenbridge/examples/custom-gui.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.
