[Update] Script to create ipo

Hi guys,

I would like to know if I can create an ipo curve when I’m runing my game. In fact, I would read a file that contains some informations in order to move my camera and those informations change everytime you launch the game.

thanks

Update is here

what are you trying to do? Is this going to be first person, third person or side scroller if so you dont need to animate the camera at all with the ipo curve editor, just parent it to the object your following and make the object move with the wasd controls, unless your thinking of some thing totaly genius if so please explain further.

I think even in 2.5x the runtime will not be able to access the Blender module.
Without that you will not be able to access the IPO curve.

But I might be wrong

Well,

billymuncher2 it is a first person game.

In fact the movements are predefined, only the order change. So I think that I will make my movements with some ipo curves and with a logic brick I will move my camera or with a script I don’t know now

thanks for the answers

After some research I found that I could activate Actuators with a python script. I will use this solution, but there is also a problem, when I active an Actuators I use

controller = GameLogic.getCurrentController()
actList = controller.actuators
controller.activate(actList[0])

And for deactivating

controller.deactivate(actList[0])

But that doesn’t deactivate my Actuators I don’t know why.

what kind of error message are you getting on the console window?:eyebrowlift:

None, that’s why it’s strange…

This is the whole script


controller = GameLogic.getCurrentController()
obj = controller.owner


actList = controller.actuators

sol = open('solution.txt','r')

def decalage ():
	i = 0
	pos = obj.worldPosition
	posc = obj.worldPosition[0]
	while (posc != pos[0] + 1.0) and i < 2000:
		controller.activate(actList[0])
		posc = obj.worldPosition[0]
		i +=1
	print i
	desactive()
	
def mvt_u ():
	controller.activate(actList[0])

def mvt_l ():
	controller.activate(actList[1])

def mvt_r ():
	controller.activate(actList[2])

def mvt_d ():
	controller.activate(actList[3])
	
def desactive ():
	controller.deactivate(actList[0])
	controller.deactivate(actList[1])
	controller.deactivate(actList[2])
	controller.deactivate(actList[3])
	
"""
 u = up
 d = down
 r = right
 l = left
"""
t=sol.read(1)
while t != '3':
  if t == 'u':
    print obj.worldPosition[0]
    decalage()   
    #mvt_u()
    #print "up"
    print obj.worldPosition[0] 
    print '
'
  elif t == 'l':
    mvt_l()
    print "l"
  elif t == 'r':
    mvt_r()
    print "r"
  elif t == 'd':
    mvt_d()
    print "d"
  else:
    print "error"
  desactive()
  t=sol.read(1)

In fact I want to deplace my object from 1 unit that’s why there is a “decalage” function but this doesn’t work to…

The solution.txt is just “u3” for the tests

Well, one problem is that you are trying to activate and deactivate the same actuator in the same logic tic. You can only do one or the other in one logic tic. If you want to activate it, then deactivate, you must deactivate one tic later (that is, the next time the script runs).