Solved Indentation problem

  • 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 community!

    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.

hasanas

Member
Feb 7, 2017
12
0
0
Code:
variables:
    {rewards::1} = stick
    {rewards::2} = diamond
    {rewards::3} = apple

command /chestspawn <integer>:
    usage: /chestspawn <1-5>
    trigger:
        arg-1 is between 1 and 5:
            set {location.%arg-1%.chestspawn} to player's location
            send "Chestspawn %arg-1% created."
           
every 1 minute:
    set {_random} to a random integer between 1 and 5
    set block at {location.%{_random}%.chestspawn} to ender chest
    broadcast "Chest spawned at %{location.%{_random}%.chestspawn}%"

on rightclick:   
    if clicked block is ender chest
    loop integers between 1 and 5
    clicked block's location is {location.%loop-number%.chestspawn}
    cancel event
    if {LootCrate.open} is true:
        message "&cSomeone else opened this crate already" to player
        stop
    else:
        set {LootCrate.open} to true
        wait 0.5 seconds
        give player a random item out of {rewards::*}
        launch burst firework colored blue at clicked block timed 0.1
        wait 0.5 seconds
        set {LootCrate.open} to false

I need only the spawned in enderchests to be affected by the script so I tried using a loop integers but I get errors that I don't know how to fix them:

Code:
[20:37:08 ERROR]: [Skript] Can't compare 'if clicked block' with an item type (Zeta.sk, line 19: if clicked block is ender chest')
[20:37:08 ERROR]: [Skript] Can't understand this condition/effect: loop integers between 1 and 5 (Zeta.sk, line 20: loop integers between 1 and 5')
[20:37:08 ERROR]: [Skript] There's no loop that matches 'loop-number' (Zeta.sk, line 21: clicked block's location is {location.%loop-number%.chestspawn}')

maybe someone can help me indent it and place the right tabs because I'm so lost and don't know what to do.

kind regards
hasanas
[doublepost=1486928701,1486928449][/doublepost]I basically want a script that allows me to set 5 spawns for chests that spawn in regularily, that give out rewards, I just don't know how to make it so ONLY the SPAWNED chests give out rewards, I think my current solution is pretty good but I don't know how or why it still gives me errors, if someone could help me indent it a bit or maybe correct some errors, it'd be great!
 
code_language.skript:
loop integers between 1 and 5:
  clicked block's location is {location.%loop-number%.chestspawn}
  cancel event
There was an indentation error on this part of your code, that should fix your errors
 
code_language.skript:
loop integers between 1 and 5:
  clicked block's location is {location.%loop-number%.chestspawn}
  cancel event
There was an indentation error on this part of your code, that should fix your errors

I tried this code like you told me:

Code:
variables:
    {rewards::1} = stick
    {rewards::2} = diamond
    {rewards::3} = apple

command /chestspawn <integer>:
    usage: /chestspawn <1-5>
    trigger:
        arg-1 is between 1 and 5:
            set {location.%arg-1%.chestspawn} to player's location
            send "Chestspawn %arg-1% created."
           
every 1 minute:
    set {_random} to a random integer between 1 and 5
    set block at {location.%{_random}%.chestspawn} to ender chest
    broadcast "Chest spawned at %{location.%{_random}%.chestspawn}%"

on rightclick:   
    if clicked block is ender chest
    loop integers between 1 and 5
        clicked block's location is {location.%loop-number%.chestspawn}
        cancel event
    if {LootCrate.open} is true:
        message "&cSomeone else opened this crate already" to player
        stop
    else:
        set {LootCrate.open} to true
        wait 0.5 seconds
        give player a random item out of {rewards::*}
        launch burst firework colored blue at clicked block timed 0.1
        wait 0.5 seconds
        set {LootCrate.open} to false

But then I get these errors?

Code:
[17:59:32 ERROR]: [Skript] indentation error: expected 1 tab, but found 2 tabs (Zeta.sk, line 21: clicked block's location is {location.%loop-number%.chestspawn}')
[17:59:32 ERROR]: [Skript] indentation error: expected 1 tab, but found 2 tabs (Zeta.sk, line 22: cancel event')
[17:59:32 ERROR]: [Skript] indentation error: expected 1 tab, but found 2 tabs (Zeta.sk, line 21: clicked block's location is {location.%loop-number%.chestspawn}')
[17:59:32 ERROR]: [Skript] indentation error: expected 1 tab, but found 2 tabs (Zeta.sk, line 22: cancel event')
[17:59:32 ERROR]: [Skript] Can't compare 'if clicked block' with an item type (Zeta.sk, line 19: if clicked block is ender chest')
[17:59:32 ERROR]: [Skript] Can't understand this condition/effect: loop integers between 1 and 5 (Zeta.sk, line 20: loop integers between 1 and 5')
 
I tried this code like you told me:

Code:
variables:
    {rewards::1} = stick
    {rewards::2} = diamond
    {rewards::3} = apple

command /chestspawn <integer>:
    usage: /chestspawn <1-5>
    trigger:
        arg-1 is between 1 and 5:
            set {location.%arg-1%.chestspawn} to player's location
            send "Chestspawn %arg-1% created."
          
every 1 minute:
    set {_random} to a random integer between 1 and 5
    set block at {location.%{_random}%.chestspawn} to ender chest
    broadcast "Chest spawned at %{location.%{_random}%.chestspawn}%"

on rightclick:  
    if clicked block is ender chest
    loop integers between 1 and 5
        clicked block's location is {location.%loop-number%.chestspawn}
        cancel event
    if {LootCrate.open} is true:
        message "&cSomeone else opened this crate already" to player
        stop
    else:
        set {LootCrate.open} to true
        wait 0.5 seconds
        give player a random item out of {rewards::*}
        launch burst firework colored blue at clicked block timed 0.1
        wait 0.5 seconds
        set {LootCrate.open} to false

But then I get these errors?

Code:
[17:59:32 ERROR]: [Skript] indentation error: expected 1 tab, but found 2 tabs (Zeta.sk, line 21: clicked block's location is {location.%loop-number%.chestspawn}')
[17:59:32 ERROR]: [Skript] indentation error: expected 1 tab, but found 2 tabs (Zeta.sk, line 22: cancel event')
[17:59:32 ERROR]: [Skript] indentation error: expected 1 tab, but found 2 tabs (Zeta.sk, line 21: clicked block's location is {location.%loop-number%.chestspawn}')
[17:59:32 ERROR]: [Skript] indentation error: expected 1 tab, but found 2 tabs (Zeta.sk, line 22: cancel event')
[17:59:32 ERROR]: [Skript] Can't compare 'if clicked block' with an item type (Zeta.sk, line 19: if clicked block is ender chest')
[17:59:32 ERROR]: [Skript] Can't understand this condition/effect: loop integers between 1 and 5 (Zeta.sk, line 20: loop integers between 1 and 5')


Replace
Code:
loop integers between 1 and 5
with
Code:
loop integers between 1 and 5:
 
Thank you all so much, got everything to work now!
 
Last edited by a moderator:
Status
Not open for further replies.