I'm trying to write a tutorial for newcomers. It's also for my own good, since I get good experience out of it. My goal is to translate several of the tutorial programs that come with CS into Python scripts. Other people would probably be more qualified, but it needs to be done, so I'll do my best. The tutorial would be a line-by-line comparison between the two languages so that new users can see how to build their own programs in Python.
Right now, I'm working on a translation of the isotest program. I've gotten pretty far, but I've run into an odd snag. Specifically, it appears that you can't create a light in Python. Here's the chunk of code:
try:
actor_light=self.engine.CreateLight(0, csVector3(-3,5,0), 5, csColor(1,1,1))
except:
msg=traceback.format_exc()
csReport (object_reg, CS_REPORTER_SEVERITY_ERROR,"crystalspace.application.isotest",msg)
NOTE: for new Python users. It took me a long time to figure out a proper debug method in CS. I'm accustomed to just printing and reading error messages in the terminal window. If you haven't found your own method, the try/except clause above works quite well.
I hope someone can help me. When I run the program, it fails to create the light. It also gives a very odd traceback message:
File "C:\CS\isotest.py", line 143, in LoadMap
actor_light=self.engine.CreateLight(0,csVector3(-3,5,0),5,csColor(1,1,1))
File "C:\CS\cspace.py", line 4269, in CreateLight
def CreateLight(*args): return _cspace.iEngine_CreateLight(*args)
NotImplementedError: No matching function for overloaded 'iEngine_CreateLight'
As said above, I'm probably not the best man for the job, because I don't know what to do about this. It sounds like cspace.py doesn't have a proper function for iEngine.CreateLight. However cspace.py was built by SWIG wasn't it? Any ideas?