Not looping properly

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

Andalmere

Active Member
Guys i really need a help here. My code
code_language.skript:
#GUI
loop {SuperDuels::kitlist::*}:
            if loop-index parsed as integer = 8:
                stop loop
            if {SuperDuels::kitlogo::%loop-value%} is set:
                format slot "%loop-index%" parsed as integer of player with {SuperDuels::kitlogo::%loop-value%} named "&e&n%loop-value%" with lore "&7Click to add %loop-value% to the kitgui." to run [arenakitSelector("%loop-value%", "%loop-index%" parsed as integer, "%{SuperDuels::kitlogo::%loop-value%}%" parsed as item type, 0, "%{SuperDuels::%player%::editmode}%", player)]
            else:
                format slot "%loop-index%" parsed as integer of player with grass named "&e&n%loop-value%" with lore "&7Click to add %loop-value% to the kitgui." to run [arenakitSelector("%loop-value%", "%loop-index%" parsed as integer, "2" parsed as item type, 0, "%{SuperDuels::%player%::editmode}%", player)]
        format slot 8 of player with arrow named "&6Next" to be unstealable
code_language.skript:
# The Function
function arenakitSelector(k: text, n: number, l: item type, g: number, a: text, p: player):
    wait 2 ticks
    if {_n} is 0:  
        stop
    else:
        if inventory name of {_p}'s current inventory is "Select a kit":
            if {_g} = 0:
                format slot {_n} of {_p} with glowing "%{_l}%" parsed as item type named "&e&n%{_k}%" with lore "&7Click to add %{_k}% to the kitgui." to run [arenakitSelector("%{_k}%", {_n}, {_l}, 1, "%{_a}%", {_p})]
            else:
                format slot {_n} of {_p} with "%{_l}%" parsed as item type named "&e&n%{_k}%" with lore "&7Click to add %{_k}% to the kitgui." to run [arenakitSelector("%{_k}%", {_n}, {_l}, 0, "%{_a}%", {_p})]
                stop
And the problem is.. when i click the kit3, it activates kit5. (Shown in the GIF below.)
Unp0U3Z.gif

(http://i.imgur.com/Unp0U3Z.gif - incase if it don't work)
 
Have you checked to see if {SuperDuels::kitlist::*} is set correctly? I'd suggest broadcasting some debug messages.

If you still have issues, It might help if you could mark out what path the code is taking as I don't know what is being set and where to actually look for the issue.

Here is my best guess though:
{_n} is being set to 5 instead of 3
This means the loop-index must be 5
Which means something must be up with that first variable {SuperDuels::kitlist::*}

That's all I can really see that might be causing issues.
 
Status
Not open for further replies.