Forum: Poser Python Scripting


Subject: ImportError: No module named poser

GWeb opened this issue on Jan 06, 2005 ยท 14 posts


trobbins2 posted Tue, 11 January 2005 at 11:47 AM

Actually the socket programming is pretty much done - it's getting used to python's syntax that is giving me fits at the moment.. lol..

But not to worry, the first revision will probably be a bit kludgy but it should work once I'm through.

I've got the client talking to the server and sending it commands, and the server processing the commands and then sending data back to the client. Just need to get all the commands defined, and then come up with a code interface for sending/recieving commands. So far I'm just using a couple of small functions for it. So if you wanted, for example, to get the value of poser python variable for ActorType and store it in a local variable called ActorType for your program to use, all you'd have to do is enter the command:

Actortype = GetPoserData("ActorType")

That's it. The function sends the request to the server, the server processes it, gets the appropriate value and returns it to the function, in this case setting the variable ActorType equal to the result. This should allow for a minimum of rewrite on already written scripts, you don't need to change variable names, just call one function to get the data needed from poser.

Same with setting variables or running an internal command, each is just a single function, so the whole client consists of some rather minor (I think 30-40 lines of code so far) coding and 3 functions. One to get the value of a poser variable, one to set the value of a poser variable, and one to send it other commands like the Kevent codes or similar items. Any data output from these commands is then reflected back to the client, again trying to keep the functions as simple as possible so that if you've already written a script for poser python recoding it will be as easy as possible, just adding a few lines here or there to access posers internal python functions and variables.

Just drudging through this blasted syntax.. lol.. haven't done any programming in a while and learning python as I go. In other words the first revision might not be the prettiest thing, but it should be functional... lol..