This is my first script in python (in any language in fact).
I realise I need to go back and learn python itself before much of the stuff in the game reference makes sense, particularly the unbolded text in the Python method section e.g. char* propname getWhatever
however…in the mean time I’m going to be lazy and just ASK!
heres’ the script
import GameLogic
contr=GameLogic.getCurrentController()
owner=contr.getOwner()
owner.Point=owner.Point+1
Point=owner.Point
PointNo = Point
act=contr.getActuator(“Track1”)
act.setObject(“Marker”+PointNo)
the full blend file is at
called
Follow Marker.blend
I’m trying to get a dynamic object (owner of the script) to track to a marker, then when spacebar is hit track to the next marker in the sequence. ie Marker2, Marker3 etc… (these are the name of the objects).
Track1 is the name of the actuator.
i’m having a probem at
act.setObject(“Marker”+PointNo)
I want the dynamic object to track to the object called Marker2 (2 being the value of the dynamic object’s property PointNo) but I need PointNo as a str not an int.
ie I want the equivilent of
act.setObject(“Marker2”)
(BTW when I manually enter the obove text I get a runtime error even though I have an objecrt with the name “Marker 2”).
How do I make the int PointNo a str? You can see that i tried to do it with
Point=owner.Point
PointNo = Point
but that didn’t work…
I realise this is a python syntax thing that I could work out if i surfed long enough but c’mon, it’s my first script…be nice to me.