Skip to content

Holographic Displays

Ankoki edited this page Feb 9, 2022 · 12 revisions

SkJade has a section where you can create holographic displays with skript ^.^

First of all, we want to know how to create one, and it's fairly simple! Please note you would need to recreate every hologram on startup!

command /createholo <text> <text>:
    trigger:
        create a hologram at player's location with id arg-1
        add line arg-2 to the hologram with id arg-1
        send "You have created a hologram with the id %arg-1% :D"

Now, the ID of a hologram is how you will change it and manage events!
You can also add items to your holograms using

add glowing diamond to the hologram with id "iamdoechii is fire"

You can also edit lines of an existing hologram.

set the content of line 1 of hologram with id "nicki minaj" to "Hello!"

You can set the contents to an item if the line is originally an item, however you cannot change from a text to an item, or vice versa.

Events

There are two events which you can use, on hologram touch and on hologram click. The lines have to be made touchable and clickable.
In events, to get the hologram you must use event-hologram!

command /createclickableholo <text>:
    trigger:
        create a hologram at player's location with id "myHologram!"
        set {_holo} to the hologram with id "myHologram!"
        add line arg-1 to {_holo}
        make line 1 of {_holo} clickable
        send "You have created a clickable hologram with the id myHologram! :D"

on holo click:
    if event-hologram = hologram with id "myHologram!":
        send "Heres a diamond for clicking me!"
        add glowing diamond to event-hologram

You can also check what hologram has been clicked, but that's optional! Touching is exactly the same, however it gets fired very very fast, so I HIGHLY recommend adding cooldowns for anything utilising this feature!

command /createclickableholo <text> <text>:
    trigger:
        create a hologram at player's location with id "myHologram!"
        set {_holo} to the hologram with id "myHologram!"
        add line arg-1 to {_holo}
        make line 1 of {_holo} touchable
        send "You have created a touchable hologram with the id myHologram! :D"

on holo touch:
    if event-hologram = hologram with id "myHologram!":
        send "Heres a diamond for touching me!"
        add glowing diamond to event-hologram

Setting lines

As of the release of 1.3.1, you can now set the contents of a hologram line, its also very simple!

on skript load:
    create a new hologram at location(100, 100, 100, world("world")) with id "test"
    add "&7&oI've yet to be clicked..." to hologram with id "test"
    make line 1 of hologram with id "test" to be clickable

on holo click:
    if id of event-hologram = "test":
        set contents of event-line to "&e%player% &7clicked me last"

Please note if the hologram line is an item line (has an item on it), it can only be set to another item. The same goes for text lines.

Visibility

SkJade's holograms can be made visible to certain players, and to make this easier, you can make a hologram hidden by default!

create a hologram at player with id "nicki minaj is the queen of rap" to be hidden by default

This would make a hologram be invisible to everyone, then you can use

(show|hide) %holograms% (to|from) %players%

to control who sees the hologram!

Placeholders

You can make your own placeholders for holographic displays with SkJade!
Your function registered with the placeholder is called every second, so this is regularly updated!

on load:
    register a holographic placeholder "RANDOM-NUMBER" to run the function randomNumber()

command /createhologram <text>:
    trigger:
        create a hologram at player's location with id arg-1
        set {_holo} to the hologram with id arg-1
        add line "Hello! The placeholder is -> RANDOM-NUMBER!" to {_holo}
        send "You have created your hologram with a placeholder!"

function randomNumber() :: text:
	return "%random integer between 1 and 100%"

Your function HAS to return a text, or it will error! Also make sure to remember to register the placeholder BEFORE creating your hologram!
If there's anything that you want explaining better, make sure to tell me!