BOXEY Posted July 7, 2021 Share Posted July 7, 2021 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 More sharing options...
rosabel Posted July 7, 2021 Share Posted July 7, 2021 (edited) 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 July 7, 2021 by rosathorn RosaRosaRosaRosaRosaRosaRosaRosaRosaRosaRosaRosaRosaRosaRosaRosaRosaRosaRosaRosaRosaRi code, animate, develop, UI design, learn, and adapt, as well as make servers, of courseJoined Minehut sometime in 2014VIP sometime in 2018Legend in January 2021Helper on 4/11/2021♥ (Retired) on 5/17/2021 Moderator on 8/18/2023 Link to comment Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now