getMesh().getVertex().setXYZ() in runtimes/print python

NM, the problem was a few “print” commands I had forgotten about. Aparently they can halt your script when left in an exacutable, even if it seems like some work.

I’m pretty sure i’ve seen a few examples of getMesh().getVertex().setXYZ() being used in a runtime, is there some dll or extention is requires? When I run the script in the program it works perfectly with no errors.
I’ll upload an example if anyone thinks that’s where the problem is. I noticed that setRGBA() works…

Also One sound didn’t work but I suspect that it’s because the script with setXYZ has an error and doesn’t get to the addactuator, anyway please help or show me an example of it working.

It should work, hold on while I test… Yep, vertex.setXYZ() works in runtime.

I just used the default plane and made it run this script:

GameLogic.getCurrentController().getOwner().getMesh().getVertex(0, 0).setXYZ(0, 0, 0)

Then I put the camera above the plane looking down, and saved as a normal runtime. When the game runs, the plane looks like a triangle, (which is exactly what the script should do :stuck_out_tongue: )

Thanks for testing for me, maybe I should upload somthing and see if it is just my comp that doesn’t do it right.

that command doesnt work on objects that have vertex groups or assigned armatures

If you want prints to work okay in a runtime, make a script that is run when the game starts that does this:


import sys
logfile = open("logfile.txt","w")
sys.stderr = logfile   #all errrors will be saved to the logfile
sys.stdout = logfile   #all prints will be sent to the logfile

I’m not sure if you can import sys without python installed, but I think you can. (Seems like you would be able to)

yeah, and how to delete all the text when you start a new game?
sys.stdele = logfile ??

It automatically overwrites the log every time you run it.