Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Suggestion: "loop-number" expression for all types of loops #862

Closed
jaylawl opened this issue Sep 9, 2017 · 4 comments
Closed

Suggestion: "loop-number" expression for all types of loops #862

jaylawl opened this issue Sep 9, 2017 · 4 comments
Labels
completed The issue has been fully resolved and the change will be in the next Skript update. enhancement Feature request, an issue about something that could be improved, or a PR improving something. priority: low Issues that are not harmful to the experience but are related to useful changes or additions.

Comments

@jaylawl
Copy link
Contributor

jaylawl commented Sep 9, 2017

As far as i can tell so far, the only instance where you're able to use the "loop-number" expression is in a loop like this:

loop 1337 times:
    broadcast "%loop-number%"

However this expression would also be useful in the other loop-types. It would prevent us all from having to do this all over our scripts:

loop {_some_var::*}:
    add 1 to {_n}
    broadcast {_n}
    if {_n} >= 1337:
        exit loop

Cheers for reading! :)

@Pikachu920
Copy link
Member

That appears in any loop where there is a number. %number% times is actually an expression that returns 1 to the number e.g. 1 to 6 for 6 times

@JRoy
Copy link
Contributor

JRoy commented Sep 10, 2017

%loop-index% is a number of times it has been looped

@TheBentoBox
Copy link
Member

No it's not @WheezyGold7931, the loop-index is the index of the current item being looped in the list. By default list indices are labelled as numbers in sequential order (1, 2, 3, ...) but if you specify your own index then that's not at all the case (e.g. set {cooldown::%player's UUID%} to now would result in the player's UUID for the loop-index).

@TheBentoBox TheBentoBox added the enhancement Feature request, an issue about something that could be improved, or a PR improving something. label Sep 10, 2017
@JeepSmash
Copy link
Contributor

@WheezyGold7931 was almost correct with his statement as it only pertains to
loop %number% times:
when using this loop type the loop-value not the loop-index will hold the number of times the loop has run. If something like this was to be added to other loop types such as looping lists or entities or blocks i would recommend adding in a loop-count expression that would hold the number of times any loop has cycled so it doesn't get confusing as to what loop-value is really holding

@bensku bensku added the priority: low Issues that are not harmful to the experience but are related to useful changes or additions. label Jan 31, 2018
@AyhamAl-Ali AyhamAl-Ali added the PR available Issues which have a yet-to-be merged PR resolving it label Jun 27, 2022
@TheLimeGlass TheLimeGlass added completed The issue has been fully resolved and the change will be in the next Skript update. and removed PR available Issues which have a yet-to-be merged PR resolving it labels Jun 26, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
completed The issue has been fully resolved and the change will be in the next Skript update. enhancement Feature request, an issue about something that could be improved, or a PR improving something. priority: low Issues that are not harmful to the experience but are related to useful changes or additions.
Projects
None yet
Development

No branches or pull requests

9 participants