I've been programming a text based RPG on my Prizm using its Program editor, and I've ran into several problems that I can't figure out D:

My first and biggest problem, is that I only have ~16 kilobytes of space left on my calculator's main memory, but yet I have tons more space on the storage memory. I don't quite understand why it's limited like that, and why Casio would put the entire Program folder into this section. My typical map rendering file and enemy battle controlling file are both ~2 kilobytes each, so I'll be running out of space very quickly. Is there a good reason that the memory is like this? If not, is there a way I can change the max byte limit for the main memory, or at least change the programs to be stored in the storage memory and still be able to use and edit them from the program editor?

My second problem, is that I'm not sure how I would efficiently render menus for things like items you have, or spells you've learned. I don't want items you don't have, or spells you haven't learned to appear in these menus, but I don't want there to be a big blank space where the name of the item/spell would be if you had it. Is there a way to do that efficiently?
Main memory and Storage memory are stored in very different ways on your calculator. Main memory is stored in RAM, which is fast, but its contents may disappear if you turn the calculator off unexpectedly (although in the case if the Prizm, it makes automatic backups that it restores). Storage memory is stored in Flash ROM, which is much larger than RAM, keeps its contents even with no power at all, and is slower. Programs cannot execute from Storage memory (Flash ROM) because it would be too slow. There might also be a few other reasons for why it doesn't work, but I don't know much about those.
Could the program be run from RAM, but load all of it's content(maps, sprites, etc.) from ROM?
DShiznit wrote:
Could the program be run from RAM, but load all of it's content(maps, sprites, etc.) from ROM?
It would make a lot of sense to do so, but I don't think Casio-BASIC allows you to move files between RAM and ROM.
Sarah wrote:
I've been programming a text based RPG on my Prizm using its Program editor, and I've ran into several problems that I can't figure out D:
Welcome to Cemetech, and thanks for coming to us with your Prizm issues. Be sure to Introduce Yourself when you get a chance.

Quote:
My first and biggest problem, is that I only have ~16 kilobytes of space left on my calculator's main memory, but yet I have tons more space on the storage memory.
As stated, because ROM is stored in various pages that get mapped to RAM address space, just as in the TI-83+/84+, it can't be used exactly as RAM, as my compatriots above mentioned. Until or unless someone make a nifty Prizm shell (Doors PX, anyone?), there's nothing we can do about it. Sad

Quote:
My second problem, is that I'm not sure how I would efficiently render menus for things like items you have, or spells you've learned. I don't want items you don't have, or spells you haven't learned to appear in these menus, but I don't want there to be a big blank space where the name of the item/spell would be if you had it. Is there a way to do that efficiently?
Yes! There are several ways you could approach this. Assuming that you're rolling your own menus on the homescreen, you can keep a variable recording the current Y coordinate of your text, and every time your conditionals decide that an option should be displayed, display at that current Y and increment it rather than using a hard-coded Y variable. Alternatively, build up a string or array full of options as you go through the conditionals, then render it in one shot at the end. The first technique is probably the easier of the two.
Welcome to Cemetech, Sarah! Please introduce yourself at the link in the previous post.

Regarding your second question, you could have a list where each element says whether you have that ability/spell or not. For instance, {Fireball, Whirlwind, Explode}. That means that element one would be for Fireball, 2 for Whirlwind, etc. And then you could say that a value less than 0 means that you don't have it and a value of 0 or higher means that you do (and how many times you can use it). Then you could have a program that would go through the list, and do the equivalent of the horribly optimized (And TI-Basic)
Code:
"Fireball,Whirlwind,Explode,"
For(A,1,3
If 0<=lSPELL(A
Disp Sub(Ans,1,Instring(Ans,",")-1
Sub(Ans,Instring(Ans,",")+1,Len(Ans)-1-Instring(Ans,","
End
That will loop through the string and display the name of the spell if lSPELL (ListSPELL) says that you have/can use it. Hopefully that makes sense :/
Awww.. What am I going to do for maps and enemies if I can't get more space? D:
I only have 8 maps and 2 enemies so far ;;

_player1537 wrote:
Welcome to Cemetech, Sarah! Please introduce yourself at the link in the previous post.

Regarding your second question, you could have a list where each element says whether you have that ability/spell or not. For instance, {Fireball, Whirlwind, Explode}. That means that element one would be for Fireball, 2 for Whirlwind, etc. And then you could say that a value less than 0 means that you don't have it and a value of 0 or higher means that you do (and how many times you can use it). Then you could have a program that would go through the list, and do the equivalent of the horribly optimized (And TI-Basic)
Code:
"Fireball,Whirlwind,Explode,"
For(A,1,3
If 0<=lSPELL(A
Disp Sub(Ans,1,Instring(Ans,",")-1
Sub(Ans,Instring(Ans,",")+1,Len(Ans)-1-Instring(Ans,","
End
That will loop through the string and display the name of the spell if lSPELL (ListSPELL) says that you have/can use it. Hopefully that makes sense :/


Well it's starting to make since Smiling Cat I just have to look over it a bit.
Perhaps you could throw a couple of those map/enemy programs at us to see if we can help optimize them?
_player1537 wrote:
Perhaps you could throw a couple of those map/enemy programs at us to see if we can help optimize them?


Code:
ProgramMode:RUN
{7,21}->Dim Mat A
1->Mat A[1,1]
1->Mat A[1,2]
1->Mat A[1,3]
1->Mat A[1,4]
1->Mat A[1,5]
1->Mat A[1,6]
1->Mat A[1,7]
1->Mat A[1,8]
1->Mat A[1,9]
1->Mat A[1,10]
1->Mat A[1,11]
1->Mat A[1,12]
1->Mat A[1,13]
1->Mat A[1,14]
1->Mat A[1,15]
1->Mat A[1,16]
1->Mat A[1,17]
1->Mat A[1,18]
1->Mat A[1,19]
1->Mat A[1,20]
1->Mat A[1,21]
1->Mat A[2,1]
0->Mat A[2,2]
0->Mat A[2,3]
0->Mat A[2,4]
0->Mat A[2,5]
0->Mat A[2,6]
0->Mat A[2,7]
0->Mat A[2,8]
0->Mat A[2,9]
0->Mat A[2,10]
0->Mat A[2,11]
0->Mat A[2,12]
0->Mat A[2,13]
0->Mat A[2,14]
0->Mat A[2,15]
0->Mat A[2,16]
0->Mat A[2,17]
0->Mat A[2,18]
0->Mat A[2,19]
0->Mat A[2,20]
1->Mat A[2,21]
1->Mat A[3,1]
0->Mat A[3,2]
0->Mat A[3,3]
0->Mat A[3,4]
0->Mat A[3,5]
0->Mat A[3,6]
0->Mat A[3,7]
0->Mat A[3,8]
0->Mat A[3,9]
1->Mat A[3,10]
1->Mat A[3,11]
1->Mat A[3,12]
0->Mat A[3,13]
0->Mat A[3,14]
0->Mat A[3,15]
0->Mat A[3,16]
0->Mat A[3,17]
0->Mat A[3,18]
0->Mat A[3,19]
0->Mat A[3,20]
1->Mat A[3,21]
1->Mat A[4,1]
0->Mat A[4,2]
0->Mat A[4,3]
0->Mat A[4,4]
0->Mat A[4,5]
0->Mat A[4,6]
0->Mat A[4,7]
0->Mat A[4,8]
0->Mat A[4,9]
1->Mat A[4,10]
0->Mat A[4,11]
1->Mat A[4,12]
0->Mat A[4,13]
0->Mat A[4,14]
0->Mat A[4,15]
0->Mat A[4,16]
0->Mat A[4,17]
0->Mat A[4,18]
0->Mat A[4,19]
0->Mat A[4,20]
1->Mat A[4,21]
1->Mat A[5,1]
0->Mat A[5,2]
0->Mat A[5,3]
0->Mat A[5,4]
0->Mat A[5,5]
0->Mat A[5,6]
0->Mat A[5,7]
0->Mat A[5,8]
0->Mat A[5,9]
1->Mat A[5,10]
0->Mat A[5,11]
1->Mat A[5,12]
0->Mat A[5,13]
0->Mat A[5,14]
0->Mat A[5,15]
0->Mat A[5,16]
0->Mat A[5,17]
0->Mat A[5,18]
0->Mat A[5,19]
0->Mat A[5,20]
1->Mat A[5,21]
1->Mat A[6,1]
0->Mat A[6,2]
0->Mat A[6,3]
0->Mat A[6,4]
0->Mat A[6,5]
0->Mat A[6,6]
0->Mat A[6,7]
0->Mat A[6,8]
0->Mat A[6,9]
0->Mat A[6,10]
0->Mat A[6,11]
0->Mat A[6,12]
0->Mat A[6,13]
0->Mat A[6,14]
0->Mat A[6,15]
0->Mat A[6,16]
0->Mat A[6,17]
0->Mat A[6,18]
0->Mat A[6,19]
0->Mat A[6,20]
1->Mat A[6,21]
1->Mat A[7,1]
1->Mat A[7,2]
1->Mat A[7,3]
1->Mat A[7,4]
1->Mat A[7,5]
1->Mat A[7,6]
1->Mat A[7,7]
1->Mat A[7,8]
1->Mat A[7,9]
1->Mat A[7,10]
0->Mat A[7,11]
1->Mat A[7,12]
1->Mat A[7,13]
1->Mat A[7,14]
1->Mat A[7,15]
1->Mat A[7,16]
1->Mat A[7,17]
1->Mat A[7,18]
1->Mat A[7,19]
1->Mat A[7,20]
1->Mat A[7,21]
1->X
1->Y
While X=X
Mat A[Y,X]=0=>Locate X,Y," "
Mat A[Y,X]=1=>Locate X,Y,"+"
X+1->X
If X=22
Then Y+1->Y
1->X
IfEnd
Y=8=>Break
WhileEnd


That's just a sample map file. Nothing fancy. The matrix is used to render the map first, and then used to detect whether or not you can move to a certain spot in the actual RPG.
Values >0 are things you can't move through, values >10 are signs/NPCs, values of -1 are chests, values of -2 are save points, and 0 is just nothing.

If I could find my calculator, I could give a much newer map file, but I can't. >:l
Ouch. Please tell me you didn't type that whole thing out, both on the calculator and to the forum x.x I just tried the usual way to write out matrices (Using [ and ]), but it didn't work. So, the alternative, and far better way is to use a list. For instance,
Code:
{0,0,0,0,0,0,0,0,0,1,1,0,1,0,1,1,1,1,0,1,1,0}->ListMAP
So on and so forth. Then to get the X/Y values if the map is 13x13
Code:
ListMAP(X*13+Y)
That, alone, should shrink each map file by about half.
Sarah, you should use Sourcecoder to post your code in a way that will be easier for us to collaborate on. You can find it here: http://www.cemetech.net/projects/basicelite/sourcecoder2.php

It also seems like it would be more space efficient to store the matrix directly instead of assigning an element at a time, or even to just transfer the matrix over as a file (can you do that with the Prizm)?
In many languages you can have something like [[1,2,3],[4,5,6],[7,8,9]]->[A]

[edit]
_player1537 wrote:
Ouch. Please tell me you didn't type that whole thing out, both on the calculator and to the forum x.x I just tried the usual way to write out matrices (Using [ and ]), but it didn't work. So, the alternative, and far better way is to use a list. For instance,
Code:
{0,0,0,0,0,0,0,0,0,1,1,0,1,0,1,1,1,1,0,1,1,0}->ListMAP
So on and so forth. Then to get the X/Y values if the map is 13x13
Code:
ListMAP(X*13+Y)
That, alone, should shrink each map file by about half.

Or a string is even better if you can use them in Prizm Basic the same way you can on a TI.
You can use them the same way. That thought didn't cross my mind, actually. If Sarah wants us to elaborate on the string method also, we can explain Smile
Well, elaborating would be nice, but would those methods work with this?


Code:
Y-1->Q
Y+1->R
X-1->S
X+1->T
Q=0=>1->Q
R=8=>7->R
S=0=>1->S
T=22=>21->T
If Getkey=28 And Y<>1 And Mat A[Q,X]=0
Then X->U
Y->V
Y-1->Y
Break
IfEnd
If Getkey=37 And Y<>7 And Mat A[R,X]=0
Then X->U
Y->V
Y+1->Y
Break
IfEnd
If Getkey=38 And X<>1 And Mat A[Y,S]=0
Then X->U
Y->V
X-1->X
Break
IfEnd
If Getkey=27 And X<>21 And Mat A[Y,T]=0
Then X->U
Y->V
X+1->X
Break
IfEnd

Again, if I had my calc, I could put the newer version of those lines of code in here, but they're still the same general idea.
elfprince13 wrote:
Sarah, you should use Sourcecoder to post your code in a way that will be easier for us to collaborate on. You can find it here: http://www.cemetech.net/projects/basicelite/sourcecoder2.php
I never finished getting all the tokens for the Prizm. Well, I have them I just haven't found unicode equivalents for all of them.
Sarah, a brief glance says that that is not right, because you're still using Mat A. Here is an example of a 4x4 map displayed on the homescreen (and I'll let you extend it Smile)
Code:
{1,1,1,1,1,0,0,1,1,0,0,1,1,1,1,1}->List MAP
For Y=0 TO 3
For X=0 TO 3
Locate X+1,Y+1,StrMid(" X",List MAP[X*4+Y+1],1)
End
End
Comic, hopefully Sarah will either be able to successfully use SourceCoder to share her programs, or any problems she finds will help us complete the token mapping tables. Smile
_player1537 wrote:
Sarah, a brief glance says that that is not right, because you're still using Mat A. Here is an example of a 4x4 map displayed on the homescreen (and I'll let you extend it Smile)
Code:
{1,1,1,1,1,0,0,1,1,0,0,1,1,1,1,1}->List MAP
For Y=0 TO 3
For X=0 TO 3
Locate X+1,Y+1,StrMid(" X",List MAP[X*4+Y+1],1)
End
End

You misunderstand. The second code was from a second file that runs the controls for moving around.
Ah, sorry about that. The only change you would need to make is to have every Mat A[Y,X] become List MAP[Y*WIDTH+X], where WIDTH is the width of your map.
Okay, my next question is how can I make this code smaller?

Code:
3->Dim List 10
Locate 1,1,"___"
While List 10[1]=0
Getkey->List 10[1]
WhileEnd
List 10[1]=76=>Locate 1,1,"A"
List 10[1]=66=>Locate 1,1,"B"
List 10[1]=56=>Locate 1,1,"C"
List 10[1]=46=>Locate 1,1,"D"
List 10[1]=36=>Locate 1,1,"E"
List 10[1]=26=>Locate 1,1,"F"
List 10[1]=75=>Locate 1,1,"G"
List 10[1]=65=>Locate 1,1,"H"
List 10[1]=55=>Locate 1,1,"I"
List 10[1]=45=>Locate 1,1,"J"
List 10[1]=35=>Locate 1,1,"K"
List 10[1]=25=>Locate 1,1,"L"
List 10[1]=74=>Locate 1,1,"M"
List 10[1]=64=>Locate 1,1,"N"
List 10[1]=54=>Locate 1,1,"O"
List 10[1]=73=>Locate 1,1,"P"
List 10[1]=63=>Locate 1,1,"Q"
List 10[1]=53=>Locate 1,1,"R"
List 10[1]=43=>Locate 1,1,"S"
List 10[1]=33=>Locate 1,1,"T"
List 10[1]=72=>Locate 1,1,"U"
List 10[1]=62=>Locate 1,1,"V"
List 10[1]=52=>Locate 1,1,"W"
List 10[1]=42=>Locate 1,1,"X"
List 10[1]=32=>Locate 1,1,"Y"
List 10[1]=71=>Locate 1,1,"Z"
While List 10[2]=0
Getkey->List 10[2]
WhileEnd
List 10[2]=76=>Locate 2,1,"A"
List 10[2]=66=>Locate 2,1,"B"
List 10[2]=56=>Locate 2,1,"C"
List 10[2]=46=>Locate 2,1,"D"
List 10[2]=36=>Locate 2,1,"E"
List 10[2]=26=>Locate 2,1,"F"
List 10[2]=75=>Locate 2,1,"G"
List 10[2]=65=>Locate 2,1,"H"
List 10[2]=55=>Locate 2,1,"I"
List 10[2]=45=>Locate 2,1,"J"
List 10[2]=35=>Locate 2,1,"K"
List 10[2]=25=>Locate 2,1,"L"
List 10[2]=74=>Locate 2,1,"M"
List 10[2]=64=>Locate 2,1,"N"
List 10[2]=54=>Locate 2,1,"O"
List 10[2]=73=>Locate 2,1,"P"
List 10[2]=63=>Locate 2,1,"Q"
List 10[2]=53=>Locate 2,1,"R"
List 10[2]=43=>Locate 2,1,"S"
List 10[2]=33=>Locate 2,1,"T"
List 10[2]=72=>Locate 2,1,"U"
List 10[2]=62=>Locate 2,1,"V"
List 10[2]=52=>Locate 2,1,"W"
List 10[2]=42=>Locate 2,1,"X"
List 10[2]=32=>Locate 2,1,"Y"
List 10[2]=71=>Locate 2,1,"Z"
While List 10[3]=0
Getkey->List 10[3]
WhileEnd
List 10[3]=76=>Locate 3,1,"A"
List 10[3]=66=>Locate 3,1,"B"
List 10[3]=56=>Locate 3,1,"C"
List 10[3]=46=>Locate 3,1,"D"
List 10[3]=36=>Locate 3,1,"E"
List 10[3]=26=>Locate 3,1,"F"
List 10[3]=75=>Locate 3,1,"G"
List 10[3]=65=>Locate 3,1,"H"
List 10[3]=55=>Locate 3,1,"I"
List 10[3]=45=>Locate 3,1,"J"
List 10[3]=35=>Locate 3,1,"K"
List 10[3]=25=>Locate 3,1,"L"
List 10[3]=74=>Locate 3,1,"M"
List 10[3]=64=>Locate 3,1,"N"
List 10[3]=54=>Locate 3,1,"O"
List 10[3]=73=>Locate 3,1,"P"
List 10[3]=63=>Locate 3,1,"Q"
List 10[3]=53=>Locate 3,1,"R"
List 10[3]=43=>Locate 3,1,"S"
List 10[3]=33=>Locate 3,1,"T"
List 10[3]=72=>Locate 3,1,"U"
List 10[3]=62=>Locate 3,1,"V"
List 10[3]=52=>Locate 3,1,"W"
List 10[3]=42=>Locate 3,1,"X"
List 10[3]=32=>Locate 3,1,"Y"
List 10[3]=71=>Locate 3,1,"Z"


It displays "___" in the top right corner. Pressing a key with a letter on it replaces "_" with that letter. Pressing a key without a letter skips that space. There are 3 spaces.
Step 1: Formulate something that turns the sequence {76,66,56,46,36,26,75,...} into the sequence {1, 2, 3, 4...}. Take X as any given key value:

(1a) Notice that it's sets of 6, counting down from 6. int(.1X)) gives {7,6,5,4,3,2,7,...}. We want to count up, so let's try 7-int(.1X) to get {0,1,2,3,4,5,0,...}.

(1b) Now we need to use the ones digit. The first 6 are 6, the next 6 are 5, next 6 are 4, etc. First we need the digit itself, we'll use X-10int(.1X) to get it. This will give us {6,6,6,6,6,6,5,5,5,5,5,5...}.

(1c) We want {0,0,0,0,0,0,6,6,6,6,6,6,12,12,12,12...} as our offsets, so we'll do 6(6-(X-10int(.1X))) = 36-6X+60int(.1X).

(1d) Now we put {0..., 6...., 12,... } together with {0,1,2,3,4,5,0,1...} to get {0, 1, 2, 3, 4, 5, 6, 7, ... 25}:
7-int(.1X)+36-6X+60int(.1X)

(1e) Simplify! 43-6X+59int(.1X). And we need to offset from 1, not 0, so 44-6X+59int(.1X)

Step 2: Grab a letter!

Code:
StrMid "ABCDEFGHIJKLMNOPQRSTUVWXYZ",44-6X+59int(.1X),1


Step 3: Put it all together!


Code:
3->Dim List 10
Locate 1,1,"___"
For X=1 TO 3
0->K
While K=0
Getkey->K
WhileEnd
K->List 10[X]
Locate X,1,StrMid "ABCDEFGHIJKLMNOPQRSTUVWXYZ",44-6X+59int(.1K),1
ForEnd


Hopefully that makes sense!
  
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.

» Go to Registration page
Page 1 of 3
» 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

 

Advertisement