Loops

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

Scholler

Active Member
Aug 6, 2018
130
9
0
24
Hello, I'm trying to do a shop gui. It always ads one more to the loop-value, so format gui slot 0 of player with 1 grass, next is format gui slot 1 of player with 2 grass, etc.

But.. How to do this? My code is not working {_a} is 4 because I manually added 4 slots
code_language.skript:
loop 64 - {_a} times:
      loop integers between {_a} - 1 and {_b}:
            set {_a} to {_a} + 1
            set {_b} to {_a} - 1
            set {_c} to 64 - {_a}
            loop {_c} times:
                set slot loop-number-2 of player with loop-number-3 grass with name "&eGrass - %{_a}%" to run player command "/getgrass %{_a}%"

There's an error with that /getgrass too.
code_language.skript:
command /getgrass <Text>:
      trigger:
            set {_num} to arg-1 parsed as a number
            loop integers between {_num} - 1 and {_num} + 1:
                  give loop-number grass to player
                  set {_asd} to loop-number * 10
                  remove {_asd} from player's balance

[20:38:58 ERROR]: There's no loop that matches 'loop-number-3 grass with name "&eGrass - %{_a}%"'
[20:38:58 ERROR]: There's no loop that matches 'loop-number grass'

So what I want is fill up the GUI with always +1 grass (Sorry for my bad English)
[doublepost=1538247065,1538246544][/doublepost]I fixed the /getgrass, but the other thing is still not working:c
[doublepost=1538248352][/doublepost]Fixed the another thing too! If someone has this problem, my code:
code_language.skript:
command /guigrass:
      trigger:
            open virtual chest inventory with size 8 with name "&6Shop - Blocks - Grass" to player
            wait 1 tick
            format gui slot 0 of player with 1 grass with name "&eGrass - 1" to run player command "/getgrass 1"
            set {_a} to 0
            while {_a} is less than 64:
                  set {_a} to {_a} + 1
                  set {_b} to {_a} - 1
                  loop 64 times:
                        format gui slot {_b} of player with {_a} of grass with name "&eGrass - %{_a}%" to run player command "/getgrass %{_a}%"


command /getgrass <Number>:
      trigger:
            give arg-1 of grass to player
            set {_asd} to arg 1 * 10
            remove {_asd} from player's balance
 
Status
Not open for further replies.