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 Re: Bots and Programming » [Question] Tool for logging placed blocks » 2017-04-16 12:18:04

destroyer123 wrote:
chrisdits wrote:

Something like this?

if (m.Type == "b")
            {
                x = m.GetInt(1);
                y = m.GetInt(2);
                blockid = m.GetInt(3);
                //save to log.txt or something?
            }

That would work for all of the normal blocks, but you might have to do something special for other blocks

I do this:

            switch (m.Type)
            {
                // Other messages
                case "b":
                    world.BlockPlaced(m, 0);
                    break;
                case "br":
                    world.BlockPlaced(m, 4);
                    break;
                case "bc":
                case "bs":
                case "lb":
                case "pt":
                case "ts":
                case "wp":
                    world.BlockPlaced(m);
                    break;
            }

Then I have a BlockPlaced function that gets the values from the message:

        private void BlockPlaced(PlayerIOClient.Message m, int layerPos = -1)
        {
            object[] args = new object[m.Count - (layerPos >= 0 ? 5 : 4)];
            uint id = 0;
            int l = 0;
            int x = 0;
            int y = 0;

            int i1 = -3;
            for (uint i2 = 0; i2 + 1 < m.Count; i2++)
            {
                if (i2 == layerPos)
                {
                    l = m.GetInt(i2);
                    continue;
                }
                
                if (i1 == -3)
                    x = m.GetInt(i2);
                else if (i1 == -2)
                    y = m.GetInt(i2);
                else if (i1 == -1)
                    id = m.GetUInt(i2);
                else
                {
                    args[i1] = m[i2];
                }

                i1++;
            }
            
            // Handle block placement
        }

This might be overkill for some purposes though, so, depending what you are going to use it for, what you described might be enough

Thanks for the help, it was only a bot so i could create some patterns and have a way of saving their blocks into a text document. Got it to work! Thanks!

#2 Re: Bots and Programming » [Question] Tool for logging placed blocks » 2017-04-16 11:21:17

Something like this?

if (m.Type == "b")
            {
                x = m.GetInt(1);
                y = m.GetInt(2);
                blockid = m.GetInt(3);
                //save to log.txt or something?
            }

#3 Bots and Programming » [Question] Tool for logging placed blocks » 2017-04-16 10:54:10

chrisdits
Replies: 4

I'm trying to create a bot however am getting slowed down drawing blocks.

I'm looking to see what would be required to log the X & Y of placed blocks in a level so I can "con.Send("b", 0, 1, 1, 9);" of all blocks in that structure.

A tool used to be available by Buzzerbee (Block Bot - /viewtopic.php?id=682c) however does not seem to work anymore due to everybody edits updates.

I know it probably sounds simple however I am new to C# and the everybody edits protocols and am struggling to do this myself.

Board footer

Powered by FluxBB

[ Started around 1714978211.9192 - Generated in 0.082 seconds, 9 queries executed - Memory usage: 1.23 MiB (Peak: 1.32 MiB) ]