Computer Science Canada Barbarien Bashers |
Author: | copthesaint [ Mon Jan 05, 2009 3:51 pm ] | ||
Post subject: | Barbarien Bashers | ||
Well I am making this game hoping that this one will run. (all my other programs crash computer because they take up too much ram for a computer to use eg. My Guitarhero) The problem is that When I run the program I keep clicking GUI buttons that should not exist... Here is the code (not done)
|
Author: | DemonWasp [ Mon Jan 05, 2009 4:42 pm ] | ||
Post subject: | RE:Barbarien Bashers | ||
Er, this may be part of your memory problem:
If I recall correctly, GUI.Dispose is only for after you're sure you're done with the GUI control in question. What you're doing right now is creating the GUI, checking whether anything clicked on it _that instant_, then disposing of it, only to loop around and create it again immediately. If you're doing stuff like that, you're going to run into performance issues. Turing may not dispose of the GUI components properly, which could definitely lead to massive memory consumption. Here's a rule of thumb: if you're running out of memory with Turing, you're doing something very very wrong. |
Author: | copthesaint [ Mon Jan 05, 2009 5:28 pm ] |
Post subject: | RE:Barbarien Bashers |
Did you even test the program at all? and no GUI. dispose is thier because I am creating the button in the loop also. Doing this I can acually make animations in the backround. The problem is just occuring for me for the very first time. I have done the same setup of GUI in the past and it has worked fine. |
Author: | Laplace's Demon [ Mon Jan 05, 2009 6:39 pm ] |
Post subject: | Re: Barbarien Bashers |
The way you have the program set up is inefficient for a number of reasons. You are creating and then destroying the buttons (theoretically) 1000 times a second, you have a delay of only one millisecond. You do not need to do this, the GUI module creates the buttons in a separate process from your main loop, it runs concurrently (alongside) your main program. What this means for you is that you do not need to check the button 1000 times a second, the button will work no matter how often you go through the loop. The way you should have it set up is to create the buttons then create a loop BELOW and SEPARATE from the buttons. This way you will create the buttons, then the program will effectively wait until the procedures called by your buttons tells the program to exit the loop. That said, the GUI buttons are generally kind of crummy, try creating your own buttons using Mouse.Where. EDIT: Your problem is caused by the fact that you are exiting the loop before you use GUI.Dispose. You can not just move exit when GUI.ProcessEvent to the bottom of the loop because the after GUI.Dispose occurs the parameters required for exit when GUI.ProcessEvent are no longer fulfilled. Truly, I would just recommend starting over because the way you have it structured just doesn't work properly and will only cause more issues in the future. |
Author: | DemonWasp [ Tue Jan 06, 2009 10:04 am ] |
Post subject: | RE:Barbarien Bashers |
What you should be doing looks like this: 1. Set up GUI controls 2. Loop, checking GUI.ProcessEvent and running animations. Increase your delay a little, 1ms is incredibly short. Try something like 10ms (100fps) or maybe 16 (60fps, the most that most screens can draw). 3. After the loop, destroy the GUI controls. |
Author: | copthesaint [ Tue Jan 06, 2009 3:30 pm ] |
Post subject: | RE:Barbarien Bashers |
Thanks everyone but I had already solved to problem on my own time. (Reason for adding GUI to loop: Thought that GUI.Dispose would work... Also this way I can do animations in the backround) Thanks people but i had figured it out. (Not posting code again) |
Author: | copthesaint [ Tue Jan 13, 2009 3:33 pm ] |
Post subject: | Re: Barbarien Bashers |
I'm Getting further and further to finishing my game (still a long way to go...) Here is what I have done so far! Please tell me what you think |
Author: | copthesaint [ Mon Jan 19, 2009 3:20 pm ] |
Post subject: | Re: Barbarien Bashers |
This is an update with code. I need help because whenever you attempt to open the writen variables, You will get an error: (String passed to "strint" is not in correct format) Can someone help me? |
Author: | saltpro15 [ Mon Jan 19, 2009 3:48 pm ] |
Post subject: | RE:Barbarien Bashers |
The error I get is that your program was dividing by zero, you need an elsif to check for that |
Author: | TheGuardian001 [ Mon Jan 19, 2009 10:16 pm ] |
Post subject: | Re: Barbarien Bashers |
Ah. you wanted us to hit continue to get that error. probably should have said that. pressing new game brings up the aforementioned error of divided by 0, which you might also want to look into. on to the error you mentioned. is there any reason you store all of the stats on the same line? if you store them all on their own lines, it is only possible to get one value at a time, which removes some of the complexity of loading it. I believe doing this also fixes the error, although I have no idea why this error comes up or how this fixes it, but it works. |
Author: | copthesaint [ Tue Jan 20, 2009 3:28 am ] |
Post subject: | RE:Barbarien Bashers |
u guys don't worrie bout that its cause u need to press s at map need inrease stats i want to know why i can't continue with strint error |
Author: | andrew. [ Tue Jan 20, 2009 7:59 am ] |
Post subject: | RE:Barbarien Bashers |
Maybe the string isn't a valid integer. Try using strintok to check if the string can successfully be converted. |
Author: | copthesaint [ Tue Jan 20, 2009 12:00 pm ] |
Post subject: | RE:Barbarien Bashers |
... Does anyone just have a sucsessfull program that writes and gets files? My teacher doesn't know what to do to help me and I'm already doing things that arn't supposed to be taught |
Author: | copthesaint [ Wed Jan 21, 2009 3:05 pm ] |
Post subject: | RE:Barbarien Bashers |
OK I found out on my own that when saveing files you can't use write only put |
Author: | Clayton [ Wed Jan 21, 2009 4:47 pm ] | ||
Post subject: | RE:Barbarien Bashers | ||
|
Author: | DemonWasp [ Thu Jan 22, 2009 9:38 am ] |
Post subject: | RE:Barbarien Bashers |
As I recall, using put and get means "output and input are both in ASCII", whereas using write and read means "output and input are both in binary". I could be wrong though. |
Author: | copthesaint [ Thu Jan 22, 2009 11:25 am ] |
Post subject: | RE:Barbarien Bashers |
Sorry I didn't mean that you "couldn't" It's just The way I was doing it I had to use put instead of write |