Question about arrays (Development Foros MSX)MSX Resource Center PassionMSX MSX2 contest           
                       
English Nederlands Español Português Russian                  
 Noticias
   Página principal
  Almacén de noticias
  Temas de noticias

 Recursos
   Foros MSX
  Artículos
  Analisis
  Informe de ferias/RUs
  Álbum de fotos
  Ferias y encuentros
  Encuestas
  Enlaces
  Buscar

 Software
   Descargas
  Tienda Online

 MRC
   Quiénes somos
  Únete a nuestro equipo
  Donar
  Políticas
  Contacta con nosotros
  Enlázanos
  Estadísticas

 Buscar
 
  

  

 Login
 

Login

Contraseña




¿Aún no tienes una cuenta? ¡Conviértete en miembro del MSX Resource Center! ¡Únete a nosotros!.


 Estadísticas
 

Hay 126 invitados y 1 miembro en línea

Eres un usuario anónimo.
 

Foros MSX


Foros MSX

Development - Question about arrays

Ir a la página ( 1 | 2 Siguiente página )
Autor

Question about arrays

DemonSeed
msx professional
Mensajes: 903
Publicado: Febrero 10 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
Mensajes: 1578
Publicado: Febrero 10 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
Mensajes: 903
Publicado: Febrero 10 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
Mensajes: 1578
Publicado: Febrero 10 2008, 19:36   
try to comment only lines 1160-1180
and tell me

it could be an xbasic issue
DemonSeed
msx professional
Mensajes: 903
Publicado: Febrero 10 2008, 19:41   
You're right!!! *swears*
ARTRAG
msx master
Mensajes: 1578
Publicado: Febrero 10 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
Mensajes: 903
Publicado: Febrero 10 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
Mensajes: 1578
Publicado: Febrero 10 2008, 19:49   
I mean this :
move the code at lines 1160-1180 after any dim statement
ARTRAG
msx master
Mensajes: 1578
Publicado: Febrero 10 2008, 19:50   
the dim statements have to be on the top of the xbasic block
DemonSeed
msx professional
Mensajes: 903
Publicado: Febrero 10 2008, 19:52   
YESSS, it works! Thanks again!!!
[D-Tail]
online

msx guru
Mensajes: 2980
Publicado: Febrero 10 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
Mensajes: 903
Publicado: Febrero 10 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]
online

msx guru
Mensajes: 2980
Publicado: Febrero 11 2008, 09:13   
That's too bad, really. Next fair it is
AuroraMSX

msx master
Mensajes: 1224
Publicado: Febrero 11 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
Mensajes: 903
Publicado: Febrero 11 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?
 
Ir a la página ( 1 | 2 Siguiente página )
 







(c) 1994 - 2008 Fundación MSX Resource Center. MSX es una marca registrada de MSX Licensing Corporation