Simple Code help

  • 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!

Villo

New Member
Oct 3, 2023
6
0
1
20
Hi! I was trying to make a code that shows the region's name the player is in.
It is harder that it looks because I could just use %worldguard_region_name_capitalized% in the Scoreboard (because I want it to be shown in the Scoreboard) but it doesn't show anything when you are in the Wilderness, so if you are in a no-named region as Wilderness is it should display "Agresiva".
I tried with this code, but it just permanently shows "Agresiva", even when I am in a named region.

Code:
on join:
    set {placeholder} to placeholder "worldguard_region_name_capitalized"
on placeholderapi placeholder request for the prefix "locate":
    if the identifier is "zone":
    set result to {placeholder}
    if placeholder {placeholder} is empty:
    set result to "&4Agresiva"

Thank you! I look forward to your answers
 
what line on the scoreboard do you want it to show on? and are you using skbee?
I wanted to create a Placeholder with the skript, afterwards I would use it in the TAB plugin, where I can edit the scoreboard, and the line with the PlaceHolder is going to be updated because of it.
 
So many errors and issues, first of all, {placeholder} is a public variable, meaning it doesn't belong to a player, instead try using something like {placeholder::%player%} but i don't think you'd need a variable for that anyways, your indentation is god damn horrible. Try this:


on placeholderapi placeholder request for the prefix "locate":
if the identifier is "zone":
if size of regions at player is higher than 0:
set the result to placeholder "worldguard_region_name_capitalized" from player
else:
set result to "&4Agresiva"

If there's a indentation error, fix it, i wrote this from my phone and cannot see if there's any.
 
So many errors and issues, first of all, {placeholder} is a public variable, meaning it doesn't belong to a player, instead try using something like {placeholder::%player%} but i don't think you'd need a variable for that anyways, your indentation is god damn horrible. Try this:


on placeholderapi placeholder request for the prefix "locate":
if the identifier is "zone":
if size of regions at player is higher than 0:
set the result to placeholder "worldguard_region_name_capitalized" from player
else:
set result to "&4Agresiva"

If there's a indentation error, fix it, i wrote this from my phone and cannot see if there's any.
Thank you really much! It works. And yes, my code and indendation is quite horrible, i'm way too begginer at this. Thank you again.
 
So many errors and issues, first of all, {placeholder} is a public variable, meaning it doesn't belong to a player, instead try using something like {placeholder::%player%} but i don't think you'd need a variable for that anyways, your indentation is god damn horrible. Try this:


on placeholderapi placeholder request for the prefix "locate":
if the identifier is "zone":
if size of regions at player is higher than 0:
set the result to placeholder "worldguard_region_name_capitalized" from player
else:
set result to "&4Agresiva"

If there's a indentation error, fix it, i wrote this from my phone and cannot see if there's any.
The console is constantly showing this: [WARN] CPU usage of placeholder %locate_zone% is 30%. It will most likely cause problems. Try increasing refresh interval.