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.
Pages: 1
Using world data, how do i check if a block is replacing another block?
You do not have to give me code but please like give a hint like the path i should go.. If this makes sense.
Offline
I guess you are talking about init worlddata? Store them as arrays then check if a block get placed over the array from the "b", "br" and so on.
Offline
To maintain 100% accurate mapdata you need to listen for all block types.
Currently that's "b", "bc", "br", "bs", "ts", "pt", "wp" and "lb".
Get the coordinate of any block received from those types and put its details into the same coordinate in the mapdata, making sure to also store any additional parameters like rotation.
Additional stuff:
You should take care where in OnMessage you update your mapdata. If you do it right at the start, then send a block in "b", your mapdata is essentially out of date until the message for that block returns. If, for instance, you have a bunch of moving blocks in "b", your mapdata will remain one "frame" behind the actual block positions. This can cause problems when you need the mapdata for something else. Also keep in mind that as blocks can now be sent with almost no delay, a block moving really quickly can be several places away from where the mapdata thinks it is due to the delay in receiving messages.
In certain cases it's worth it to manually update the mapdata when you send a block (or very slightly after). It's a bit risky because there's always a chance that the block won't get placed, but now that the serverside doesn't meddle with placement speeds you can be fairly sure it'll get there.
One bot to rule them all, one bot to find them. One bot to bring them all... and with this cliché blind them.
Offline
It's lots of boring work, I wish it was all in the "b" message.
Let me find some code to post here.
Offline
It's lots of boring work, I wish it was all in the "b" message.
Well, no! You would still need to do a lot of work with just "b" message.
You would need a list of blocks so you can get accruent data from the block id. So it's even worse.
Offline
Offline
Do you mean blocks placed by the bot or blocks placed by players, and will you need to know what the blocks are?
Depending on this, a lot of these solutions might not work, or might be overcomplicating it.
Edit: I thought of a few more things:
What exactly do you mean by replaces a block?
Can both players and the bot place blocks?
Do you mind about possible synchronisation issues?
Do you mind about small delays after placing blocks before they are registered as there?
Offline
Do you mean blocks placed by the bot or blocks placed by players, and will you need to know what the blocks are?
Depending on this, a lot of these solutions might not work, or might be overcomplicating it.Edit: I thought of a few more things:
What exactly do you mean by replaces a block?
Can both players and the bot place blocks?
Do you mind about possible synchronisation issues?
Do you mind about small delays after placing blocks before they are registered as there?
I meant like if a player tries to replace my basic block [9] or any block with a different block. It keeps the block i placed. Same with everyone else.
Offline
destroyer123 wrote:Do you mean blocks placed by the bot or blocks placed by players, and will you need to know what the blocks are?
Depending on this, a lot of these solutions might not work, or might be overcomplicating it.Edit: I thought of a few more things:
What exactly do you mean by replaces a block?
Can both players and the bot place blocks?
Do you mind about possible synchronisation issues?
Do you mind about small delays after placing blocks before they are registered as there?I meant like if a player tries to replace my basic block [9] or any block with a different block. It keeps the block i placed. Same with everyone else.
So... If a player places a block on top of an already existing block, the bot replaces it with the old block?
Can players replace their own blocks?
Offline
So... If a player places a block on top of an already existing block, the bot replaces it with the old block?
Can players replace their own blocks?
As he mentions. When anybody places a block over any block italkalotfromee placed, the placement is reverted.
So yes, people can replace their own blocks, but nobody can replace the blocks of somebody else.
Offline
destroyer123 wrote:So... If a player places a block on top of an already existing block, the bot replaces it with the old block?
Can players replace their own blocks?
As he mentions. When anybody places a block over any block italkalotfromee placed, the placement is reverted.
So yes, people can replace their own blocks, but nobody can replace the blocks of somebody else.
That could also mean including themselves though, either could be useful depending on what they want to use the bot for.
Thats a good point actually, if you can tell us what youre trying to use the bot for, we might be able to work out some of the answers to the questions
Offline
So... If a player places a block on top of an already existing block, the bot replaces it with the old block?
Can players replace their own blocks?
1. Yes. [I want the method of this so i can experiment with other things around this fundamental idea.]
2. Yes.
Offline
Ok... So... I think that should be enough info
To do this, you will need to keep an updated record of the world, including all the args and the player that placed the blocks
The first step would be to parse the world, I guess using some world parser someone has made, I think there have been a few suggested above.
You will then need to store this in an array, so I would suggest making a struct to store what you need (id, args, player id), for the parsed world, I guess using pid -1 for blocks that have been there since you joined the world.
You will then need to handle all the block messages, and if the pids are not the same (and id is not zero), replace the previous block, and if they are, update the block in the array. (Ignore blocks placed by the bot)
I think if you do it this way, the world will stay synchronised (desynchronisation can be a huge problem, and could effectively allow people to bypass the block checker thing if you're not careful)
Offline
Ok... So... I think that should be enough info
To do this, you will need to keep an updated record of the world, including all the args and the player that placed the blocksThe first step would be to parse the world, I guess using some world parser someone has made, I think there have been a few suggested above.
You will then need to store this in an array, so I would suggest making a struct to store what you need (id, args, player id), for the parsed world, I guess using pid -1 for blocks that have been there since you joined the world.
You will then need to handle all the block messages, and if the pids are not the same (and id is not zero), replace the previous block, and if they are, update the block in the array. (Ignore blocks placed by the bot)I think if you do it this way, the world will stay synchronised (desynchronisation can be a huge problem, and could effectively allow people to bypass the block checker thing if you're not careful)
Thanks for the help.
Offline
Pages: 1
[ Started around 1732968987.5541 - Generated in 0.106 seconds, 13 queries executed - Memory usage: 1.64 MiB (Peak: 1.86 MiB) ]