Open seynax opened 2 years ago
Hi @seynax, did you figure it out yet? I am at the same spot as you. Even a simple script like this one: https://github.com/ChrisAnd1998/Chris-s-Anno-1800-Mods/blob/main/%5BInterface%5D%20UI%20Scale%2070%20percent/start_script.py does not seem to work even tho the logs claim it ran.
Hello, no I haven't made any progress, it seems that the script is not loaded as the logs claim, I have not been able to find in the commit history what changed the functioning of scripts loading.
Here is the code that seems to load the python scripts: https://github.com/xforce/anno1800-mod-loader/blob/652964c4f24275e1bd0a0ac322fad4f370dc5c42/libs/external-file-loader/src/mod_manager.cc#L86 It picks up the path to the script, shows in the logs that it's loaded, sets it aside but never seems to use it...
for the moment I'm working on a new API+modloader (C# scripts, and python in the future) with Egomeh (https://github.com/egomeh/anno1800-scripting-api)
Despite everything I continue to search, if you ever have a idea to submit to me or some new elements do not hesitate!
Have a good day.
I saw your project earlier, but since I am running Linux, I can't use it (I think?!), hence the importance of getting this one here running. However your message helped me to figure out a temporary solution. You need to install this mod: https://github.com/ChrisAnd1998/Chris-s-Anno-1800-Mods/tree/main/%5BCheat%5D%20Show%20Console
Then when you load a game you open the console and then you type:
console.startScript('mods\\YourModFolder\\start_script.py')
For me that starts the script.
Thanks a lot and have a nice weekend!
Hello, no I haven't made any progress, it seems that the script is not loaded as the logs claim, I have not been able to find in the commit history what changed the functioning of scripts loading.
Here is the code that seems to load the python scripts:
It picks up the path to the script, shows in the logs that it's loaded, sets it aside but never seems to use it... for the moment I'm working on a new API+modloader (C# scripts, and python in the future) with Egomeh (https://github.com/egomeh/anno1800-scripting-api)
Despite everything I continue to search, if you ever have a idea to submit to me or some new elements do not hesitate!
Have a good day.
It is used. Scripts are loaded here https://github.com/xforce/anno1800-mod-loader/blob/adbffc03b80100b9d80742e84a2399cbf5ddaa93/libs/python35/src/python.cc#L22 Though they have been doing A LOT of script engine rework. mostly transitioning to Lua in recent anno updates, so it's possible that things changed and this isn't called anymore by the game.
https://github.com/xforce/anno1800-mod-loader/pull/200 Here is a PR for fixing that.
Hi all,
I'm sorry for not having answered sooner, I had not seen the messages.
I thank everyone for having sought / proposed solutions.
And I apologize to the xforce team, I must have misinterpreted what caused the script to not run.
I will test everything soon as soon as I can I will let you know.
thank you, have a good day !
Hello,
I am contacting you, because I would like to know if your mod loader allows really executing python scripts to modify the game. It doesn't seem to work ...
The modloader specifies in the "mod-loader.log" log document that the script "start_script.py" is "loaded", but it never gets executed, i.e. no matter what I write to it, nothing is produced, so much so that even if I write something completely foreign to python, the game and the modloader do not crash... Indeed, by analyzing the source code of the mod loader j Seems it never executes the script it loads.
_I had did understand, however, that some had had success in the past getting python scripts to work for Anno 1800.
Here is the link to the feedback I gave to Nick11 on his project: https://github.com/Nick11/anno1800_python_api_prober/issues/3_
Thank you in advance for your answers,
Have a nice day,