anno1800-scripting-api icon indicating copy to clipboard operation
anno1800-scripting-api copied to clipboard

[Question] Useable as a mod and more options than lua?

Open Serpens66 opened this issue 1 year ago • 2 comments

Hi :) thank you for your work, it looks interesting.

Unfortunately I'm no programmer, so understanding anything from your work by looking at the code is not possible for me :D

But I'm currently "fighting" with lua scripts from Anno 1800 and every day hating the devs that they only exposed so incomplete stuff to lua ( 1) there is setPosition, but no getPosition. 2) I see no way to add/read out ObjectLabels that could be used to mark objects for usage in xml triggers Objectfilter, 3) there is no way to change owner of any object, just of selected, 4) no clue if it is possible to spawn an object in lua, there is a debugspawnobject, but no clue what arguments it expects ... and many many more missing important features).

So I wondered if there really is no better way to write nice scripts for Anno, than to struggle with this incomplete mess of lua :D But it should be properly usable as a mod. So asking the user to install a separate program and to run it next to Anno is no option. .. How does your project work? Would the things I listed above be possible with your scripting api in theory? Would it somehow be possible to install it as a mod, at best with mod.io subscribe feature? Or at least with asking the users to put a custom dll into the games folder, like we did in the past with the modloader?

Btw. Taube lately found out how to calculate AreaIDs and OIDs from the SessionID,AreaIndex,IslandID,ObjectID. Not sure if you also needs such things in your scripting API or if you already knew how to do this.

Serpens66 avatar Mar 03 '24 15:03 Serpens66

Hello, thanks a lot for your question!

thank you for your work, it looks interesting.

Thank you! I have poured a lot of passionate hours into it, so that means a lot!

So I wondered if there really is no better way to write nice scripts for Anno, than to struggle with this incomplete mess of lua :D

That is what the project aims to solve. However, the disappointing part is that my way of doing this is far more labour intensive than using LUA. I have to reverse engineer and understand, at least to some degree, everything that I want to interface with. This is very taxing and therefore slow.

So asking the user to install a separate program and to run it next to Anno is no option.

Then my approach is no good in your case. My solution is to launch a program that injects itself into the game. I have not looked at modding or how they work so it's very likely that it might just be possible. I don't know but I'm not opposed to it in any way.

How does your project work? Would the things I listed above be possible with your scripting api in theory?

Kinda. We'd first have to get over the hurdle of my project having to be a separate program. After that, I've mostly focused on moving ships and reading values from buildings. The things you mention, I have never looked at. It's possible in theory but we'd need way more hands on deck if this project should address that.

Btw. Taube lately found out how to calculate AreaIDs

Yeah I saw that. Quite nice find and useful indeed!

egomeh avatar Mar 03 '24 16:03 egomeh

thank you for the fast response :)

would be great if one could pack the api into a dll :) Since I'm no programmer I have no clue how, but I think it was done eg here: https://github.com/ChrisAnd1998/Anno1800ModMenu (installs a mod menu by just putting/replaces dlls into the game directory) Although not sure if this still works https://www.nexusmods.com/anno1800/mods/491

If this is done I could try to help to find out more. I'm good at finding workarounds and test around, made huge progress in Anno lua to loop through all objects, but I have no clue unfortunately about reverse engineering or hex addresses of whatever this includes :D

Serpens66 avatar Mar 03 '24 19:03 Serpens66