Coping position with scripts?

I took someone’s skybox script, probably it’s Saluk’s, and modified the SetRotation part with SetPosition, it worked ALMOST perfect, for the little problem of 1 frame delay due to messages. Now, I decided to copy the position of one object into a property (OB:Daddy) and made the second object (OB:Follower) copy that property into one of his properties (did that make sense?). And make the script interpret the string property which contains the coordinates, but… python doesn’t understand what I’m asking it to do when i put:

"setposition(us.position)"

And, as I’m not a python expert, I just fiddle around with other’s simple scripts into something I need, I need help.

http://guble.tripod.com/pos_copy.zip
There’s my crappy thing.
“What do I need to add to the script?”

If my method is completely wrong, then this is the question:
“How can I copy the position of one object into another, WITHOUT the frame delay?”

THANX THANX

-Me

The frame delay occurs because python scripts are executed outside of time from the game, not because of anything wrong with the script. Your method sounds like its way too complicated, and is only going to add more delay. What you can do, is a cross scene parent, to get a skybox with no delay. Just a second here while I try and remember how to make a cross scene parent:)

(I can never remember how to do stuff, always got to fiddle around a bit to remember.)
Hmm, after fiddling, I can’t figure out how to do it. It seems cross scene parents may not be possible. So you have one of three options: put the skybox in the same scene and use vertex parenting to parent the skybox to the camera (vertex parent with ctrl-alt-p) and you wont need any python; or use the python you were using before and deal with the delay.

Or if you like, on the skybox scene, use an empty that has the same control logic as the player with the scene’s camera situated at the same place behind the empty as the camera is on your normal scene. Then when you move the camera around on one scene, you’ll also be moving the duplicate camera the same as it has the same logic. I recomend this method, unless you are using the faulty camera actuator, in which case this method wont work too well.

:-? jeez… you know… python scares me… alot of programming scares me… I hope I can get into the video game biz, without alot of programming knowledge…

I envy folks who can work with it… you should be proud of yourselves;)
I’d rather pick apart the logicbricks in the “when logicbricks get hairy” thread, than try to dissect the work you guys seem to do with only a little hindsight.

just a little opinion from me, buh bye. :smiley:

A little hindsight? Hehehe. It comes from roughly 6 years of programming experience. I definately don’t feel very confident programmingwise, but I’ve been around programming for a very long time. Before I could program myself, I watched my dad program in c++, and java. I did a lot of weak programming on my graphics calculator back in the day, and I’ve been dinkying around programming python in gameblender ever since they first implemented it. :slight_smile:

Some things you can learn from tutorials, most you just have to learn by doing. Logic bricks by the way are a fairly good way to start to learn programming, because they are easy and can teach you some of the basics (if statements and variables namely). Programming may seem weird and confusing, but it’s not all that different from say, learning a foreign language. Which I am bad at for some reason, but I can handle programming.

Anyway, thanks SeaCigar for the ego boost:)

And Fred, sorry I misinterpreted your question, hehe. It’s a lot easier to answer, but I think the frame delay will still be there. I actually downloaded your file this time (imagine that?) and the problem is the format the position is saved in. In your script, Send.Position, you are saving the x position as a string to the object. In the script S.P, you are trying to set the position using just that x value, still in string form. To convert the value into a number, you use the eval command, like “eval(us.position)”. But this wont solve your problem, because the setPosition() command requires an x, y, and z value. The easiest way to fix, is to add these lines above the setPosition command in S.P:


ourpos = us.getPosition()  #Get our current position to use for the y and z values

Then change the setPosition line thusly:
us.setPosition([eval(us.position),ourpos[1],ourpos[2]])

the setposition command works like this: object.setPosition([x value, y value, z value]), and the us.position (which is the x value) needs to be turned into a number from a string with the eval command.

Get back to me if it still doesn’t work or if you have any questions on why it works this way.

Good luck!

I HATE YOU SALUK, I HATE YOU SALUK!
just repeat that ten times everyday…
I HATE YOU SALUK, I HATE YOU SALUK!
:stuck_out_tongue:

Hahahahaha.

I hate you too Joecool. I hate you too. :slight_smile: