Skip to content

Suggestion: add tree loop functionality #1419

@jaylawl

Description

@jaylawl

I was messing around with this idea. I know MundoSK is capable of doing this, but i don't want to add such a huge add-on for just a single thing. That's where this originated anyway:

function treeLoop(root: text) :: texts:
    loop {%{_root}%::*}:
        add "%{_root}%::%loop-index%" to {_tree::*} and {_new::*}
    while {_new::*} is set:
        loop {_new::*}:
            delete {_new::%loop-index%}
            loop {%loop-value-1%::*}:
                add "%loop-value-1%::%loop-index-2%" to {_tree::*} and {_new::*}
    return {_tree::*}

If you'd be using some code like this:

loop treeLoop(<root of list variable>):
    broadcast loop-value

All nested list variables will be found and broadcast under the condition that they're connected by a branch. For example {this::list::variable} can only be found with my code, if the "branch" {this::list} exists and links them.

So my gut feeling, which might of course be wrong, is telling me that, if i was able to somewhat pull this off using a script, it couldn't be much harder an addition to actual Skript. Please share your thoughts, thank you for reading!

Cheers

Metadata

Metadata

Assignees

No one assigned

    Labels

    completedThe issue has been fully resolved and the change will be in the next Skript update.enhancementFeature request, an issue about something that could be improved, or a PR improving something.priority: lowIssues that are not harmful to the experience but are related to useful changes or additions.

    Type

    No type

    Projects

    Status

    Done - Released

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions