So, I am trying to make a certain command with skript in WorldGuard. If the flag is allowed, deny it. If the flag is denied, allow it. It is a quick way to swap values over, as WorldGuard doesn't have a toggle feature. This is my buggy code:
command /toggleflag <text>:
permission: skript.command.toggleflag
trigger:
# Set the flag based on the argument
set {_flag} to arg-1
# Retrieve the placeholder value directly
set {_flagValue} to "%worldguard_region_has_flag_{_flag}%"
# Debugging output
send "Resolved placeholder value: %{_flagValue}%"
# Check if the value is 'yes'
if {worldguard::worldguard_region_has_flag_pvp} is "yes":
execute console command "/rg flag event %{_flag}% deny"
send "Flag %{_flag}% is set to 'allow' and changed to 'deny'."
else if {worldguard::worldguard_region_has_flag_pvp} is "no":
execute console command "/rg flag event %{_flag}% allow"
send "Flag %{_flag}% is set to 'deny' and changed to 'allow'."
else:
send "Flag %{_flag}% is either 'null' or not recognized."
My issues are as follows:
When reloading this script, it comes up with:
Line 8:
Region "%worldguard_region_has_flag_{_flag}%" could not be found
When executing the command:
Resolved placeholder value: <none>
Flag event is either 'null' or not recognised.
Server version: 1.20.4
I have: WorldGuard, PlaceholderAPI, Skript (and others but they don't matter in this situation)
These plugins are all used massively so replacing is not an option
Please help!
command /toggleflag <text>:
permission: skript.command.toggleflag
trigger:
# Set the flag based on the argument
set {_flag} to arg-1
# Retrieve the placeholder value directly
set {_flagValue} to "%worldguard_region_has_flag_{_flag}%"
# Debugging output
send "Resolved placeholder value: %{_flagValue}%"
# Check if the value is 'yes'
if {worldguard::worldguard_region_has_flag_pvp} is "yes":
execute console command "/rg flag event %{_flag}% deny"
send "Flag %{_flag}% is set to 'allow' and changed to 'deny'."
else if {worldguard::worldguard_region_has_flag_pvp} is "no":
execute console command "/rg flag event %{_flag}% allow"
send "Flag %{_flag}% is set to 'deny' and changed to 'allow'."
else:
send "Flag %{_flag}% is either 'null' or not recognized."
My issues are as follows:
When reloading this script, it comes up with:
Line 8:
Region "%worldguard_region_has_flag_{_flag}%" could not be found
When executing the command:
Resolved placeholder value: <none>
Flag event is either 'null' or not recognised.
Server version: 1.20.4
I have: WorldGuard, PlaceholderAPI, Skript (and others but they don't matter in this situation)
These plugins are all used massively so replacing is not an option
Please help!