Jump to content
Sign in to follow this  
Retrospect

Something I didn't know until now. (XB Compiler)

Recommended Posts

Hi all.

 

Just writing to let you all know something that most of you might have already have known, which I didn't have a clue about.

 

When writing any program for the XB Compiler (Senior_Falcon's) ...

 

If you're using an array for a map, say we call it DIM MAP(24,32) so that's the entire screen map ....

And we have enemies that use something like this

 

DIM EX( 8 ),EY( 8 ) .... This is Enemy X position and Enemy Y position for 8 enemies.

 

We then think, or well I thought, that it would be perfectly reasonable to do this:

 

100 TICKER=0

110 TICKER=TICKER+1

120 IF TICKER=8 THEN 100

130 IF MAP(EX(TICKER),EY(TICKER))=1 THEN BLAH BLAH ....

 

The whole point is, we can't do this, we CAN in XB but the Compiler hates it. So there's an answer. We have to use simpler variables within the Array, such as this:

 

Subroutine:
1000 A1=EX(TICKER) :: A2=EY(TICKER) :: RETURN

 

So that we can address it simply like this;

 

130 IF MAP(A1,A2)=1 THEN BLAH BLAH blah ....

 

So if any of you have been pulling your hair out with the compiler it's good to know that it can't handle an Array within an Array. Or at least the one I'm using hates that. lol. So there ya go. :)

Edited by Retrospect
  • Like 3

Share this post


Link to post
Share on other sites

Nobody likes documentation. Authors hate to write it, and users hate to read it. But if you had read the docs, on page 19 you would have come to this:

 

ARRAY LIMITATION - Important!! The program being compiled cannot use nested arrays.
For example, if you have the two arrays DIM A(10),DIM B(10); you can use Q=A(X+Y-Z) but
you can't nest the arrays like this: Q=A(B(7)). Use of nested arrays will cause the compiled
program to crash!!! For the above example you would have to split up the statement something
like this: X=B(7)::Q=A(X)
  • Like 3

Share this post


Link to post
Share on other sites

No bad feelings here: no body is going to read either retrospect's post or senior_falcon's documentation :D

  • Like 6

Share this post


Link to post
Share on other sites

Senior Falcon is entirely true and accurate with his surmisation of people vs documentation. I'm one of them. It took me four attempts to solve a problem where I didn't think there was one. Then when it hit me, I said to myself "I'm nesting my arrays" ... I didn't even know what nested array was.

 

It's all good fun though. I'm on with another little game. This time you get to shoot things.

Share this post


Link to post
Share on other sites

Yea XB can do this:

 

IF Z(XY(R(M),C(N)))>0 THEN 200

 

The XB ROM does most of this work for finding the ARRAY address while GPL does the parsing of the original statement.

 

6 variables, and pastes them all into a single value.

Edited by RXB
  • Like 1

Share this post


Link to post
Share on other sites

 

Nobody likes documentation. Authors hate to write it, and users hate to read it.

 

 

Unless of course you're a Technical Writer … ;-)

  • Like 2

Share this post


Link to post
Share on other sites

 

Nobody likes documentation. Authors hate to write it, and users hate to read it. But if you had read the docs, on page 19 you would have come to this:

 

ARRAY LIMITATION - Important!! The program being compiled cannot use nested arrays.
For example, if you have the two arrays DIM A(10),DIM B(10); you can use Q=A(X+Y-Z) but
you can't nest the arrays like this: Q=A(B(7)). Use of nested arrays will cause the compiled
program to crash!!! For the above example you would have to split up the statement something
like this: X=B(7)::Q=A(X)

 

 

I read it, it didn't go unnoticed.

  • Like 2

Share this post


Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
Sign in to follow this  

  • Recently Browsing   0 members

    No registered users viewing this page.

×
×
  • Create New...