PDA

View Full Version : Could this be a bug? (Alice 2.3)


CellularDecay
04-15-2013, 06:22 PM
I'm working on a simple targeting system for a game, but I've run into a problem. In an If/Else statement, I haved 2 lines of code in the True part, but only 1 line executes.

What makes it even more confusing is the offending line DOES execute when targeting one particular object, but none of the others.

This inconsistancy makes no sense to me. If the statement is True, BOTH lines should execute every time. If there is a problem with the way I coded it, then neither line should execute. The fact that 1 True line executes and the other doesn't defies logic. Add to that the fact that both lines do work on only one particular target and it just makes no sense whatsoever!

I even showed this to my professor and he was stumped.

So... any Alice gurus here that like a challenge?

Bascally, the code looks at a list of potential targets and checks if the aiming device is pointed at anything on the list. If it is, it returns True, and what was supposed to happen was the targeting reticle (dot) would turn red, and the ring around it would turn green.

This did not work, except on the last item in the list. So to check if it was a problem with the list, I made it so that the target itself would turn red (instead of the reticle) and THAT WORKED!???

Every target turns red when the aiming device passes over it, but the aiming device itself will only change color on the last target in the list. Since both commands are located in the same place in the code (True) I can not figure out why it's not working.

Thanks to any and all who can help with this.

sfunk
04-15-2013, 07:30 PM
Well you should have asked the person that you copied this code from, which is me lol And to answer your question, when using the all together statement, it tends to be finicky, meaning it isn't perfect, it will more than likely just use whatever the first item is in your list when trying to run a looping method like you are trying to do in your project. But is it a glitch, No, not really. Just a programming issue, you could always try to set up another function that will check the same thing as before but have it only control your reticle, might work. Other than that, just keep messing around with it.

Oh and try to give people credit when you use something of theirs, It's just common courtesy.