I figured I'd implement a few functions for people to play around with.
There are three modules; you gain access to them by use of "import module". Then you can call the functions with "module.function()"fs2 - general
getState(depth) - Gets the current game state string; depth is for example if you have the options screen going while in a game too.
getViewerMode() - gets the viewer mode (in cockpit, outside cockpit), this is an integer b/c the way FS2 does it is it sets each bit depending on viewer mode. If its 0 then it means in-cockpit basically gr - 2D graphics
setColor(red, green, blue, alpha) - Sets the current drawing color
drawLine(x1, y1, x2, y2) - draws a line from x1, y1 to x2, y2 in the current color
drawString(x, y, string) - writes the string to the specified position
drawImage(x, y, imagefilename) - draws the image at the specifed positionshp - ships
getClass(shipname) - Gets the class (string) of the specified ship
getTarget(shipname) - Gets the target (ships only for now) of the specified ship
getShields(shipname) - Gets the shield strength of the specified ship
getHull(shipname) - Gets the hull strength of the specified ship
getPlayer() - Gets the player ship name
Sample table (python.tbl):
;;You can have more than one $Python, they are run sequentially
That will import all the modules and draw the medical ship concept art in the corner of _every_ FS2 screen.
If, for example, you wanted to draw the concept art in just the tech room:
if fs2.getState() == "GS_STATE_TECH_MENU":
Note that this is just a test, ifI were to do it properly I'd make a 'ship' class that you could play with. But I'm a bit unclear on using classes like that.
All this stuff is surprisingly reliable for something I coded, you should be able to screw stuff up without crashing FS2. Oh, and it won't tell you about parse errors yet, so if your code isn't working double-check it for them.