#3x3 detect

1 messages · Page 1 of 1 (latest)

dusty maple
#

Is there a way to detect that I am in one of the 3x3 blocks?

past hazel
#

you mean within two points?

dusty maple
#

Similar, but the coordinates of the two points are not stored in variables.

solid moon
#

Why wouldnt you store them

#

It makes the work much easier

dusty maple
#

But if i store, variables wiill over 10000

solid moon
#

Use local variables

#

Tbh seeing your code would help a lot

dusty maple
#

How can i store them? I think i can't

#

I'll use on walk on event and i can't store them

solid moon
#

What is the purpose of the 3x3 area

#

Its really hard to help you when you dont have any code

dusty maple
#

I want to make elevator skript

solid moon
#

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

dusty maple
#

Ok...

dreamy hornet
#

{_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

dreamy hornet
#

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

dreamy hornet
#

Just an example

past hazel
#

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

dreamy hornet
#

Yeah again just an example xd

past hazel
#

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.

dreamy hornet
#

Yeah... it a format

#

So half of it "wrong" xD