Code Monkey home page Code Monkey logo

Comments (4)

happyleavesaoc avatar happyleavesaoc commented on July 25, 2024 1

Should not have to worry about the specific construct types -- they all offer easy access properties. For example, if you're using parse_stream to get the next body operation, you can do print(op) and get something like this:

Container:
    type = action (total 6)
    start = 148916
    op = 1
    length = 32
    action = Container:
        type_int = 3
        type = move (total 4)
        player_id = 1
        selected = 3
        x = 70.44791412353516
        y = 101.28125
        next = }\x07\x00\x00\x7f\x07\x00\x00 (total 8)
        flags = None
        unit_ids = ListContainer:
            1917
            1919
            1923
    end = 148960

This shows you what fields are available for the operation. If you wanted to access the unit_ids list, it would be like this: op.action.unit_ids and you would get a list.

from aoc-mgz.

happyleavesaoc avatar happyleavesaoc commented on July 25, 2024

Construct 2.10 is not compatible with aoc-mgz. Use the version specified in setup.py. Embedded is not available in construct 2.10, and this module makes extensive use of that feature so we're stuck in 2.8.16 for now.

Does this answer your question?

from aoc-mgz.

cjds avatar cjds commented on July 25, 2024

Not really. I was saying that I can't figure out how to make use of the body because I can't find any docs on how to use Embedded struct anywhere.

If you could provide an example of how to access the data after parsing the stream, it would be very useful

from aoc-mgz.

cjds avatar cjds commented on July 25, 2024

That's perfect. I was doing dir(op) for ages trying to figure out what was avaialable.. Appreciate it :-)

from aoc-mgz.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.