Strange IPO delay using Python [solved by Haker23]

1 EXAMPLE
logic brick settings = Play ; Sta1 ; End11

if sen: 
    controller.activate("act") 

2 EXAMPLE
logic brick settings = Play ; Sta1 ; End1

if sen: 
        act.mode = 1
        act.frameStart = 1.0 
        act.frameEnd = 11.0
        controller.activate("act")

When i trigger sensor, IPO animation plays instantly and that’s OK(1 Example). But strange delay appears when I want to set all parameters manually with Python(2 Example). Then I have to trigger sensor twice, before it plays?!? Why?

Have you checked when the script is launched? That might be the problem if the script arent continuously updated.

Hmm I’m afraid I don’t understand what you exactly mean saying: “continuously updated”. I trigger sensor when the key is pressed. What else can I do?

BTW

sen = controller.sensors["sensor"].positive

sensor launches script

Try taking your last line (where it activates the actuator) out of the nest (remove the indentation on the line)… (make sure your IPO actuator (apparently, we have to say F-curves now, but I refuse! :D) is set to something that is negligible like start: 1 and End:1 in the logic bricks, so that if the properties aren’t changed, it won’t go haywire)

hope this helps :smiley:


if sen: 
        act.mode = 1
        act.frameStart = 1.0 
        act.frameEnd = 11.0
controller.activate("act")

WOW it works! Thanks :slight_smile:
Now I have to think what have just happend :wink:

The line was only executed if the sensor was active when the script was activated, hence the need to double activate (one to start the script, one to execute the line) but without the if statement, the actuator is activated whenever the script is activated… :smiley: