ScriptingContext from AI

Programmers discuss here anything related to FreeOrion programming. Primarily for the developers to discuss.

Moderator: Committer

Post Reply
Message
Author
User avatar
Grummel7
Space Dragon
Posts: 335
Joined: Mon Oct 09, 2017 3:44 pm

ScriptingContext from AI

#1 Post by Grummel7 »

freeOrionAIInterface.pyi defines the following:

Code: Select all

class policy:
    ...
    def adoptionCost(self, number: int, obj: object) -> float: ...
The obj should be a ScriptingContext, but how do I supply one from the AI?

User avatar
Geoff the Medio
Programming, Design, Admin
Posts: 13587
Joined: Wed Oct 08, 2003 1:33 am
Location: Munich

Re: ScriptingContext from AI

#2 Post by Geoff the Medio »

You can't. The way the function is exposed to Python needs to be fixed, and presumably the stub regenerated, though I'm not sure how to do that.

Does https://github.com/freeorion/freeorion/ ... api_tweaks work?

User avatar
Cjkjvfnby
AI Contributor
Posts: 539
Joined: Tue Jun 24, 2014 9:55 pm

Re: ScriptingContext from AI

#3 Post by Cjkjvfnby »

Geoff the Medio wrote: Fri Feb 11, 2022 8:54 am though I'm not sure how to do that.
Here are the docs.
https://github.com/freeorion/freeorion/ ... -skeletons
If I provided any code, scripts or other content here, it's released under GPL 2.0 and CC-BY-SA 3.0

Post Reply