View previous topic :: View next topic |
Author |
Message |
bis_senchi

Joined: 08 Jun 2004 Posts: 460 Location: Reims, France
|
Posted: Tue Dec 20, 2005 9:18 am Post subject: Need help to solve a bug |
|
|
Here's my problem.
When I launch my game.exe then load my rpg file the game starts. The new game script load but then for strange reasons I've got the following message (the error code 9) As the errors occurs as my rpg is loaded I think it can be qualified as an runtime error.
Here what's the message says :
Code: |
please report this exact error message [...] when it happened
Ohrrpg player rusalka 20051003
memory info 238560 44728 1972 43928
executable: .exe
rpg file d:\sailor~1\sailor.rpg
Error code 9
subscript our of range in line no line number in module game at
address OE20:C517
hit any key to return to the system
|
Ok here are the main points
1) What does subscript of range of means exactly ? (I mean by this how can I recognize an out of range error in my plotscripts)
2) What's module game at address 0E20:C517? (I think address 0E20:C517 is located in my new script because it's when the error occurs)
3) Could somoene give the main causes (and rather rare causes of error 9)?
Anyway if you want me to post the new game script or explain in a different way what I put in my questions feel free to ask for it.
Thanks in advance for the help ! |
|
Back to top |
|
 |
PlayerOne

Joined: 07 Sep 2005 Posts: 143 Location: UK
|
Posted: Tue Dec 20, 2005 2:54 pm Post subject: |
|
|
"Subscript out of range" means that an array index is too high or too low in QBasic somewhere. That is, you're trying to access the 100th element in an array of 10, for instance. More likely a negative index, I'd suspect.
Was this the error we were getting with the enemydata thing when the enemy number was more than 102? There's a thread about it around here somewhere. That particular problem has been fixed since Rusalka.
The address doesn't really mean a lot, sadly, so it would be quite difficult to trace back to a plotscript command. |
|
Back to top |
|
 |
Ysoft_Entertainment VB Programmer

Joined: 23 Sep 2003 Posts: 810 Location: Wherever There is a good game.
|
Posted: Tue Dec 20, 2005 6:53 pm Post subject: |
|
|
Hmmm, must be the heap problem.
I forgot, if I fixed it before the release or after the release of rusalka.... wait it was after the release. So ye, it still stays there.
Sorry about that.
ok, try this later build of game.exe, see if you see the same problem.
by the way, this is in no way the official release.
www.freewebs.com/ysoft_entertainment/game-qb.zip _________________ Try my OHR exporter/importer.
OHRGFX
Striving to become better pixel artist then Fenrir Lunaris. Unfortunately the laziness gets in the way of my goals. |
|
Back to top |
|
 |
bis_senchi

Joined: 08 Jun 2004 Posts: 460 Location: Reims, France
|
Posted: Tue Dec 20, 2005 11:15 pm Post subject: Well well.... |
|
|
Ok! I've made a test with the ysoft_entertainement's game.exe version.
The bug still happens (error code 9 exactly at same address). That means the heap problem is not what make bug my game which is a good thing to know.
So we can deduce that the bug is certainly due to the array index which is too high or too low in QBasic somewhere in the code of the game and the problem become serious as hssed.exe compiles.
So can somoene explain me how do I check the array index values ?? (Feel free to give many many details because I've never done that before)
Thanks very very much for the help and for answering so soon! |
|
Back to top |
|
 |
Mike Caron Technomancer

Joined: 26 Jul 2003 Posts: 889 Location: Why do you keep asking?
|
Posted: Wed Dec 21, 2005 12:08 am Post subject: |
|
|
I would like to point out that the subscript that is out of range is not in the plotscript. It's in the engine somewhere. _________________ I stand corrected. No rivers ran blood today. At least, none that were caused by us.
Final Fantasy Q
OHR Developer BLOG
Official OHRRPGCE Wiki and FAQ |
|
Back to top |
|
 |
TMC On the Verge of Insanity
Joined: 05 Apr 2003 Posts: 3240 Location: Matakana
|
Posted: Wed Dec 21, 2005 4:50 am Post subject: |
|
|
Those error messages are almost always useless. To find you problem, we would have to look at your newgame script. could you please post it?
Also, exactly when does it crash? After you click New Game and the screen fades out? Anything at all happen before it? _________________ "It is so great it is insanely great." |
|
Back to top |
|
 |
Ysoft_Entertainment VB Programmer

Joined: 23 Sep 2003 Posts: 810 Location: Wherever There is a good game.
|
Posted: Wed Dec 21, 2005 7:58 am Post subject: |
|
|
You are right, its not heap problem(arfenhouse works with my build). so ye, we need to see your script before we can squash this bug.
and by the way, error code 9 means that the program tries to open same file twice. so the bug should be somewhere in the command that accesses the internal files. _________________ Try my OHR exporter/importer.
OHRGFX
Striving to become better pixel artist then Fenrir Lunaris. Unfortunately the laziness gets in the way of my goals. |
|
Back to top |
|
 |
Mike Caron Technomancer

Joined: 26 Jul 2003 Posts: 889 Location: Why do you keep asking?
|
Posted: Wed Dec 21, 2005 10:12 am Post subject: |
|
|
Actually, it's quite legitamate to open a file twice. You just can't open a file for writing twice.
Further, why is the error message "Subscript out of range" if it's an I/O error? _________________ I stand corrected. No rivers ran blood today. At least, none that were caused by us.
Final Fantasy Q
OHR Developer BLOG
Official OHRRPGCE Wiki and FAQ |
|
Back to top |
|
 |
Ysoft_Entertainment VB Programmer

Joined: 23 Sep 2003 Posts: 810 Location: Wherever There is a good game.
|
Posted: Wed Dec 21, 2005 10:29 am Post subject: |
|
|
Quote: | Further, why is the error message "Subscript out of range" if it's an I/O error?
|
because qbasic has a wierd way of missinterpreting errors?
Anyway we will see when he actually posts the script. _________________ Try my OHR exporter/importer.
OHRGFX
Striving to become better pixel artist then Fenrir Lunaris. Unfortunately the laziness gets in the way of my goals. |
|
Back to top |
|
 |
bis_senchi

Joined: 08 Jun 2004 Posts: 460 Location: Reims, France
|
Posted: Wed Dec 21, 2005 11:11 pm Post subject: |
|
|
As requested, I've posted the script. The game crashes as the teleport
to map (1, 84 ,63) command is executed. By crashing I mean that a windows with the message error code 9 appear. The only thing that left me to do after the game crashed is pressing a key and then click on the cross on the top right corner of the windows.
Code: |
# Ce script définit la première partie de l'introduction du jeu.
script, introduction1, begin
suspend player
suspend npcs
lock hero (me)
show backdrop (4)
wait (30)
fade screen out (63,63,63)
show backdrop (2)
wait (35)
fade screen in
show map
show backdrop (3)
lock hero(me)
#in association with the OHR RPG Community
wait (30)
show backdrop (9)
wait (30)
show backdrop (11)
wait (30)
show backdrop (13)
wait (30)
show backdrop (12)
wait (30)
show backdrop (14)
wait (35)
show backdrop (1)
wait (30)
set hero picture (me, 0)
wait for hero (me)
get item (1, 2)
get item (28, 6)
show text box (46)
wait for text box
wait (2)
show backdrop (2)
get item (32, 8)
get item (31, 4)
show map
#Début dialogues ennemis
#Map 17 NPC 0= Queen Beryl
teleport to map (17, 17, 20)
create NPC (0, 7, 19)
walk NPC to X (0, 18)
wait for NPC (0)
walk NPC to Y (0, 21)
wait for NPC (0)
# reset time
write general(51,0) # days
write general(52,0) # hours
write general(53,0) # minutes
write general(54,0) # seconds
show text box (12)
wait for text box
show text box (1)
wait for text box
unlock hero (me)
# map 1 : Npc 16 = Luna
# map 1 : Npc 12 = Usagi qui dort
# plateforme pour créer des copies de npc0 x7 y83
# BUG HERE BUG HERE BUG HERE BUG HERE BUG HERE BUG HERE
teleport to map (1, 84 ,63)
create NPC (12, 84, 62)
variable (visitor2) #le visiteur2 en question est luna
set variable (visitor2, Npc reference (0,0))
Alter NPC (visitor2,NPCstat:picture,36)
Alter NPC (visitor2,NPCstat:palette,14)
set npc position (visitor2, 82, 66)
wait for Npc (visitor2)
set Npc speed (visitor2, 2)
wait for Npc (visitor2)
walk NPC to Y (visitor2, 64)
wait for NPC (visitor2)
walk NPC to X (visitor2, 84)
wait for NPC (visitor2)
walk NPC to Y (visitor2, 63)
wait for NPC (visitor2)
put npc (visitor2, npc pixelX(visitor2), npc pixelY (visitor2)--12)
wait (3)
put npc (visitor2, npc pixelX(visitor2), npc pixelY (visitor2)+12)
wait (3)
# Luna jump to make get up Usagi Chan
# put luna's emoticon here
show text box (3)
wait for text box
set Npc speed (visitor2, 0)
wait for Npc (visitor2)
resume box advance
resume NPCs
resume player
introduction2
end
|
If you think for some reasons that the script is too big feel free to make it noticed. Feel also free to put any remarks about the way the commands are written (I mean by this "if I were you I would write the code this way, it would be more for hssed to compile").
Thanks very much for the help and for answering so quickly! |
|
Back to top |
|
 |
bis_senchi

Joined: 08 Jun 2004 Posts: 460 Location: Reims, France
|
Posted: Wed Dec 21, 2005 11:15 pm Post subject: oups |
|
|
I wanted to say of course "if I were you I would write the code this way, it would be more EASIER for hssed to compile".
Anyway this comment (# Ce script définit la première partie de l'introduction du jeu. ) is written in french my mother tongue means #this cript contains the commands for the first part of the introduction of the game.
Another thing that may also be useful to know is that Hseed take about 7.2 seconds to compile my script. Tell me if that's too much! |
|
Back to top |
|
 |
PlayerOne

Joined: 07 Sep 2005 Posts: 143 Location: UK
|
Posted: Thu Dec 22, 2005 5:31 am Post subject: |
|
|
bis_senchi wrote: |
Code: |
# map 1 : Npc 16 = Luna
# map 1 : Npc 12 = Usagi qui dort
# plateforme pour créer des copies de npc0 x7 y83
# BUG HERE BUG HERE BUG HERE BUG HERE BUG HERE BUG HERE
teleport to map (1, 84 ,63)
create NPC (12, 84, 62)
variable (visitor2) #le visiteur2 en question est luna
set variable (visitor2, Npc reference (0,0))
|
|
Should it not be Npc reference (16, 0), if visitor2 is Luna? (Your variable names are English, I see ) Presumably the Alter NPC lines would give the subscript error if NPC Reference failed. |
|
Back to top |
|
 |
bis_senchi

Joined: 08 Jun 2004 Posts: 460 Location: Reims, France
|
Posted: Thu Dec 22, 2005 11:49 pm Post subject: What is an I/O error? |
|
|
Special thanks to player one for noticing this huge mistake
in the code. On my side I've noticed that I had put 2 lock hero commands.
I also deleted the useless resume box advance command. (I didn't have suspend it
at the beginning of the script. Unfortunatelly all this didn't have effects
on the bug. I've also made test using the debuging key (pressing F12
as the game plays) but nothing special appears.
I think I know where the bug may come from. I've certainly made
something wrong including the while loop in game code lines.
I'm quite certain that's the reason why the game bugs; because the bug has started
just after I include the while loop in my code.
That would also explain why the program tries to open same file
twice... so the bug should be somewhere in the command that
accesses the internal files for the second time. The fact that it happens
just before the main hero teleport would be due only to strange Qbasic coding.
As a matter of fact with my first tests with the while loop the same bugs
happened but a little bit after, as the Npc 16 (Luna) was appearing at the
bedroom entry and tried to go towards Usagi's chan bed.(That's what's
Luna is supposed to do in the game intro)
By the way could somoene tell me
1) What does I and O stand for in "I/O error"?
2) As the error may be in the command that accesses the internal files how can I check them?
and more important how will I notice them in the QBacic code which can be messy.
Anyway thanks again for bug reporting and also for anwering so quickly. I have put
a copy online of my rpg and hss files so feel free to ask for the links (or for other scripts that may contains)
My game intro is made of 3 scripts intro1 intro2 and chapter1 (at the end of which the extended
keyboard launch with a global loop) so the bug may also be in one of those other three scripts.
Good luck to all in making your games! |
|
Back to top |
|
 |
Ysoft_Entertainment VB Programmer

Joined: 23 Sep 2003 Posts: 810 Location: Wherever There is a good game.
|
Posted: Fri Dec 23, 2005 5:52 pm Post subject: |
|
|
Can you post the link to your game? _________________ Try my OHR exporter/importer.
OHRGFX
Striving to become better pixel artist then Fenrir Lunaris. Unfortunately the laziness gets in the way of my goals. |
|
Back to top |
|
 |
bis_senchi

Joined: 08 Jun 2004 Posts: 460 Location: Reims, France
|
|
Back to top |
|
 |
|