Official Everybody Edits Forums

Do you think I could just leave this part blank and it'd be okay? We're just going to replace the whole thing with a header image anyway, right?

You are not logged in.

#1 2016-09-28 22:45:07

Artistjr5000
Member
Joined: 2016-09-28
Posts: 6

Help with detecting where a block is?

I'm new to EE bot programming and I want to know how to tell where a block already in your world before you connected your bot is. I'm trying to make something where a block will continue to move downward until it touches another block :I

Offline

#2 2016-09-28 23:19:54

hummerz5
Member
From: wait I'm not a secret mod huh
Joined: 2015-08-10
Posts: 5,852

Re: Help with detecting where a block is?

EE sends all the info about the world in the init message. That includes block data but it's not easy to figure out if you're new to computers. I believe a user has published their own INITPARSE. Further, someone made one that acclaimedly does not break.

You need to take this init data and save it to memory to access later, updating it with the b messages.

Offline

#3 2016-09-28 23:22:24, last edited by Koya (2016-09-28 23:33:57)

Koya
Fabulous Member
From: The island with those Brits
Joined: 2015-02-18
Posts: 6,310

Re: Help with detecting where a block is?

Proc made initparse.cs

http://forums.everybodyedits.com/viewtopic.php?id=26792


Edit: req to Proc to rename the thread to make it easier to locate, I only remember the name because I've looked for it ... twice (starred on github so shouldn't have any issues finding it again though)


Po9cnQh.png

PLNQVL8.png
Thank you eleizibeth ^

1SYOldu.png

I stack my signatures rather than delete them so I don't lose them
giphy.gif

WfSi4mm.png

Offline

Wooted by:

#4 2016-09-28 23:32:22, last edited by Artistjr5000 (2016-09-29 01:32:46)

Artistjr5000
Member
Joined: 2016-09-28
Posts: 6

Re: Help with detecting where a block is?

I'm a little confused on how to use this? Can someone explain it to me?

Offline

#5 2016-09-29 02:09:31

SirJosh3917
Formerly ninjasupeatsninja
From: USA
Joined: 2015-04-05
Posts: 2,095

Re: Help with detecting where a block is?

Artistjr5000 wrote:

I'm a little confused on how to use this? Can someone explain it to me?

Do normal bot code, just don't send "init2". Only send "init"
Then you'll recieve "init".
You can use initparse to figure out where blocks are.

Offline

#6 2016-09-29 05:30:55

capasha
Member
Joined: 2015-02-21
Posts: 4,066

Re: Help with detecting where a block is?

I think you are talking about a bridge that is falling when the user move over the blocks?
I coded something similar with EEPhysics but gave up.
Then use EEPhysics and a tutorial from jesse

Offline

#7 2016-09-29 18:22:53, last edited by Tomahawk (2016-09-29 18:24:35)

Tomahawk
Forum Mod
From: UK
Joined: 2015-02-18
Posts: 2,835

Re: Help with detecting where a block is?

If you're new to bots, I suggest you don't start off with something this complicated. You need a deserialiser to analyse all the block data in "init", which is complex code, and on top of that you'll need to listen to every block message so that your block data stays updated. If you want perfect map data, that means listening for "b", "pt", "br", "ts", "lb", "pt", "wp", "bc" and probably some others I've forgotten.


One bot to rule them all, one bot to find them. One bot to bring them all... and with this cliché blind them.

Offline

Wooted by: (2)

#8 2016-09-29 21:10:14

Artistjr5000
Member
Joined: 2016-09-28
Posts: 6

Re: Help with detecting where a block is?

Awww ;c so how would I go about figuring this out? ;-; I really want to learn how to make something like this.

Offline

#9 2016-09-29 21:35:46

capasha
Member
Joined: 2015-02-21
Posts: 4,066

Re: Help with detecting where a block is?

Artistjr5000 wrote:

Awww ;c so how would I go about figuring this out? ;-; I really want to learn how to make something like this.

Isn't there an example code in the readme? The first time I used initparser I looked at the example.

Offline

#10 2016-09-29 22:07:01

den3107
Member
From: Netherlands
Joined: 2015-04-24
Posts: 1,025

Re: Help with detecting where a block is?

capasha wrote:
Artistjr5000 wrote:

Awww ;c so how would I go about figuring this out? ;-; I really want to learn how to make something like this.

Isn't there an example code in the readme? The first time I used initparser I looked at the example.

There is, but when I started off I was also like: "Thafuq am I supposed to do with this?"
Obviously I had my own block objects, and I wanted to receive the block data in a specific manner.
Basically it resulted in me having to read the code and understand it just to make the smallest of changes.

Offline

#11 2016-09-30 02:07:51

XxAtillaxX
Member
Joined: 2015-11-28
Posts: 4,202

Re: Help with detecting where a block is?

W5Y2+ObkCZ.png


signature.png
*u stinky*

Offline

Wooted by: (3)

#12 2016-10-01 17:49:51, last edited by Artistjr5000 (2016-10-01 17:51:58)

Artistjr5000
Member
Joined: 2016-09-28
Posts: 6

Re: Help with detecting where a block is?

Well I got the initparse to work, but now I don't know how to detect blocks placed in the world AFTER the bot connects :I The Struggle. I made a thingy where u can place a block and it keeps moving downward until it reaches another block that was in the world prior to the bot connecting, but it doesn't detect blocks placed after the bot connected ;c Also, when you delete a block that was in the world before the bot, it doesn't detect that the block was removed.

Offline

#13 2016-10-01 17:54:03

XxAtillaxX
Member
Joined: 2015-11-28
Posts: 4,202

Re: Help with detecting where a block is?

Artistjr5000 wrote:

Well I got the initparse to work, but now I don't know how to detect blocks placed in the world AFTER the bot connects :I The Struggle. I made a thingy where u can place a block and it keeps moving downward until it reaches another block that was in the world prior to the bot connecting, but it doesn't detect blocks placed after the bot connected ;c

You need to listen for block messages.
See Everybody Edits Protocol for more information about individual message types and their parameters.


signature.png
*u stinky*

Offline

#14 2016-10-01 18:06:27

Artistjr5000
Member
Joined: 2016-09-28
Posts: 6

Re: Help with detecting where a block is?

Well, I get that part, but do I have to store the block's position in a List or something and remove it when the block is removed?

Offline

#15 2016-10-01 18:11:25, last edited by XxAtillaxX (2016-10-01 18:11:34)

XxAtillaxX
Member
Joined: 2015-11-28
Posts: 4,202

Re: Help with detecting where a block is?

You could, yes.
I would assume you'd be using Linq, and although that isn't extremely performant, you probably wouldn't notice any declination.


signature.png
*u stinky*

Offline

#16 2016-10-01 18:52:05

Artistjr5000
Member
Joined: 2016-09-28
Posts: 6

Re: Help with detecting where a block is?

no idea what linq is

Offline

#17 2016-10-01 18:53:38

SmittyW
Member
Joined: 2015-03-13
Posts: 2,085

Re: Help with detecting where a block is?

XxAtillaxX wrote:

You could, yes.
I would assume you'd be using Linq, and although that isn't extremely performant, you probably wouldn't notice any declination.

Then what is the best way to store points?

Offline

#18 2016-10-01 21:08:49, last edited by XxAtillaxX (2016-10-01 21:09:17)

XxAtillaxX
Member
Joined: 2015-11-28
Posts: 4,202

Re: Help with detecting where a block is?

SmittyW wrote:
XxAtillaxX wrote:

You could, yes.
I would assume you'd be using Linq, and although that isn't extremely performant, you probably wouldn't notice any declination.

Then what is the best way to store points?

I think using a List<T> is perfectly fine.
The only (barely tangible, in most cases) performance costs are from the overhead with Linq iterating over a collection lazily.


signature.png
*u stinky*

Offline

#19 2016-10-01 23:51:31

den3107
Member
From: Netherlands
Joined: 2015-04-24
Posts: 1,025

Re: Help with detecting where a block is?

XxAtillaxX wrote:
SmittyW wrote:
XxAtillaxX wrote:

You could, yes.
I would assume you'd be using Linq, and although that isn't extremely performant, you probably wouldn't notice any declination.

Then what is the best way to store points?

I think using a List<T> is perfectly fine.
The only (barely tangible, in most cases) performance costs are from the overhead with Linq iterating over a collection lazily.

Lel I use a 3D array where obviously the id's of the array are the positions [x,y,layer]. Wonder which one would be faster (Mine probably would cost a whole lot more on memory, not that you'd notice though).

Offline

Wooted by:
den31071475362291626819

Board footer

Powered by FluxBB

[ Started around 1714148749.7792 - Generated in 0.135 seconds, 12 queries executed - Memory usage: 1.67 MiB (Peak: 1.89 MiB) ]