Retrospect Posted October 5, 2018 Share Posted October 5, 2018 (edited) 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 October 5, 2018 by Retrospect 3 Quote Link to comment Share on other sites More sharing options...
senior_falcon Posted October 5, 2018 Share Posted October 5, 2018 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) 3 Quote Link to comment Share on other sites More sharing options...
+OLD CS1 Posted October 5, 2018 Share Posted October 5, 2018 No bad feelings here: no body is going to read either retrospect's post or senior_falcon's documentation 6 Quote Link to comment Share on other sites More sharing options...
Retrospect Posted October 5, 2018 Author Share Posted October 5, 2018 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. Quote Link to comment Share on other sites More sharing options...
RXB Posted October 5, 2018 Share Posted October 5, 2018 (edited) 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 October 5, 2018 by RXB 1 Quote Link to comment Share on other sites More sharing options...
Stuart Posted October 5, 2018 Share Posted October 5, 2018 Nobody likes documentation. Authors hate to write it, and users hate to read it. Unless of course you're a Technical Writer … 2 Quote Link to comment Share on other sites More sharing options...
senior_falcon Posted October 7, 2018 Share Posted October 7, 2018 No guarantees, but It looks like I can make a change to the code that fetches the value of an array element so it will allow nested arrays. 4 Quote Link to comment Share on other sites More sharing options...
LASooner Posted October 13, 2018 Share Posted October 13, 2018 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. 2 Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.