» Goto page Previous  1, 2
TI-Freak8x wrote:
I came across an interesting discovery. I am trying to find the most optimized way to do 'event flags' in Pokemon, and I find that you store 10 to dim(L5, it will be 102 bytes in size. You can also store any value within the slots, and the size never changes. What I am wondering is is there a way to search for a specific digit using BASIC. I have never tried, but I thought maybe someone here has, to see if it was possible...

Otherwise, I could use strings, which would probably be a mem saver, but I still do not know how many strings I will need for me game...

Ummm...I gave you routines to do this...and it's bit compressed...
Also, complex numbers take twice the space as real ones, so as long as they're all reals, you don't need to worry about size changing.
Code for isolating digit in real number sotred in L1(Z):

Code:
```:For(A,0,ipart(log(L1(Z :If [testvalue]=ipart(10Fpart((10^-(A+1))*L1(Z :Then :... :End```

Basically uses logarithms and clever ipart()/fpart() manipulation to grab a digit. I came up with this for another program I made but lost to a RAM clear.
Yeah, that's basically the way I usually do it.
yeah, I made a digit extractor like that once or twice for base converters, and parsing numeric input to create Stat-sprites.
Kuro wrote:
Code for isolating digit in real number sotred in L1(Z):

Code:
```:For(A,0,ipart(log(L1(Z :If [testvalue]=ipart(10Fpart((10^-(A+1))*L1(Z :Then :... :End```

Basically uses logarithms and clever ipart()/fpart() manipulation to grab a digit. I came up with this for another program I made but lost to a RAM clear.

for a slight speed improvement, read L1(Z) to a variable (A-Z, theta) if you have to extract more than one digit (it takes alot longer for BASIC to read/write to lists than to variables)
kirb wrote:
TI-Freak8x wrote:
I came across an interesting discovery. I am trying to find the most optimized way to do 'event flags' in Pokemon, and I find that you store 10 to dim(L5, it will be 102 bytes in size. You can also store any value within the slots, and the size never changes. What I am wondering is is there a way to search for a specific digit using BASIC. I have never tried, but I thought maybe someone here has, to see if it was possible...

Otherwise, I could use strings, which would probably be a mem saver, but I still do not know how many strings I will need for me game...

Ummm...I gave you routines to do this...and it's bit compressed...
Also, complex numbers take twice the space as real ones, so as long as they're all reals, you don't need to worry about size changing.

When I ran the programs, the only thing it did was add or subtract an 8 digit number, I couldn't get it to do anything else...

Thanks guys, I will look at it.
Kllrnohj wrote:
Kuro wrote:
Code for isolating digit in real number sotred in L1(Z):

Code:
```:For(A,0,ipart(log(L1(Z :If [testvalue]=ipart(10Fpart((10^-(A+1))*L1(Z :Then :... :End```

Basically uses logarithms and clever ipart()/fpart() manipulation to grab a digit. I came up with this for another program I made but lost to a RAM clear.

for a slight speed improvement, read L1(Z) to a variable (A-Z, theta) if you have to extract more than one digit (it takes alot longer for BASIC to read/write to lists than to variables)

I'm assuming that TI freak needed to search an entire list, but variables work just as well.
I can just store the list element into a variable.

This way, I can reduce the number of list elements, and save a ton more memory.
K, great. Care to post the final routine you ended up with?
TI-Freak8x wrote:
I can just store the list element into a variable.

...thats what i said
I was talkin in reply to Kuro.

Also, yes, once I get it done, I will post the finished code.
TI-Freak8x wrote:
kirb wrote:
TI-Freak8x wrote:
I came across an interesting discovery. I am trying to find the most optimized way to do 'event flags' in Pokemon, and I find that you store 10 to dim(L5, it will be 102 bytes in size. You can also store any value within the slots, and the size never changes. What I am wondering is is there a way to search for a specific digit using BASIC. I have never tried, but I thought maybe someone here has, to see if it was possible...

Otherwise, I could use strings, which would probably be a mem saver, but I still do not know how many strings I will need for me game...

Ummm...I gave you routines to do this...and it's bit compressed...
Also, complex numbers take twice the space as real ones, so as long as they're all reals, you don't need to worry about size changing.

When I ran the programs, the only thing it did was add or subtract an 8 digit number, I couldn't get it to do anything else...

Thanks guys, I will look at it.

That's what they're supposed to do. Use the Test Routine to read the bit (S is 1 if that flag is set and 0 otherwise). Just because you dont recognize how it's stored doesn't mean it's not working. If you were to use a base converter to convert the number to binary, you would see the ones and zeros being set and unset in the string it outputs. The calc just turns it into decimal because that's what it does. Changing the flag to (un)set will change how much the number is changed by an appropriate amount.
TI-Freak8x wrote:
I can just store the list element into a variable.

This way, I can reduce the number of list elements, and save a ton more memory.

I assume you mean storing each element as a separate variable, and not as taking an element and then storing it to a var.
kirb wrote:
TI-Freak8x wrote:
kirb wrote:
TI-Freak8x wrote:
I came across an interesting discovery. I am trying to find the most optimized way to do 'event flags' in Pokemon, and I find that you store 10 to dim(L5, it will be 102 bytes in size. You can also store any value within the slots, and the size never changes. What I am wondering is is there a way to search for a specific digit using BASIC. I have never tried, but I thought maybe someone here has, to see if it was possible...

Otherwise, I could use strings, which would probably be a mem saver, but I still do not know how many strings I will need for me game...

Ummm...I gave you routines to do this...and it's bit compressed...
Also, complex numbers take twice the space as real ones, so as long as they're all reals, you don't need to worry about size changing.

When I ran the programs, the only thing it did was add or subtract an 8 digit number, I couldn't get it to do anything else...

Thanks guys, I will look at it.

That's what they're supposed to do. Use the Test Routine to read the bit (S is 1 if that flag is set and 0 otherwise). Just because you dont recognize how it's stored doesn't mean it's not working. If you were to use a base converter to convert the number to binary, you would see the ones and zeros being set and unset in the string it outputs. The calc just turns it into decimal because that's what it does. Changing the flag to (un)set will change how much the number is changed by an appropriate amount.

Ohhhhh! That is what I didn't understand... Why didn't you just say that? Now I need a converter thingy to make it so I can see what I am doing...

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.

»
» Goto page Previous  1, 2
» 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