#3x3 detect
1 messages · Page 1 of 1 (latest)
you mean within two points?
Similar, but the coordinates of the two points are not stored in variables.
But if i store, variables wiill over 10000
How can i store them? I think i can't
I'll use on walk on event and i can't store them
What is the purpose of the 3x3 area
Its really hard to help you when you dont have any code
I want to make elevator skript
I dont see how you could do that without storing the area in some way
Unless you use some block as elevator block and detect walking on that block
Ok...
{_var} @dusty maple
Basiaclly adding a _ will make so that the variable can be only used in the function/event/whatever
So for example on right click: if player's held item is tnt named "&cKaboom": set {_n} to 0 loop all blocks in radius 10 of player: set {_block::%{_n}%} to loop-block add 1 to {_n} loop {_block::*}: set loop-value to air
So basiaclly
I'm setting a variable {_n} and every loop it will add 1 to it, but I don't want it to save and I don't want it to bother with anything else, so I will make into a local variable which will be "deleted" after the event on right click:
Basiaclly the same with {_block::*} all it does is get deleted after the event and I can reuse the same thing without having to save 100s of location and use room and ram and etc
So basiaclly just use local variables to save the blocks and check them, you can even use local variables in functions and stuff
like
loop all blocks in radius 2 of event-block:
add loop-block to {_blocklist::*}
CheckOre({_blocklist::*}, player)
function CheckOre(b: block, p: player):
if {_b} is iron ore:
set {_b} to air
give {_p} 1 of iron ingot```
And no locations, no blocks, no nothing is saved
Btw not tested and I'm pretty sure it a bit more complicated
Just an example
you are not 100% correct in the function. You made it so it can only accept 1 block, but in the event code, you give it multiple (a list); you might be able to change block to objects, but I would just change it to blocks instead
Yeah again just an example xd
and even still, you would then need to loop {_b::*} before checking it's block type (i.e. iron ore)
Also, you set {_b} (a block type) to another block type, but never gave it a location.