UPDATE!!!
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 - generalgetState(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 graphicssetColor(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 position
shp - shipsgetClass(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
$Python: {
import gr
import fs2
import shp
gr.drawImage(1,1,"crim00")
}
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:
$Python: {
import gr
import fs2
import shp
if fs2.getState() == "GS_STATE_TECH_MENU":
gr.drawImage(1,1,"crim00")
}
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.
EXE:
http://fs2source.warpcore.org/exes/latest/fs2_open_ex.zip