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.
Im currently making a bot. But the problem is I need to manually replace the blocks since I don't know how to make a replace command.
Any help would be nice.
save the blocks from init, reset and added blocks
Then you can do a for loop through x and y, and search if the id you want to replace exists.
Then send the message with the block information to replace. The best way would be to thread the function there you have the for loop.
save the blocks from init, reset and added blocks
Then you can do a for loop through x and y, and search if the id you want to replace exists.
Then send the message with the block information to replace. The best way would be to thread the function there you have the for loop.
You may wish to use Processor's InitParse to do that
Threading is the easy way. If you manage to figure out a timer, even better.
Folks, how should we do that? I could see having the tick simply do the search for the ID over again until none left. Should it be that way, or should it find them all once, record those in a collection, and tick them off?
They have slightly different results, but what's the 'better' approach (something I haven't thought of?)
Threading is the easy way. If you manage to figure out a timer, even better.
Folks, how should we do that? I could see having the tick simply do the search for the ID over again until none left. Should it be that way, or should it find them all once, record those in a collection, and tick them off?
They have slightly different results, but what's the 'better' approach (something I haven't thought of?)
Depends. Can the room change while you're replacing stuff?
Why am I asking?
Imagine you'd first gather everything in a collection and then tick them off from that.
What if somebody removes one of the blocks in your list? Then you'll replace one faulty or do a replace that has actually no effect.
By searching for (a single (performance)) block every "tick", you will eliminate those problems, you'd have to think of a way to replace blocks at random though, in case that matters (doesn't look very pretty when you start from the top and then slowly work down instead of replacing blocks "randomly").
Off-topic edit: Loving my avi.
Edit edit: I don't know why I didn't post as den3107.
Sauerkraut40 wrote:Threading is the easy way. If you manage to figure out a timer, even better.
Folks, how should we do that? I could see having the tick simply do the search for the ID over again until none left. Should it be that way, or should it find them all once, record those in a collection, and tick them off?
They have slightly different results, but what's the 'better' approach (something I haven't thought of?)
Depends. Can the room change while you're replacing stuff?
Why am I asking?
Imagine you'd first gather everything in a collection and then tick them off from that.
What if somebody removes one of the blocks in your list? Then you'll replace one faulty or do a replace that has actually no effect.
By searching for (a single (performance)) block every "tick", you will eliminate those problems, you'd have to think of a way to replace blocks at random though, in case that matters (doesn't look very pretty when you start from the top and then slowly work down instead of replacing blocks "randomly").Off-topic edit: Loving my avi.
The way I deal with room changes is listening for "b" messages
If a block is placed, a "b" message is generated with all the information you need to update your worldBlockDictionary (or whatever other storage ADT you decided to use)
Threading is the easy way. If you manage to figure out a timer, even better.
Folks, how should we do that? I could see having the tick simply do the search for the ID over again until none left. Should it be that way, or should it find them all once, record those in a collection, and tick them off?
They have slightly different results, but what's the 'better' approach (something I haven't thought of?)
Add blocks to a list from all threads,
have 1 thread that uses foreach on the list that keeps going around and around delegating each block to a bot (can be used with multiple bots in the same world - that's what I use it for) - optional timer (I have mine set to 1 with 6 bots on a server - will need to experiment)
when a block placement message has been received - remove the item matching it from the list. Edit: you can use https://forums.everybodyedits.com/viewt … p?id=35726 and trigger when your world blocks array is changed.
You will now have a system that will have flawless block placement.
Ugh, why are these topics anon...
Just annoys me.
Ugh, why are these topics anon...
Just annoys me.
For a beginning programmer this is a little bit legit question.
It's also a bit harder to think of what to google for, since you have to pull it up into an abstracter level, which for many people isn't very easy.
Many other questions indeed are a bit annoying though as those are much more generic.
~Den3107
Lawful_lecher wrote:Ugh, why are these topics anon...
Just annoys me.For a beginning programmer this is a little bit legit question.
It's also a bit harder to think of what to google for, since you have to pull it up into an abstracter level, which for many people isn't very easy.
Many other questions indeed are a bit annoying though as those are much more generic.~Den3107
they didn't ask why they were asking this. They were asking why they set it to anonymous.
Sauerkraut40 wrote:Threading is the easy way. If you manage to figure out a timer, even better.
Folks, how should we do that? I could see having the tick simply do the search for the ID over again until none left. Should it be that way, or should it find them all once, record those in a collection, and tick them off?
They have slightly different results, but what's the 'better' approach (something I haven't thought of?)
Add blocks to a list from all threads,
have 1 thread that uses foreach on the list that keeps going around and around delegating each block to a bot (can be used with multiple bots in the same world - that's what I use it for) - optional timer (I have mine set to 1 with 6 bots on a server - will need to experiment)
when a block placement message has been received - remove the item matching it from the list. Edit: you can use https://forums.everybodyedits.com/viewt … p?id=35726 and trigger when your world blocks array is changed.You will now have a system that will have flawless block placement.
-Koya
I, too, usually use dedicated threads. However, we've discussed (and referred to 1337 legit stackkoverflow pages) how taking a thread and tying it up with Thread.Sleep is a no-go.
So I figure we could discuss the "best practice" even though it doesn't apply to me...
Theres no shame in asking questions why is this anon?
Theres no shame in asking questions why is this anon?
He might be the one who said that he was going to do anon and maybe reveal himself later. But that's just a guess
-fr0g
You could also use botbits to loop through each block and check the id.
You could also use botbits to loop through each block and check the id.
Am I the only one that refuses to use botbits?
(it was suggested when I started making EE bots)
weird witch wrote:You could also use botbits to loop through each block and check the id.
Am I the only one that refuses to use botbits?
(it was suggested when I started making EE bots)
Nah, I make as much as I can myself. Obviously I do use EEPhysics though (when needed).
~den3107
weird witch wrote:You could also use botbits to loop through each block and check the id.
Am I the only one that refuses to use botbits?
(it was suggested when I started making EE bots)
I don't use botbits. I tried it and I didn't think it was very "noob-friendly"
I don't see a reason to have this topic opened. Everyone have written how to make it.
Maybe the owner want to be spoon feeded.
You could get faster replacing (after more initial processing) by saving all block positions in a Dictionary<int, List<Point>> with the block ID as the key.
~ Tomatohawk
You could get faster replacing (after more initial processing) by saving all block positions in a Dictionary<int, List<Point>> with the block ID as the key.
~ Tomatohawk
Strangely enough I'd do it the other way round,
Dictionary<Point, Block> blockData = new Dictionary<Point, Block>();
where:
Point's overriden EQUALS is defined in terms of (this.x == that.x && this.y == that.y)
Block is a structure containing, among others, a field with int id.
EDIT:
Pros of your method: Faster replacement of all the blocks of one kind
Cons: No clear picture of the whole Block Data in the world
hey on that note
-- oh tomatohawk I hadn't considered that. The setup there allows for multiple replace things at once. useful (right?)
I'm not sure if this is offtopic. If all we want to do is check off a list of blocks to swap, without needing to really "Key" anything, is there any considerable benefit by using List<Tuple<2 values>> over Dictionary<Key, value>? I figure there'd be something said for not processing keys in the List, but perhaps we never get to that limit
You could get faster replacing (after more initial processing) by saving all block positions in a Dictionary<int, List<Point>> with the block ID as the key.
~ Tomatohawk
My main problem with that it's unnecessary.
Dictionary<int, List<Point>> Dict1 = new Dictionary<int, List<Point>>();
foreach (KeyValuePair kv in Dict1) {
foreach (Point p in kv.Value) {
//send kv.Key to {p.X, p.Y}
}
}
against
Dictionary<Point, int> Dict2 = new Dictionary<Point, int>();
foreach (KeyValuePair ky in Dict2) {
//send ky.Value to {ky.Key.X, ky.Key.Y}
}
or
List<Tuple<Point, int>> List1 = new List<Tuple<Point, int>>();
foreach (Tuple<Point, int> t in List1) {
//send t.Item2 to {t.Item1.X, t.Item1.Y}
}
EDIT: formatting
I don't see a reason to have this topic opened. Everyone have written how to make it.
Maybe the owner want to be spoon feeded.
I don't like spoon-feeding. I only ask in the forums when I'm actually lost.
australian_abyss wrote:I don't see a reason to have this topic opened. Everyone have written how to make it.
Maybe the owner want to be spoon feeded.I don't like spoon-feeding. I only ask in the forums when I'm actually lost.
Pretty sure google would be more helpful. Unless it's EE-specific
Pretty sure google would be more helpful. Unless it's EE-specific
As I mentioned earlier, this would be a bit harder to google as you have to think a little bit abstract, which is generally the hardest part of programming (thinking abstract).
[Cut away stuff]
My main problem with that it's unnecessary.
[Cut away stuff]
Ever thought why in the init message a single block id is sent and after that all points they occur at? Less resources + the searching would actually go faster. Instead of going through the entire dictionary searching for all the blocks, you can instead give the block id (see how I don't use the word search?) and get all positions related to it.
The reason why a Dict would be smarter than a list with Tuples is again speed (and probably resources and a little bit of code clarity), though all of what I just said can just be wiped away since our current PCs are fast enough and I doubt any bot will really require such kinds of micro optimizations, but it's nice to know either way.
P.S. I actually don't do these things (the dict stuff) myself because I'm too dumb and don't think about it (and other things).
[ Started around 1732738735.4853 - Generated in 0.164 seconds, 12 queries executed - Memory usage: 1.77 MiB (Peak: 2.02 MiB) ]