I've got a problem, and I need you're help

So, I have this setup. It has a cube (Cube1) that is looking Left, Right, Up, and Down for a property named ‘Test’. There is another cube (Cube2) it has the property ‘Test’. Cube 2 passes through Cube1’a sensor field to the right and creates an object specific to the right side being on. Now Cube2 continues on. Here is the part that causes the problem, When Cube2 continues on, it activates the other sensor fields. Now i need Cube2 to survive so killing it won’t work.
For easy reading.

Question

  • What can I do to keep Cube2 from triggering Cube1’s sensor fields other than the one it’s supposed to.

Misc info

  • The cube MUST survive.

  • The cube is duplicated and could possibly approach Cube1 from any angle, so giving it a specific property is off

  • I need Cube1 to have the separate direction sensors

I was thinking of deleting Cube2’s ‘Test’ property while it was inside the cubes sensor field, but I don’t know how to do that (Delete the property) If you have any suggestions of another way to do this, please don’t hesitate to post!

Are you open to a Python solution?

It’s really quite simple, all you have to do is make it so that the main object can tell if its “seen” the object before. All you would have to do is save the object’s name into a property and then check later to see if the object is of the same name.

The pseudo code is this:

 
obj = the object that is sensing

dir_x = direction sensor on the x axis
dir_nx = direction sensor on the -x axis
dir_z = direction sensor on the z axis
dir_nz = direction sensor on the -z axis

# make sure you have a name property defined! (as a string)
if one of the sensors is positive:
    if the sensor's hit object has whatever property and the hit object's name is not equal to the name property:
        save the objects name in your 'name' property
        Do whatever!

-Sunjay03

I’m completely open to a python solution. However, i am unfortunately a noob with python and I won’t be able to talk your pseudo code and make it a reality, but to anyone else who may be able to do this I would be very grateful.

I used pseudo because I wasn’t sure whether or not you are using ray sensors or something else.

Here is something to help you on your way:


import GameLogic   # real men import all their modules
# get the current controller
cont = GameLogic.getCurrentController()
# get the object that owns the controller
own = cont.owner

# we need to make sure that there is a "name" property in the object
if not "name" in own:
    own["name"] = ""

# lets find a positive sensor using the handy dandy list comprehensions
# note: try and except are used in order to catch the index error that occurs when their 
# isn't a positive sensor.
try: positive_sensor = [x for x in cont.sensors if x.positive and "hitObject" in x][0]
except: positive_sensor = None
if positive_sensor:
    if positive_sensor.hitObject:
        if not own["name"] or positive_sensor.hitObject.name != own["name"]:
            own["name"] = positive_sensor.hitObject.name
            ## This is the place where you would say, activate your actuators that do the adding, set positions...etc.

There is lots of info at this link:
http://www.theboomshelter.com/hss.html

-Sunjay03