Page 1 of 1

Is there an API...

Posted: Fri Jan 18, 2013 4:23 pm
by Geri
...to access live data of a running universe? (e.g. available items in a store I'm currently in)

I'm thinking of enhancing my on-board computer(s) with some external add-ons.

Regards
Geri

Re: Is there an API...

Posted: Fri Jan 18, 2013 5:37 pm
by klauss
There is one, but it's only invokable by base and mission scripts. It's the savegame API, everything is stored in various ways inside the savegame.

You may want to check dynamic_universe.py and trading.py

Re: Is there an API...

Posted: Sat Jan 19, 2013 10:25 pm
by Geri
Thanks for the info. Does that mean every time I enter a store getImports() in trading.py (or rather trading.pyc) is executed and if I...

- create my_trading.py
- insert code to write prodlist to a file (or wherever) there
- compile my_trading.py to trading.pyc, thus replacing the original

...I can achieve what I want to?

PS: Unfortunately, despite of knowing almost a dozen of programming languages, I'm not skilled in Python at all. But, it's just another language, after all. Maybe it's the right time starting to deal with it...

Re: Is there an API...

Posted: Sun Jan 20, 2013 12:44 am
by klauss
No, it's more like a background-running script that updates the economic status of the universe while you play. When ships are spawned, this computed inventory is loaded as cargo, which is what you can see on the trade interface when you dock.

Re: Is there an API...

Posted: Sun Jan 20, 2013 7:41 pm
by Geri
You mean trading.py is for the ships' cargo and not for the store items? What is trading.py then good for what I would like to do?

Re: Is there an API...

Posted: Sun Jan 20, 2013 10:54 pm
by klauss
Ship's cargo = store items

Re: Is there an API...

Posted: Sun Jan 20, 2013 11:09 pm
by Geri
I see. Just a definition/communication problem. ;-)

With "ships' cargo" I meant the goods I'm carrying around with my ships.
With "store items" I meant the goods available in a base's store (a.k.a. Cargobay)

Thx