Jump to content

set block to random block in list


BOXEY

Recommended Posts

I was thinking how I can set a mined block to a random block that is in a list of blocks like this

 

 

varibles:
	{list1) = dirt, grass_block, ect.


on mine of block:
	if player has permisson "playa":
		set event-block to random item in {list1}
	

 

"idk if this code works just made on the fly"

Link to comment
Share on other sites

Wrong, all wrong. First of all. Screw an actual variable and use a local variable list.

 

on break:
	player has permission "playa"
	set {_list::*} to dirt, grass block, stone, and cobblestone
	set {_b} to a random element out of {_list::*}
	set event-block to {_b}

The syntax really is 'random element out of'. This should work. Also no need for an 'if' if you're not going to put an 'else'. It's just laggy and pointless. To make a variable local, assuming you don't know what that is just add an underscore before the variable name.

Global:

{variable}

Local: 

{_variable}

Why is this efficient? It deletes its self after the code is done running. Whileas your list would stay in variables.csv forever. Hey, any bit counts. By the way, a LIST variable is what you need. List variables always end with '::*'

Non-List variable just regular variable:

{variable} or {_varaible} or {variable::%player%}

List variable:

{variable::*} or {_variable::*} or {variable::%player%::*}

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

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