Solved Executing command with item's name throwing an error

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

Liam Jacobs

Member
Jan 26, 2021
2
0
1
26
EDIT: Obvious fix here, I was just having a dull moment:

code_language.skript:
set {_warpName} to unformatted event-item's name
send "plwarp %{_warpName}%" to player
make player execute command "plwarp %{_warpName}%"

I have a particularly odd one here - I'm working on a custom GUI that lists a bunch of player's warps, and if one is clicked, a command is run to teleport the player there.

This isn't too complex, but I've hit a roadblock with:

code_language.skript:
set {_warpName} to event-item's name
send "plwarp %{_warpName}%" to player
make player execute command "plwarp %{_warpName}%"

The message shows up as (for example) "plwarp TestName", and if I run /plwarp TestName manually it works just fine... but the script executing the same command says that the warp does not exist.

Here's the plwarp command's code that's responsible for the teleporting:
code_language.skript:
if {playerWarps::*} contains arg-1:
    if {playerWarps::%arg-1%::locked} is false:
        send "Teleporting to %arg-1%..." to player
        teleport player to {playerWarps::%arg-1%::location}
        add 1 to {playerWarps::%arg-1%::visits}
    else:
        send "Warp not found..." to player

It throws "Warp not found" every single time.

I've checked and there are no extra spaces or special characters that may be throwing it off as far as I can tell. Is there something different about item names when used as strings as opposed to a regular 'ole bit of text?