well its pretty much all explained in the pictures, ive spent the entire day trying to figure out this problem, and so finally i am posting this here, im using 2.49, and here is the script:
cont = GameLogic.getCurrentController()
own = cont.owner
left = cont.actuators['turn left']
right = cont.actuators['turn right']
rayleft = cont.sensors['rayl']
rayright = cont.sensors['rayr']
wall = cont.sensors['wall in front']
rpos1 = rayleft.hitPosition
dist1 = own.getDistanceTo(rpos1)
rpos2 = rayright.hitPosition
dist2 = own.getDistanceTo(rpos2)
if wall.positive and dist2 > dist1:
cont.activate(left)
cont.deactivate(left)
cont.deactivate(right)
if wall.positive and dist1 > dist2:
cont.activate(right)
cont.deactivate(left)
cont.deactivate(right)
also i was wondering if i need to have the deactivate actuators there or not.