Jump to content
  • 1

skript gives errors.


mr_peef

Question

Hello, i'm trying to make a skript for rainbow crates! i wanted to use different colors of wool to use as rainbows blocks but it gives errors. 

Here is my code:

 

set {_list::*} to red wool, blue wool, lime wool, purple wool, light blue wool, cyan wool, orange wool, yellow wool and green wool

every 0.7 seconds:
    set block at location(x-174,y4,z-93,world "world") to random element out of {_list::*}
 

the errors i get when i reload my skript:

error 1:
Line 1: Invalid line, all code has to be put in triggers! line: set {_list::*} to red wool, blue wool, lime wool, purple wool, light blue wool, cyan wool, orange wool, yellow wool and green wool

 

error 2:

Line 4: Functions cannot be used here (or there is a problem with your arguments)! Line: set block at location(x-174,y4,z-93,world "world") to random element out of {_list::*}

 

Does anyone know how to fix this? I tried everything so please send me a working code! Thanks in advance!

  • Like 1
Link to comment
Share on other sites

4 answers to this question

Recommended Posts

  • 1

Stop, please.

You need to define {_loc} 
inside the object 'every 0.7 seconds'

In addition, it is errors because you spelled 'element' as 'elmement' -_-

Create the instance
 

on skript load:
	set {list::*} to red wool, blue wool, lime wool, purple wool, light blue wool, cyan wool, orange wool, yellow wool, and green wool


Change every 0.7 seconds to

every 0.7 seconds:
	set {_loc} to location(-174, 4, -93, world "world")
    set block at {_loc} to a random element out of {list::*}

The spacing will look weird, just make sure both lines line up to one another.

Due to your code, it seems you don't know how OOP languages even function. All things must be inside an object. Skript is far from an OOP, it's just English, but it does draw from them. Everything and anything you define must be under a statement in Skript. Learn Skript, please.

Check out my forum post to get tips:

 

Edited by rosathorn

rose city STICKER

RosaRosaRosaRosaRosaRosaRosaRosaRosaRosaRosaRosaRosaRosaRosaRosaRosaRosaRosaRosaRosaR

i code, animate, develop, UI design, learn, and adapt, as well as make servers, of course

💐Joined Minehut sometime in 2014
💐VIP sometime in 2018
💐Legend in January 2021
💐Helper on 4/11/2021
💐♥ (Retired) on 5/17/2021
💐 Moderator on 8/18/2023

Link to comment
Share on other sites

  • 0

Try putting a comma after 'yellow wool'.

For the second issue, set a var to the location
 

set {_loc} to location(-174, 4, -93, world "world")

Then

 

set block at {_loc} to a random elmement out of {list::*}


As a note, you defined 'List' as a LOCAL variable since you put an underscore before its name. It will not work unless you remove the underscore. If you make a variable a local variable it automatically deletes once the code is done running.

rose city STICKER

RosaRosaRosaRosaRosaRosaRosaRosaRosaRosaRosaRosaRosaRosaRosaRosaRosaRosaRosaRosaRosaR

i code, animate, develop, UI design, learn, and adapt, as well as make servers, of course

💐Joined Minehut sometime in 2014
💐VIP sometime in 2018
💐Legend in January 2021
💐Helper on 4/11/2021
💐♥ (Retired) on 5/17/2021
💐 Moderator on 8/18/2023

Link to comment
Share on other sites

  • 0

Thanks for the reply but the errors are still there.

Edit: there is a new error: Line 6: a block can't be set to 'a random element out of {list::*} because the latter is neither an item type nor a block data. Line:     set block at {_loc} to a random elmement out of {list::*}

 

This is my current code:

set {_loc} to location(-174, 4, -93, world "world")

set {list::*} to red wool, blue wool, lime wool, purple wool, light blue wool, cyan wool, orange wool, yellow wool, green wool

every 0.7 seconds:
    set block at {_loc} to a random elmement out of {list::*}
 

Edited by mr_peef
Forgot to mention something.
Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...