Solved Help with warp skrip

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

Status
Not open for further replies.

AgentStrawberryYT

New Member
Jul 29, 2021
5
0
1
19
I have a warp skript, and I'm trying to make a way to set an item for a warp, using '/setWarp warpName warpItem'. All of that works, but when I open the GUI no matter what I named the warp, if I named it "OOF" it shows the name as "oof", please help, why is this happening, code:
Code:
command setwarp <text> [<item>]:
    permission: core.warps.set
    permission message: &cNo perms!
    usage: /setwarp <warpName> [item]
    trigger:
        if arg-2 is set:
            set {warpitems::%colored arg-1%} to arg-2
            send "&bYou set &a%colored arg-1% &bto &a%location of player% &bwith &a%arg-2%"
        else:
            send "&bYou set &a%colored arg-1% &bto &a%location of player%"
        set {warps::%colored arg-1%} to location of block at player
      
command warps:
    permission: core.warps.view
    permission message: &cNo perms!
    trigger:
        openWarps(player)

function openWarps(p: player):
    if {warps::*} exists:
        set {_l} to a chest inventory with 5 rows named "&5Server Warps"
    else:
        set {_l} to a chest inventory with 5 rows named "&cServer Warps &8––– &cNone"
    set {_x} to 0
    loop {warps::*}:
        if {warpitems::%colored loop-index%} is set:
            set slot {_x} of {_l} to {warpitems::%colored loop-index%} named "%colored loop-index%"
        else:
            set slot {_x} of {_l} to a oak sign named "%colored loop-index%"
        add 1 to {_x}
    open {_l} to {_p}
 
command clearwarps:
    permission: core.warps.clear
    permission message: &cNo perms!
    trigger:
        delete {warps::*}
        delete {warpitems::*}
        send "&bWarps are deleted"

Thanks in advance!
~ AgentStrawberry
[doublepost=1631331398,1631322183][/doublepost]Please help
 
The capitalization isn't being preserved in the variable index, try this instead

Code:
command setwarp <text> [<text>] [<item>]:
    permission: core.warps.set
    permission message: &cNo perms!
    usage: /setwarp <warp> [name] [item]
    trigger:
        set {warp::%arg-1%::location} to location of block at player
        set {warp::%arg-1%::name} to arg-2 ? arg-1
        set {warp::%arg-1%::item} to arg-3 ? oak sign
        send "&bYou set &a%{warp::%arg-1%::name}% &bto &a%{warp::%arg-1%::location}% &bwith &a%{warp::%arg-1%::item}%"
   
command warps:
    permission: core.warps.view
    permission message: &cNo perms!
    trigger:
        openWarps(player)
 
function openWarps(p: player):
    set {_l} to a chest inventory with 5 rows named ("&5Server Warps" if {warp::*} exists, otherwise "&cServer Warps &8––– &cNone")
    set {_x} to 0
    loop indices of {warp::*}:
        set slot {_x} of {_l} to {warp::%loop-value%::item} named {warp::%loop-value%::name}
        add 1 to {_x}
    open {_l} to {_p}
 
command clearwarps:
    permission: core.warps.clear
    permission message: &cNo perms!
    trigger:
        delete {warp::*}
        send "&bWarps are deleted"
 
The capitalization isn't being preserved in the variable index, try this instead

Code:
command setwarp <text> [<text>] [<item>]:
    permission: core.warps.set
    permission message: &cNo perms!
    usage: /setwarp <warp> [name] [item]
    trigger:
        set {warp::%arg-1%::location} to location of block at player
        set {warp::%arg-1%::name} to arg-2 ? arg-1
        set {warp::%arg-1%::item} to arg-3 ? oak sign
        send "&bYou set &a%{warp::%arg-1%::name}% &bto &a%{warp::%arg-1%::location}% &bwith &a%{warp::%arg-1%::item}%"
  
command warps:
    permission: core.warps.view
    permission message: &cNo perms!
    trigger:
        openWarps(player)
 
function openWarps(p: player):
    set {_l} to a chest inventory with 5 rows named ("&5Server Warps" if {warp::*} exists, otherwise "&cServer Warps &8––– &cNone")
    set {_x} to 0
    loop indices of {warp::*}:
        set slot {_x} of {_l} to {warp::%loop-value%::item} named {warp::%loop-value%::name}
        add 1 to {_x}
    open {_l} to {_p}
 
command clearwarps:
    permission: core.warps.clear
    permission message: &cNo perms!
    trigger:
        delete {warp::*}
        send "&bWarps are deleted"

Use the string in
Code:
strict proper case
Look it up on docs.
 
The capitalization isn't being preserved in the variable index, try this instead

Code:
command setwarp <text> [<text>] [<item>]:
    permission: core.warps.set
    permission message: &cNo perms!
    usage: /setwarp <warp> [name] [item]
    trigger:
        set {warp::%arg-1%::location} to location of block at player
        set {warp::%arg-1%::name} to arg-2 ? arg-1
        set {warp::%arg-1%::item} to arg-3 ? oak sign
        send "&bYou set &a%{warp::%arg-1%::name}% &bto &a%{warp::%arg-1%::location}% &bwith &a%{warp::%arg-1%::item}%"
  
command warps:
    permission: core.warps.view
    permission message: &cNo perms!
    trigger:
        openWarps(player)
 
function openWarps(p: player):
    set {_l} to a chest inventory with 5 rows named ("&5Server Warps" if {warp::*} exists, otherwise "&cServer Warps &8––– &cNone")
    set {_x} to 0
    loop indices of {warp::*}:
        set slot {_x} of {_l} to {warp::%loop-value%::item} named {warp::%loop-value%::name}
        add 1 to {_x}
    open {_l} to {_p}
 
command clearwarps:
    permission: core.warps.clear
    permission message: &cNo perms!
    trigger:
        delete {warp::*}
        send "&bWarps are deleted"
Im not very good, what does "?" mean?
 
Im not very good, what does "?" mean?
object ? object
if first object is not set, second object is used, otherwise the first one is used
Same is for: '(object) if (condition), otherwise (object)' which means use the value of first object in case the condition is true, otherwise use second object
 
object ? object
if first object is not set, second object is used, otherwise the first one is used
Same is for: '(object) if (condition), otherwise (object)' which means use the value of first object in case the condition is true, otherwise use second object
thanks, I got it fixed, ill mark this as solved
 
Status
Not open for further replies.