ChrisAnd1998 / Anno1800PythonAPI

Send python code to Anno 1800 using PyRun_SimpleString.
8 stars 0 forks source link

Python script does not work? #3

Open Serpens66 opened 1 year ago

Serpens66 commented 1 year ago

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 :)

Serpens66 commented 1 year ago

Ah, the prefilled commands simply do not work in python.

Does not work:

#Toggle super ship speed
ts.Cheat.GlobalCheats.ToggleSuperShipSpeed()

Does work:

#Toggle super ship speed
import Anno6, TextSources
TextSources.TextSourceRoots.Cheat.GlobalCheats.ToggleSuperShipSpeed()