Clickable sign?

  • Welcome to skUnity!

    Welcome to skUnity! This is a forum where members of the Skript community can communicate and interact. Skript Resource Creators can post their Resources for all to see and use.

    If you haven't done so already, feel free to join our official Discord server to expand your level of interaction with the comminuty!

    Now, what are you waiting for? Join the community now!

  • LOOKING FOR A VERSION OF SKRIPT?

    You can always check out skUnity Downloads for downloads and any other information about Skript!

Solvey

Member
Nov 6, 2020
4
1
1
50
Hello, i am coding with skript since 1.12. After 3 years i started to code again with skript for fun, but since mojang added sign edit (This means when you place a sign type some text and add it to the sign, you are able to edit it again if you click on it) i can't make clickable signs

Normally i would do

code_language.skript:
on right click on sign:
    if line 2 of event-block is "test":
        message "You clicked" to player

The code above did i use when i played 1.12 and back then it worked

I tried it again but now it looks minecraft overwrites this event or something?

i also tried this code below in skript 2.10.0 and in minecraft 1.21


Code:
on right click on oak sign:
    if line 2 of event-block is "test":
        cancel event
        message "You clicked" to player

i tried canceling the event for opening the sign, but that doesn't work
I also said (on right click on oak sign) because mojang added multiple signs of different wood.

I don't get errors or anything so i don't know why it wouldn't work?

I hope someone have a answer.

Thanks
 

options:
prefix: &8[&6Signs&8]

# Handle sign clicks
on right click:
if "%event-block%" contains "SIGN":
set {_line2} to line 2 of event-block
if {_line2} contains "test":
cancel event
send "{@prefix} &cYou cannot interact with a test sign!" to player

# Allow setting test initially, but prevent editing after
on sign change:
wait 1 tick
if line 2 of event-block contains "test":
set {_loc} to location of event-block
set {signs::locked::%{_loc}%} to true
send "{@prefix} &aThis sign is now locked!" to player

# Prevent editing of locked signs
on sign edit:
set {_loc} to location of event-block
if {signs::locked::%{_loc}%} is true:
cancel event
send "{@prefix} &cYou cannot edit a locked sign!" to player

# Dont allow text clearing
on sign change:
set {_loc} to location of event-block
if {signs::locked::%{_loc}%} is true:
cancel event
send "{@prefix} &cYou cannot edit a locked sign!" to player



Here you go, I played around for a bit, and now it works. I didnt really understand your "test" line feature, but I tried something. When you click a sign with "test" on line 2 it wont allow you to edit it. Hope this helps!
 

options:
prefix: &8[&6Signs&8]

# Handle sign clicks
on right click:
if "%event-block%" contains "SIGN":
set {_line2} to line 2 of event-block
if {_line2} contains "test":
cancel event
send "{@prefix} &cYou cannot interact with a test sign!" to player

# Allow setting test initially, but prevent editing after
on sign change:
wait 1 tick
if line 2 of event-block contains "test":
set {_loc} to location of event-block
set {signs::locked::%{_loc}%} to true
send "{@prefix} &aThis sign is now locked!" to player

# Prevent editing of locked signs
on sign edit:
set {_loc} to location of event-block
if {signs::locked::%{_loc}%} is true:
cancel event
send "{@prefix} &cYou cannot edit a locked sign!" to player

# Dont allow text clearing
on sign change:
set {_loc} to location of event-block
if {signs::locked::%{_loc}%} is true:
cancel event
send "{@prefix} &cYou cannot edit a locked sign!" to player



Here you go, I played around for a bit, and now it works. I didnt really understand your "test" line feature, but I tried something. When you click a sign with "test" on line 2 it wont allow you to edit it. Hope this helps!
Thanks! What i meant with line 2 "test" is if you have a sign with the text "test" on line 2. It will message something to a player
 
  • Like
Reactions: Kingcreeper4807