Computer Science Canada Whack-a-mole process/button gone awry. |
Author: | TheGreatSanguini [ Fri Jan 18, 2008 1:37 pm ] | ||
Post subject: | Whack-a-mole process/button gone awry. | ||
I'm constantly recieving the "Expression is not a variable" error from turing when I try to run the following program. I'm not sure where the problem is, but one thing is for sure - I can't find it myself. I will bold the process that turing does. I'm working in turing 4.0.3
Any help would be appreciated, even if it's not directly related to fixing the problem - I'm sure my program could be simplified or improved in SOME other way as well. Every little bit counts. Thanks in advance. |
Author: | HeavenAgain [ Fri Jan 18, 2008 2:23 pm ] |
Post subject: | RE:Whack-a-mole process/button gone awry. |
shouldn't it be procedure instead of process? |
Author: | TheGreatSanguini [ Sat Jan 19, 2008 7:45 pm ] | ||
Post subject: | Re: Whack-a-mole process/button gone awry. | ||
... excuse me for five minutes while I bash my head against a brick wall. Thanks for pointing that out. Can't believe I spent four hours tweaking and agonizing over THAT. The current incarnation of the program now looks as follows, but I've run into another snag - the buttons don't actually DO anything for some reason, and the score refuses to display. I'm not sure why I'm having either of those problems. I really appreciate any help on this matter.
Thanks again, -Sanguini |
Author: | TheGreatSanguini [ Mon Jan 21, 2008 12:16 pm ] |
Post subject: | Re: Whack-a-mole process/button gone awry. |
Why doesn't the button do anything?! I've tried everything I know. The button just still won't do anything. I've gotten the label of score to display, but that's irrelevant without the button working to increase it. I've put other things into the button's process, like put commands etc, but nothing shows up. I have no idea where this problem would be located, and turing doesn't even give me an error message. I really need some help on this one, I'm in over my head. -Sanguini |
Author: | HeavenAgain [ Mon Jan 21, 2008 12:50 pm ] | ||
Post subject: | RE:Whack-a-mole process/button gone awry. | ||
noticed your
|
Author: | TheGreatSanguini [ Mon Jan 21, 2008 10:35 pm ] |
Post subject: | Re: Whack-a-mole process/button gone awry. |
So does that mean that I have to make my main program a forked procedure or something in order to have it running at the same time as the GUI loop? |
Author: | Clayton [ Mon Jan 21, 2008 10:36 pm ] |
Post subject: | RE:Whack-a-mole process/button gone awry. |
Incorporate that loop in your other loop. |
Author: | TheGreatSanguini [ Mon Jan 21, 2008 10:55 pm ] | ||
Post subject: | Re: Whack-a-mole process/button gone awry. | ||
When I simply incorporate the GUI.ProcessEvent Loop into my main loop, the button still refuses to work. If you could explain further how to properly do it (in case there's more to it then simply copying and pasting it into the other) I'd be all ears. However, with my main program as a forked process, the button works, the counter goes up, and everything's working. I replaced the GUI.Dispose in the button process with GUI.Disable and then drew over the disabled button. Everything's working, everything's good, and I'm happy. Thanks for all of your help, and many bits to you, good sir! EDIT: Gah, I spoke too soon and jinxed myself it seems. While the first few tests through the program yielded no errors, I now keep getting "Segmentation violation". Again, something that might as well be equal parts magic and czechoslovakian to my eyes. What is segmentation violation? If you could explain to me what is happening in my program to cause it, again you would have my gratitude. But if not, I'd like to at least know what it is I'm dealing with.
I've fiddled around with the various settings of the program, and it seems as though it's linked somehow to the time delay, though I'm not sure the nature of the relationship. When Time.Delay is 750, I get segmentation violation less often. Still, this bug needs to be ironed out for my progam to be complete. Thanks in advance, and thanks for previous. -Sanguini [/code] |
Author: | TheGreatSanguini [ Tue Jan 22, 2008 4:58 pm ] | ||
Post subject: | Re: Whack-a-mole process/button gone awry. | ||
Another problem, now that I added more to the program, for some reason I'm getting the error "Color value of -572662307 is out of bounds." Is there at least some sort of error library where I can look up random crap like this? I want to be able to solve some of my problems on my own, for when you guys aren't willing to help me. Still, since I'm in a bind I'd like any help I can get. What's wrong with this stuff?
|
Author: | HeavenAgain [ Tue Jan 22, 2008 5:35 pm ] | ||
Post subject: | RE:Whack-a-mole process/button gone awry. | ||
uh i think the error is like this, you created a button called molebutton and when you click on it, it calls to the procedure, and it disable itself... thats kind of odd, and after a bit you dispose it, while it is already disabled.... weird! so i changed it to something like this,
![]() |
Author: | ericfourfour [ Tue Jan 22, 2008 6:07 pm ] |
Post subject: | RE:Whack-a-mole process/button gone awry. |
You should not be using processes for this. Pretty much everything you do in Turing does not need to be multithreaded. The purpose of multithreading is to divide the cpu load onto more than one processor. Mostly all programs made in Turing do not need the power or complexity of working with multiple threads. Anyway, if you find yourself using processes in Turing, you are probably adding a lot of unnecessary work. A combination of the GUI and processes is a signal for this. |
Author: | TheGreatSanguini [ Tue Jan 22, 2008 6:24 pm ] |
Post subject: | Re: Whack-a-mole process/button gone awry. |
Thanks yet again, HeavenAgain. Yes, turns out that the disposing after it was already disabled was causing the segmentation error. However, for some reason, it was the background music that was causing the color error.... Which is completley bizarre to me naturally. I've gone through the entire program, made sure each individual portion of it works on its own, and together. Now everything except the background music is working, and I think I'll just ignore that. Thanks a million, more bits to you for your outstanding help. I'll make sure to continue revising and add more comments when I reach a stumbling block. -Sanguini |
Author: | HeavenAgain [ Tue Jan 22, 2008 6:32 pm ] | ||||
Post subject: | RE:Whack-a-mole process/button gone awry. | ||||
you should say, "oh thank Heavens Again ![]()
at the beginning of the code, so it will keep on playing that song, and looping by itself. and add
![]() |
Author: | Clayton [ Tue Jan 22, 2008 6:39 pm ] |
Post subject: | RE:Whack-a-mole process/button gone awry. |
And if not Music.PlayFileLoop() you can also check out Music.PlayFileReturn() as they both eliminate the need for processes. PlayFileReturn plays the selection once, while PlayFileLoop does as it implies, it just loops the music over and over again. |