Question about arrays (Development MSX Fora)MSX Resource Center MSX Info Update - Finnish MSX madness at its best           
            
English Nederlands Español Português Russian         
 Nieuws
   Voorpagina
  Nieuws archief
  Nieuws onderwerpen

 Informatie
   MSX Fora
  Artikelen
  Recensies
  Beursverslagen
  Fotoreportages
  Beurzen en meetings
  Enquêtes
  Links
  Zoek

 Software
   Downloads
  Webshop

 MRC
   Wie we zijn
  Kom bij ons team
  Doneren
  Policies
  Contact met het MRC
  Link naar Ons
  Statistieken

 Zoek
 
  

  

 Login
 

Gebruikersnaam

Wachtwoord




Ben je nog niet lid? Klik hier en word MSX vriend!


 Statistieken
 

Er zijn 128 gasten en 2 MSX vrienden online

Je bent een anonieme bezoeker.
 

MSX Fora


MSX Fora

Development - Question about arrays

Ga naar pagina ( 1 | 2 Volgende pagina )
Schrijver

Question about arrays

DemonSeed
msx professional
Berichten: 914
Geplaatst: 10 Februari 2008, 19:08   
This will result in an error of type "redimensioned array".



I fail to see why.

Should I "CLEAR" something? I don't really understand.
ARTRAG
msx master
Berichten: 1592
Geplaatst: 10 Februari 2008, 19:26   
just a try:
dimension to "10" instead of "9" the arrays in line 1150 and leave the rest as it is.
let me know if you get the same error
DemonSeed
msx professional
Berichten: 914
Geplaatst: 10 Februari 2008, 19:34   
Yeah, same error...

When I "REM" line 1150-1180 however, no error occurs.

But it's nice to have bullets in a shooting game, right?
ARTRAG
msx master
Berichten: 1592
Geplaatst: 10 Februari 2008, 19:36   
try to comment only lines 1160-1180
and tell me

it could be an xbasic issue
DemonSeed
msx professional
Berichten: 914
Geplaatst: 10 Februari 2008, 19:41   
You're right!!! *swears*
ARTRAG
msx master
Berichten: 1592
Geplaatst: 10 Februari 2008, 19:43   
Easy solution

Move all the DIM statements
Before any instruction

This holds in any Xbasic block if you use _turbo on /off
instead of _run


DemonSeed
msx professional
Berichten: 914
Geplaatst: 10 Februari 2008, 19:47   
The DIM statements you see on the screenshot are stated directly after the _TURBO ON command.

It's actually in line 1120.

Moving them before the _TURBO ON command would mean that all variables will be set to zero again.
ARTRAG
msx master
Berichten: 1592
Geplaatst: 10 Februari 2008, 19:49   
I mean this :
move the code at lines 1160-1180 after any dim statement
ARTRAG
msx master
Berichten: 1592
Geplaatst: 10 Februari 2008, 19:50   
the dim statements have to be on the top of the xbasic block
DemonSeed
msx professional
Berichten: 914
Geplaatst: 10 Februari 2008, 19:52   
YESSS, it works! Thanks again!!!
[D-Tail]

msx guru
Berichten: 2994
Geplaatst: 10 Februari 2008, 22:24   
Speaking of which, DemonSeed, why weren't you @ Mariënberg, last Saturday? I had my X/NBASIC books and software projects on me...
DemonSeed
msx professional
Berichten: 914
Geplaatst: 10 Februari 2008, 22:58   
Oh yeah... I'm sorry about that.

My work has been asking so much of me lately that I wasn't physically able to come out of bed before 12:00 AM on any saturday....

Same reason why I had to miss the fair in Nijmegen...
[D-Tail]

msx guru
Berichten: 2994
Geplaatst: 11 Februari 2008, 09:13   
That's too bad, really. Next fair it is
AuroraMSX

msx master
Berichten: 1228
Geplaatst: 11 Februari 2008, 14:19   
Ouch, what a piece of code . I think you'd be better off using a 2-dimensional array:
1150 DIM B(9,9), E(21,8)
1160 FOR BI=0 TO 9: FOR BB=0 TO 9: B(BI,BB)=1: NEXT BB,BI
1170 RESTORE 1180: FOR BB=0 TO 9: READ Z: B(4,BB)=Z: NEXT: ' B(4,x) used to be BD(x)
1180 DATA 0, 0, 0, -2, 2, -2, 2, -2, 2
(Or something along that line...)
DemonSeed
msx professional
Berichten: 914
Geplaatst: 11 Februari 2008, 14:40   
Quote:

Ouch, what a piece of code

Why, thank you. Are you offering to code the game instead?

Quote:

I think you'd be better off using a 2-dimensional array:
1150 DIM B(9,9), E(21,8)
1160 FOR BI=0 TO 9: FOR BB=0 TO 9: B(BI,BB)=1: NEXT BB,BI
1170 RESTORE 1180: FOR BB=0 TO 9: READ Z: B(4,BB)=Z: NEXT: ' B(4,x) used to be BD(x)
1180 DATA 0, 0, 0, -2, 2, -2, 2, -2, 2
(Or something along that line...)

Thanks man, interesting suggestion.
Is it really that better to use DATA lines?
 
Ga naar pagina ( 1 | 2 Volgende pagina )
 







(c) 1994 - 2008 Stichting MSX Resource Center. MSX is een trademark van MSX Licensing Corporation.