ugh headaches trying to learn this

help pls…

> how exactly do i add a function to an obj?

lets say i have a obj cube.001
then i want it to have:

#‘this’ refers to the obj
#'flaga is just a boolean belonging to the obj

def getReturnMsg():

>if this.flaga == True:

>>return “flag true”
>if this.flaga == False:
>>return “flag false”

where do i put it? o.0;

complete scenario would be i need that function to be ‘extended’ (i think thats right term?) for a bunch of them then i will write uniques among them or something like that…

i learned some python before but my concept of oop and name space are just absolutely weak :frowning:

hope that made sense…
thx in advance

==================
on a different topic:

1 curiosity that i manage to get around though still bugs me… why is that when i try to print the objectlist of a scene i get nameless objects? though i can reference them normally by using their ob name according to the F9 menu

Yeah, its BGE python. Check out the “resources” link in my sig, and scroll down to the bottom to learn some BGE python. Probably start with social’s tutorial, or the beginner’s tutorial. If you plan on doing more python, I’d bookmark the GameLogic API.

actually i`ve read quite a few of those its just that this is where i got stuck afterwards.

and sweet i can bookmark just one link now ty

although after a fresh perspective i realize i don`t even need that function to get attached to the object at all, i can just treat the 1 text file as the function prolly ends up cleaner that way to

GameLogic API = where all the headache came from that stop me from thinking straight in the first place. well that and trying to pick apart other peoples game demos

==============================

oh and i think i finally figured out why it was nameless, cuz i was printing the objects instead of the objectsnames...it makes sense but i havent actually tested personally :s