#loop 'continue'

1 messages · Page 1 of 1 (latest)

warped tree
#

Anyone ?

delicate cipher
#

Do you know what continue does?

warped tree
#

should skip to the next loop ?

delicate cipher
#

mhmm

warped tree
#

am I dumb haha ?

#

doesn't continue do that ?

#

also it seems to work using continue loop - but why ?

delicate cipher
#

honestly I think your formatting is distracting--try looking at this```effect open GUI %object% value %object% of %object%:
trigger:
loop file of "plugins/Skript/scripts/File.json":
if loop-value contains "Menu":
add loop-value to {_N::*}
continue

        if loop-value contains "Name":
            set {_T} to "_Name"
            continue
        if loop-value contains "Lore":
            set {_T} to "_Lore"
            continue
        if loop-value contains "NBTs":
            set {_T} to "_NBTs"
            continue

        # Continue
        if loop-value contains "-":
            add loop-value to {%{_T}%::*}

    # Results
    loop {_N::*}:
        broadcast loop-value```
warped tree
#

same result

delicate cipher
#

yes, thats your code--i just cleaned it up a bit so its easier to read

warped tree
#

oh yea, sorry about that - but about the continue thing ? why doesn't it work

delicate cipher
warped tree
#

This part

                add loop-value to {%{_T}%::*}```
#

But it doesn't, also it works with using continue loop but not with continue ? what's the difference

delicate cipher
#

walk me through what is supposed to happen

warped tree
#
    Trigger:
        
        delete {Name::*}
        delete {Lore::*}
        delete {NBTs::*}

        loop file of "plugins/Skript/scripts/File.json":

            IF loop-value contains "Name:":
                set {_T} to "Name"
                continue loop

            IF loop-value contains "Lore:":
                set {_T} to "Lore"
                continue loop

            IF loop-value contains "NBTs:":
                set {_T} to "NBTs"
                continue loop

            else:

                IF loop-value contains "-":
                    add loop-value to {%{_T}%::*}

        # </> Results 
        
        Print ""
        Print "Name"
        Print ""

        loop {Name::*}:
            Print loop-value
            # set {} to parsed loop-value by "Name"

        Print ""
        Print "Lore"
        Print ""

        loop {Lore::*}:
            Print loop-value
            # set {} to parsed loop-value by "Lore"

        Print ""
        Print "NBTs"
        Print ""
        
        loop {NBTs::*}:
            Print loop-value
            # set {} to parsed loop-value by "NBTs"```
#

I updated the code a bit, now it works - I was using _ as the T variable and when it goes out of scope of the loop it's no longer valid and when looping the list at the end, it was empty

#

all tho again the keyword continue doesn't seem to work nothing happens, but continue loop works ?

#

also is my code that hard to read ? I feel like it's easier now - Not sure why my brain likes it that way ....

delicate cipher
#
  1. You have too many empty lines. The ones directly under opening a section (like under Trigger:) are especially useless IMO
  2. You have capitalisation for the start of some lines--but only some. They should all be lowercase
  3. Skript uses broadcast, not Print
  4. what the heck is parsed loop-value by "..."?
  5. you use %object% thrice, instead of specifying what you are working with
warped tree
#

oh haha, the print are an custom broadcast I made, the parsed thing not implemented yet but some sort of abstraction to get the right values out of a string. The object are just placeholders for now, I was too lazy to create an command to test it..

delicate cipher
#

why would you make a custom effect that just redirects to an already existing skript effect

warped tree
#

it's not meant to use in the effect, I just had it bind to an command already so I was just testing the code with it