Help with finding object position and/or object name

I want to make an object do different things based off of either the position based on the flowlab grid(0/0, 1/1, etc) or based on the name of the object(each object you place can be named), i have not found a way of using this though, there does not seem to be anything that detects the flowlab co-ordinates and the thing that gets the name of the object(extract this object’s name) has no output, so i cannot even use the value.

So you want the grid position of the player, then?

Or object in general, but yes.

1 Like

Ok, we can do this with some somewhat simple math, then.

{"data":{"behavior":{"v":"2","nodes":[{"inputCount":2,"outputCount":2,"name":"Position to Grid","behaviorType":"logic.NodeGroup","x":270,"y":560,"group":"","id":"dab3ea19cfd1754c","notes":"Converts the X and Y positions to the grid.\nMade by Overma Games\nFor RealityGlitchStudios","n_o":1,"isMenuItem":false},{"inputCount":0,"outputCount":1,"name":"Bundle Input","behaviorType":"logic.NodeGroupInput","x":-90,"y":-32,"group":"dab3ea19cfd1754c","id":"dab3f39d96e2404e","portId":"dab3ea19cfd1754ci0","tag":"X","dataType":2},{"inputCount":0,"outputCount":1,"name":"Bundle Input","behaviorType":"logic.NodeGroupInput","x":-90,"y":80,"group":"dab3ea19cfd1754c","id":"dab4062139879342","portId":"dab3ea19cfd1754ci1","tag":"Y","dataType":2},{"inputCount":1,"outputCount":0,"name":"Bundle Output","behaviorType":"logic.NodeGroupOutput","x":270,"y":-32,"group":"dab3ea19cfd1754c","id":"dab420b5d40f5b48","portId":"dab3ea19cfd1754co0","tag":"X","dataType":2},{"inputCount":1,"outputCount":0,"name":"Bundle Output","behaviorType":"logic.NodeGroupOutput","x":270,"y":80,"group":"dab3ea19cfd1754c","id":"dab437910459ce40","portId":"dab3ea19cfd1754co1","tag":"Y","dataType":2},{"expression":"(Math.round((A+16)/32)*32)/32","default0":0,"default1":0,"default2":0,"default3":0,"default4":0,"default5":0,"params":1,"version":2,"tag":"Calculate X","inputCount":2,"outputCount":1,"name":"Expression","behaviorType":"logic.logic.Expression","x":90,"y":-32,"group":"dab3ea19cfd1754c","id":"dab4775639f17e4d"},{"expression":"(Math.round((A+16)/32)*32)/32","default0":0,"default1":0,"default2":0,"default3":0,"default4":0,"default5":0,"params":1,"version":2,"tag":"Calculate Y","inputCount":2,"outputCount":1,"name":"Expression","behaviorType":"logic.logic.Expression","x":90,"y":80,"group":"dab3ea19cfd1754c","id":"dab5c3afcd97f648"}],"links":[{"input_id":"dab4775639f17e4di0","output_id":"dab3f39d96e2404eo0"},{"input_id":"dab4775639f17e4di1","output_id":"dab3f39d96e2404eo0"},{"input_id":"dab5c3afcd97f648i0","output_id":"dab4062139879342o0"},{"input_id":"dab5c3afcd97f648i1","output_id":"dab4062139879342o0"},{"input_id":"dab420b5d40f5b48i0","output_id":"dab4775639f17e4do0"},{"input_id":"dab437910459ce40i0","output_id":"dab5c3afcd97f648o0"}]}}}

Will this work for you? Hope it helps!

Set the cordinate to 0 0 but it seems to have no effect,take a look for yourself if its something on my end, here: New Game - Flowlab Game Creator, its the black box object.

1 Like

Sorry, lol. I forgot to subtract one out of it.
Here is the new code.

{"data":{"behavior":{"v":"2","nodes":[{"inputCount":2,"outputCount":2,"name":"Position to Grid","behaviorType":"logic.NodeGroup","x":270,"y":560,"group":"","id":"dab3ea19cfd1754c","notes":"Converts the X and Y positions to the grid.\nMade by Overma Games\nFor RealityGlitchStudios","n_o":1,"isMenuItem":false},{"inputCount":0,"outputCount":1,"name":"Bundle Input","behaviorType":"logic.NodeGroupInput","x":-90,"y":-32,"group":"dab3ea19cfd1754c","id":"dab3f39d96e2404e","portId":"dab3ea19cfd1754ci0","tag":"X","dataType":2},{"inputCount":0,"outputCount":1,"name":"Bundle Input","behaviorType":"logic.NodeGroupInput","x":-90,"y":80,"group":"dab3ea19cfd1754c","id":"dab4062139879342","portId":"dab3ea19cfd1754ci1","tag":"Y","dataType":2},{"inputCount":1,"outputCount":0,"name":"Bundle Output","behaviorType":"logic.NodeGroupOutput","x":270,"y":-32,"group":"dab3ea19cfd1754c","id":"dab420b5d40f5b48","portId":"dab3ea19cfd1754co0","tag":"X","dataType":2},{"inputCount":1,"outputCount":0,"name":"Bundle Output","behaviorType":"logic.NodeGroupOutput","x":270,"y":80,"group":"dab3ea19cfd1754c","id":"dab437910459ce40","portId":"dab3ea19cfd1754co1","tag":"Y","dataType":2},{"expression":"Math.round((A+16)/32)-1","default0":0,"default1":0,"default2":0,"default3":0,"default4":0,"default5":0,"params":1,"version":2,"tag":"Calculate X","inputCount":2,"outputCount":1,"name":"Expression","behaviorType":"logic.logic.Expression","x":90,"y":-32,"group":"dab3ea19cfd1754c","id":"dab4775639f17e4d"},{"expression":"Math.round((A+16)/32)-1","default0":0,"default1":0,"default2":0,"default3":0,"default4":0,"default5":0,"params":1,"version":2,"tag":"Calculate Y","inputCount":2,"outputCount":1,"name":"Expression","behaviorType":"logic.logic.Expression","x":90,"y":80,"group":"dab3ea19cfd1754c","id":"dab5c3afcd97f648"}],"links":[{"input_id":"dab4775639f17e4di0","output_id":"dab3f39d96e2404eo0"},{"input_id":"dab4775639f17e4di1","output_id":"dab3f39d96e2404eo0"},{"input_id":"dab5c3afcd97f648i0","output_id":"dab4062139879342o0"},{"input_id":"dab5c3afcd97f648i1","output_id":"dab4062139879342o0"},{"input_id":"dab420b5d40f5b48i0","output_id":"dab4775639f17e4do0"},{"input_id":"dab437910459ce40i0","output_id":"dab5c3afcd97f648o0"}]}}}

It really was counting “0,0” as “1,1”.

2 Likes

Ok it works, but another issue im coming across is that the AND logic gate is not puttng out an output.

1 Like

Ok, so I am guessing you are inputting “0” into the logic gate? When you get more into it, 0 essentially turns the gate off. You can just use other numbers than 0, and it should work.

1 Like

That is so weird, but you are correct.

1 Like

Yeah, it is a main thing in most code apparently. I am not much of a coder outside of flowlab, but have had seen other cases, including my own. Glad I could help! :smile:

1 Like

Thanks and have a good day!

1 Like

You too! If you need any more help, let me know!

2 Likes