Code:
```:While W=2 :While W=2 :¦ "random other real( commands :¦ real(8→K :¦ X+(K=3)-(K=2)(X≠0→N :¦ Z+(K=1)-(K=4)(Z≠0→O :¦ If max([A](O+1,N+1)={0,30 :¦ Then :¦ ¦ Pxl-Off(3+Z,3+X :¦ ¦ N→X:O→Z :¦ End :¦ If max([A](O+1,N+1)={6,24 :¦ Then :¦ ¦ Ans→H :¦ ¦ If P=1 and H=6:Then :¦ ¦ ¦ 3→X:8→Z:0→S:2→T:2→P:1→W :¦ ¦ End :¦ ¦ If P=2 and H=24:Then :¦ ¦ ¦ 4→X:7→Z:0→S:4→T:1→P:1→W :¦ ¦ End :¦ End :¦ "If K=DEL button, menu stuff blah blah blah :¦ "1→W :End```

X and Z are my current (x,y) coords, P is my map variable, S and T are my "viewable space begins here" coords, and H is a random variable.

I am having trouble getting the calc to recognize going out the house door back into the yard (stepping on tile 24 while P is 2). Is there any problem with my syntax that I'm missing? (Yes, I'm going to upload the entire file once I get home, but I'm curious is my problem is solvable without everything visible)
Does the "If P=1 and H=6" bit work? I'm pretty rusty with this manner of programming BASIC, but I'm not sure that

Code:
```:¦ If max([A](O+1,N+1)={6,24 :¦ Then :¦ ¦ Ans→H ```

works the way you intend it to. I don't think conditionals affect the ANS variable. But, if that segment works, then I'm not sure why the other one doesn't.
Tsukasa correctly observed that conditionals do not affect Ans, which is most likely what's tripping you up there.
Oh, okay. Now it's working (just forgot to post about it ).

How do I write a program that changes itself? My program sets up a matrix with set values, then later on changes some of the numbers in the matrix. But when I complete an action that causes the matrix to be reloaded, it overwrites the changes.
Not possible in BASIC unless you do some bizarre ASM-fu.

I'd say a good solution to your problem would be using a variable as a flag that, if 1 (or some arbitrary number), will skip the matrix reload and, if 0 (or another arbitrary number), will go ahead and perform it.

Or am I misinterpreting the problem?

 wow, way to not think, me
You can actually perform some very shady Self-Modification of code using the Celtic III routines in the Doors CS set of BASIC hybrid libraries. Souvik is our current expert on that, I think, and the last time that I brought it up, he seemed to not be too enthusiastic about it as a proper way to do the kind of thing you want to do.
So should I just load all the maps into matrices at the start-up, and then instead of loading info into the same matrix just pull up different ones (or use other parts of the same one, to increase # of maps)?
I know this also can be done with Celtic 2, as I store data into appvars and pull it back out directly from flash with no problem. And Matrices take up a lot of space in RAM, do you have it to spare?
As of now, yes. When I'm done (or most likely before then), probably not, especially if I want to try and condense this into 1 program.
If you use the Celtic III routines to perform on-the-fly modification of an appvar, that's fairly standard and a good idea. If you end up having very little space to spare, you could archive all except the current program/appvar that contains the current matrix in question.

Register to Join the Conversation
Have your own thoughts to add to this or any other topic? Want to ask a question, offer a suggestion, share your own programs and projects, upload a file to the file archives, get help with calculator and computer programming, or simply chat with like-minded coders and tech and calculator enthusiasts via the site-wide AJAX SAX widget? Registration for a free Cemetech account only takes a minute.

»
» All times are UTC - 5 Hours

You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum