Author Topic: Error ......  (Read 6678 times)

Hb!

  • Guest
Error ......
« on: 2007-Oct-12 »
umm maybe this cannot be considered as a bug, its more like a stupid thing i did ... During the usage of Gl suddenly weird error messages appeared( i compiled it worked fine and then windows started telling me " This program is not responding bla bla bla..." and then after a while  something of video card error appeared....) do you know why is happening ? does it have something to do with limit fps command?
cause that has been the one ive been using a lot... maybe i exceeded
 the number... do i didn't use more than 100...

Offline Kitty Hello

  • code monkey
  • Administrator
  • Prof. Inline
  • *******
  • Posts: 10839
  • here on my island the sea says 'hello'
    • View Profile
    • http://www.glbasic.com
Error ......
« Reply #1 on: 2007-Oct-12 »
Should not be. Can you provide a sample to reproduce the error?

Hb!

  • Guest
Error ......
« Reply #2 on: 2007-Oct-13 »
problem solved.... seems to be that its related with closing the compiled game... instead of closing , i've simply stopped the game and thats all, it closes and no error happens.

Hb!

  • Guest
Error ......
« Reply #3 on: 2007-Oct-15 »
no sorry that helps out while im using the compiler... but the .exe file has the same error so here's  the code...
Code: (glbasic) [Select]
LIMITFPS 6
GETSCREENSIZE sx, sy
LOADBMP "shrine.bmp"

LOADSPRITE "mai.bmp",1
LOADSPRITE "mai2.bmp",2
LOADSPRITE "mai3.bmp",3
LOADSPRITE "mai4.bmp",4
LOADSPRITE "mai5.bmp",5
LOADSPRITE "mai6.bmp",6
LOADSPRITE "mai7.bmp",7
LOADSPRITE "mai8.bmp",8
LOADSPRITE "mai9.bmp",9
LOADSPRITE "mai10.bmp",10
LOADSPRITE "mai11.bmp",11
LOADSPRITE "mai12.bmp",12
LOADSPRITE "mai13.bmp",13
LOADSPRITE "mai14.bmp",14
LOADSPRITE "mai15.bmp",15
LOADSPRITE "mai16.bmp",16
LOADSPRITE "mai17.bmp",17
LOADSPRITE "mai18.bmp",18
LOADSPRITE "mai19.bmp",19

DRAWSPRITE 1, -20, 250
SHOWSCREEN

DRAWSPRITE 2, -20, 250
SHOWSCREEN

DRAWSPRITE 3, -20, 250
SHOWSCREEN

DRAWSPRITE 4, -20, 250
SHOWSCREEN

DRAWSPRITE 5, -20, 250
SHOWSCREEN

DRAWSPRITE 6, -20, 250
SHOWSCREEN

DRAWSPRITE 7, -20, 250
SHOWSCREEN

DRAWSPRITE 8, -20, 250
SHOWSCREEN

DRAWSPRITE 9, -20, 250
SHOWSCREEN

DRAWSPRITE 10, -20, 250
SHOWSCREEN

DRAWSPRITE 11, -20, 250
SHOWSCREEN

DRAWSPRITE 12, -20, 250
SHOWSCREEN



WHILE TRUE
IF  KEY(200)
   DRAWSPRITE 13, -20, 250
   SHOWSCREEN
   DRAWSPRITE 13, -20, 230
   SHOWSCREEN
   DRAWSPRITE 13, -20, 210
   SHOWSCREEN
   DRAWSPRITE 13, -20, 180
   SHOWSCREEN
   DRAWSPRITE 13, -20, 160
   SHOWSCREEN
   DRAWSPRITE 14, -20, 160
   SHOWSCREEN
   DRAWSPRITE 14, -20, 180
   SHOWSCREEN
   DRAWSPRITE 14, -20, 210
   SHOWSCREEN
   DRAWSPRITE 14, -20, 230
   SHOWSCREEN
   DRAWSPRITE 14, -20, 240
   SHOWSCREEN
   IF KEY(30)
   DRAWSPRITE 15, -20, 259
   SHOWSCREEN
   DRAWSPRITE 16, -20, 259
   SHOWSCREEN
   DRAWSPRITE 17, -20, 259
   SHOWSCREEN


   DRAWSPRITE 18, -20, 259
   SHOWSCREEN
   ELSE
   DRAWSPRITE 14, -20, 250
   SHOWSCREEN
   DRAWSPRITE 18, -20, 250
  SHOWSCREEN

   ENDIF
   ENDIF
   WEND
MOUSEWAIT
by the way  the error of the card only appeared once not every time the game is compiled.

Please could someone tell me how to get rid of this problem?

Offline Kitty Hello

  • code monkey
  • Administrator
  • Prof. Inline
  • *******
  • Posts: 10839
  • here on my island the sea says 'hello'
    • View Profile
    • http://www.glbasic.com
Error ......
« Reply #4 on: 2007-Oct-15 »
The WHILE TRUE/WEND loop has no SHOWSCREEN in it, when you don't press the key(200).
That's bad. SHOWSCREEN does a lot more than show the screen.
It's responsible for everything you do with the window, too (thus, you can't close it)

Hb!

  • Guest
Error ......
« Reply #5 on: 2007-Oct-16 »
Boku no baka ~~ i didn't know that... but if i use Showscreen at the end of the program the bug gets solved? any ideas to fix it? and could you please post rules of this kind of bug problems? what beginners programmers (like me ) shouldn't do?

Offline Moru

  • Administrator
  • Prof. Inline
  • *******
  • Posts: 1793
    • View Profile
    • Homepage
Error ......
« Reply #6 on: 2007-Oct-16 »
One tip for beginner programmers is to indent your code. What I mean is every time you use something that creates a block that needs to be terminated lower down, you indent the lines inbetween:

For example:
Code: (glbasic) [Select]
LOCAL Y = 25
WHILE TRUE
    IF X > Y
        INC X, 5
    ENDIF
    SHOWSCREEN
WEND
This makes your code much easier to read and will save you lots of headache later on :-)

Offline Kitty Hello

  • code monkey
  • Administrator
  • Prof. Inline
  • *******
  • Posts: 10839
  • here on my island the sea says 'hello'
    • View Profile
    • http://www.glbasic.com
Error ......
« Reply #7 on: 2007-Oct-16 »
and you should try to find out some logics behind your "game" and use variables and loops instead of pages of
DRAWSPRITE
SHOWSCREEN
DRAWSPRITE
SHOWSCREEN
...

Instead do:
main:
   y = y+1
   DRAWSPRITE 100, 100, y
   SHOWSCREEN
goto main

Hb!

  • Guest
Error ......
« Reply #8 on: 2007-Oct-17 »
got that... thanks for the help... yop i was thinking about that... cause its a lot... of work.. like i said before I'm merely learning... at least learning of those mistakes could help me in the future don't you think? although i gotta find a way to make clear codes, improve.... no matter what i wont give up....