Giter Club home page Giter Club logo

anno1800pythonapi's Introduction

Anno1800PythonAPI

Send python code to Anno 1800 using PyRun_SimpleString.

Usage: Just extract AnnoPythonAPITool.exe and AnnoPythonInject.dll anywhere you like and run AnnoPythonAPITool.exe. Works with or without mod loader.

If Anno is in windowed fullscreen mode you can use F8 to show this window.

How it Works: The GUI application writes the desired code/command to script.lua (this can also be programmed as script.py). After that it injects the AnnoPythonInject.dll into Anno 1800. The injected dll looks for python35.dll and initializes the thread with PyGILState_Ensure. Then sends a command to run our script.lua file using PyRun_SimpleString and after that finalizes the thread with PyGILState_Release. When the dll is finished sending the command it fully unloads itself from Anno 1800.

Screenshot 2022-12-26 114746

anno1800pythonapi's People

Contributors

chrisand1998 avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

anno1800pythonapi's Issues

Program Close on press of Enter or Esc

So I don't think this would be intended behavior.

If you press the Enter key anywhere except for the text dialog on the bottom left. The program exits. I would say enter should mostly be ignored.

If you press the Esc key anywhere the program exits. If possible pressing escape should minimize the window and return control to Anno like F8 does.
It is a bit of a habit to hit it to leave a menu so I find my self hitting it way to often and then scream a bit internally LOL.

Again Thank You for this tool and your time.

Change log?

Can you possibly create a changelog for your updates?

Thank you for you work on this it is really helpful.

Python script does not work?

Issue:
When I execute the commands with "Lua mode" it works, but in "Python mode" the game does nothing. I see that the "script.py" is created, but the game does not accept it it seems.

Questions:
How to print/log/debug properly? Eg. when using "Get" commands I would like to print the result, so I see what each command does. I assume as soon python works, I can use the logging ? But since then, how does logging with lua works? Using "print" with lua does at least not print into the console.

My goal would be to write python scripts to get some game data and start triggers/quests based on that. XML Triggers to fetch some values are not complex enough. So if you are able to sort/purify the Dump data somehow, so python modders can see how to access which function and what values it takes and returns, this would be great :)

edit:
Of course thank you very much for your work :)

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.