Two veeerrrrryyyy simple Q's

  1. How do I write ‘play this ipo’ in GameLogic?
  2. Could anyone point me to the recent changes that have been made to GameLogic?


By GameLogic do you mean logic bricks or python? since GameLogic is a module in python I’m gonna assume the latter, and I’ll answer accordingly- you just make a logic brick that plays an IPO, and activate it via python. You can do yourBrickName.frameStart and yourBrickName.frameEnd to set the start and end frames, yourBrickName.mode to set the mode (it has to be an int) and some other stuff as listed here. Then use cont.activate(yourBrickName) to activate it.

Any pointers to new developments in the GameLogic module?

This doesn’t seem to work…

import GameLogic

cont = GameLogic.getCurrentController()

click = cont.getSensor(‘click’)

play = cont.getActuator(‘act’)

if click.isPositive:





Did you check the console? I believe your problem would be that you need to use an integer for the setType() command. If I’m not mistaken each integer corresponds to a position on the pulldown list on the actuator (starting with 0), so instead of play.setType(Play) you should have something like play.setType(0)

I assume you have your indents for that if statement, since BA cuts them out if you paste in scripts.

[edit] I’m not sure where to find a list of the BGE python changes, but you can get an up-to-date API here. There are others but this is the most complete and best explained one I’ve found so far.

[edit 2] oh, wait, did you mean the API changes that will be needed for 2.5 (I was assuming you just meant added commands)? because I just noticed that you’re using the pre-2.49 API. Here’s a hopefully 2.5 compatible version of your script (untested)

#import GameLogic
#no need, this is imported automatically in every BGE script
#personally I prefer to use g=GameLogic just since I call GameLogic a lot, and g is nice and easy to type quickly

cont = GameLogic.getCurrentController()
#I usually shorten cont to just c (and cont.owner to just o) to save time. I'm a lazy bastard.

#click = cont.getSensor('click')
click = cont.sensors['click'] #sensors and actuators are now stored as lists, rather than found by function calls. I think that's so it runs faster.

#play = cont.getActuator('act')
play = cont.actuators['act']

#if click.isPositive:  This line is probably returning an error, since you aren't using .isPositive() or .positive (note the first one needs parentheses, and won't work post-2.5)
if click.positive: #it's a property, instead of a function, now.
play.frameStart = 1 #a huge amount of functions have been replaced by properties, wherever possible. Anything in the API I linked to listed as deprecated is a function that's been removed and will not work in 2.5+

play.frameEnd = 17

play.mode = 0


I commented out the original versions of things I changed, so you can better compare the differences. You’ll have to put the tabs back in by yourself.

Thanks, man!:wink:

It sucks because I have a Mac and don’t get to view the console/terminal.

Yes, I am using pre-2.49 API, and no, I am not looking for 2.5 API, just 2.49, since my Mac is too old to handle 2.5…:frowning:

To view the console/terminal on OS X you simply have to launch Blender from the terminal.

Blender prints all its errors to the console, specifically to the system log file (not to be confused with the terminal), though as more and more messages build up it starts to fall behind, so I generally just boot windows to debug scripts.

How do I launch Blender from the terminal???
(This will save me many aches and pains)

On my computer Blender is stored in applications/blender, so the command is

Open /applications/blender/

When I open Terminal, blender is greyed out.

Are you saying you want me to type the filepath in?

I get this: 2010-01-22 18:20:12.194 Open[238] No such file: /krebera/Desktop/