Huh?
Author | Topic: Huh? |
---|---|
Infiltrator
Member # 5576
|
written Saturday, October 15 2005 19:04
Profile
Homepage
I have encountered a very odd problem working on a script: To begin with, my script was crashing occasionally, so I wanted to look into it. It looked like there was a bug that was causing it to run sate 5 sometimes where it shouldn't have, so I started looking into which states were running when. I discovered that the script would, on seeing an enemy, correctly go from state 2 (START_STATE) to state 5, then to state 3. But before it even got to the first bad behavior I had wanted to analyze, I saw that when it was supposed to be in state 3, it would run state 2 half a dozen times, and then state 3. When I tried to use a variable to keep track of what state it was in and have state 2 only do anything if the variable was 2, state 2 kept running anyway, When I examined the values of the variable, I saw that it was switching to 2 when it reached state 2 even though the only time in the script when that variable was assigned that value was in the INIT_STATE, which was not being rerun. I'd swear that variable is changing by itself. Has anybody else ever seen anything like this at all? -------------------- Überraschung des Dosenöffners! "On guard, you musty sofa!" Posts: 627 | Registered: Monday, March 7 2005 08:00 |
...b10010b...
Member # 869
|
written Saturday, October 15 2005 19:09
Profile
Homepage
Mind posting the script so that we can see what the heck might be going on? -------------------- The Empire Always Loses: This Time For Sure! Posts: 9973 | Registered: Saturday, March 30 2002 08:00 |
Infiltrator
Member # 5576
|
written Saturday, October 15 2005 19:23
Profile
Homepage
I hadn't originally because the relevant portion is basically all of it, and it is a bit long and messy since I'm still trying to get it in working order. I'm going to cut out most of the actual computation since, hopefully, it isn't significant to the problem. In states 3 and 4, the assignments to s should not be commented out, normally, but I wanted to make utterly sure that they weren't responsible. -------------------- Überraschung des Dosenöffners! "On guard, you musty sofa!" Posts: 627 | Registered: Monday, March 7 2005 08:00 |
...b10010b...
Member # 869
|
written Saturday, October 15 2005 20:21
Profile
Homepage
First possible problem: you're not supposed to check the value of an uninitialised variable, and you haven't set s to anything before this point, so s is uninitialised. I'll tell you if I spot anything else. [ Saturday, October 15, 2005 20:29: Message edited by: Thuryl ] -------------------- The Empire Always Loses: This Time For Sure! Posts: 9973 | Registered: Saturday, March 30 2002 08:00 |
Infiltrator
Member # 5576
|
written Sunday, October 16 2005 04:19
Profile
Homepage
However that check has also proven to make no difference. I'll take it out for sure though. -------------------- Überraschung des Dosenöffners! "On guard, you musty sofa!" Posts: 627 | Registered: Monday, March 7 2005 08:00 |
...b10010b...
Member # 869
|
written Sunday, October 16 2005 04:55
Profile
Homepage
It's a long shot, but have you tried changing the variable name to something else? I know there are some variable names that BoA won't let you use; maybe this is one that it does let you use but shouldn't. Another thought: it's probably good form to replace all instances of ME with the my_number() call. ME sometimes misbehaves. [ Sunday, October 16, 2005 04:56: Message edited by: Thuryl ] -------------------- The Empire Always Loses: This Time For Sure! Posts: 9973 | Registered: Saturday, March 30 2002 08:00 |
Infiltrator
Member # 5576
|
written Sunday, October 16 2005 07:12
Profile
Homepage
Yes, originally the variable's name was 'state' and that totally messed the script up so that it wouldn't run. I have also tried changing it to 'k', and there is no difference. -------------------- Überraschung des Dosenöffners! "On guard, you musty sofa!" Posts: 627 | Registered: Monday, March 7 2005 08:00 |