Is there an API...

Need help testing contributed art or code or having trouble getting your newest additions into game compatible format? Confused by changes to data formats? Reading through source and wondering what the developers were thinking when they wrote something? Need "how-to" style guidance for messing with VS internals? This is probably the right forum.
Post Reply
Geri
Star Pilot
Star Pilot
Posts: 4
Joined: Fri Jan 18, 2013 4:17 pm

Is there an API...

Post 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
klauss
Elite
Elite
Posts: 7243
Joined: Mon Apr 18, 2005 2:40 pm
Location: LS87, Buenos Aires, República Argentina

Re: Is there an API...

Post 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
Oíd mortales, el grito sagrado...
Call me "Menes, lord of Cats"
Wing Commander Universe
Geri
Star Pilot
Star Pilot
Posts: 4
Joined: Fri Jan 18, 2013 4:17 pm

Re: Is there an API...

Post 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...
klauss
Elite
Elite
Posts: 7243
Joined: Mon Apr 18, 2005 2:40 pm
Location: LS87, Buenos Aires, República Argentina

Re: Is there an API...

Post 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.
Oíd mortales, el grito sagrado...
Call me "Menes, lord of Cats"
Wing Commander Universe
Geri
Star Pilot
Star Pilot
Posts: 4
Joined: Fri Jan 18, 2013 4:17 pm

Re: Is there an API...

Post 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?
klauss
Elite
Elite
Posts: 7243
Joined: Mon Apr 18, 2005 2:40 pm
Location: LS87, Buenos Aires, República Argentina

Re: Is there an API...

Post by klauss »

Ship's cargo = store items
Oíd mortales, el grito sagrado...
Call me "Menes, lord of Cats"
Wing Commander Universe
Geri
Star Pilot
Star Pilot
Posts: 4
Joined: Fri Jan 18, 2013 4:17 pm

Re: Is there an API...

Post 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
Post Reply