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...
Just use a single string with virtual concatenation. eg, If you want 3 strings of 16 chars each:

String"1" = sub(Str9,0,16)
String"2" = sub(Str9,16,16)
String"3" = sub(Str9,32,16)
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...


i used this for my listcompress program. If every value is less than 100, then you can use 2 digit groupings and take 5 small numers and combine them into 1 large number, therefore saving space
You know instead of any of that you could just use variables to store scores, lives, etc...

Ex.

Code:
100/->/L
Lbl A
Output(1,1,"Life:")
Output(1,6,L)
.....
ONSCREEN:
Life: 100
(Get attacked)
end ONSCREEN
......
L-1/->/L
Goto A


Thats just a random example, if you need to use stored numbers, letter variables are the best to use. There are 26 variables you can store any nnumber into ea. its the best way to me.

-Swivel
swivelgames wrote:
You know instead of any of that you could just use variables to store scores, lives, etc...


variables are temporary, take the same amount of space as 1 element of a list, and are limited in number

EDIT:
i forgot to mention this before, but you can access an individual digit in a number by using iPart() and fPart()

ex.

Code:
1234->x
disp iPart(10*fPart(x/100))

that should display 3
BIG EDIT:
Ow, I know now, thats why. Is it like a search that grabs the 3rd number from x? Thats extremely helpful.

-Swivel
swivelgames wrote:
Thats just a random example, if you need to use stored numbers, letter variables are the best to use. There are 26 variables you can store any nnumber into ea. its the best way to me.

-Swivel

Nooo...really??? Very Happy Just Joking
Actually, lists are preferable. While the access/read time is several ms slower, they can be saved in between program uses, have up to 999 elements, and can be custom-named.
Are you talking about lists? I have not been able to know how to use lists exactly there kinda complicated unless Im just too lazy to figure it out. So you can have multiple elements in lists, and can you pull a specific element from a list? Hopefully I can finaly learn about lists and not be so lazy about it. Is it possible to store Text data into Lists? I am not thinking so but if there is a way I would love to know. Anyway hopefully this will be my 'How not to be stupid and lazy' lesson for the day.

-Swivel
Lists can store any numerical value that can be put into a real or complex variable (A-Z and theta). In addition, lists can store multiple elements; imagine a list as a series of real or complex variables put together. You define the number of elements in a list thusly:
length-->dim(Lname

You store to, for example, the third element of a list thusly:
value-->Lname(3
Well thank you for that small lesson. Hey did you ever read the post I posted in Graphics forums. I would love if you did make that for me by the way.

-Swivel
Verily. Oh, and to read from a list, just use:
Lname(3

for example:
Output(Lname(1),Lname(2),"X

Edit: Ah, here we go:
http://www.cemetech.net/projects/btutor/btutor.php#36L
I will try that. What I am wanting to do is have 10000000 stored in a list, and then change the 0 to 1 once an event has been completed. Smile

Though playing with strings, I found out the same amount of numbers for events in a list, compared to a string, the string takes around 20 bytes less...
Indeed, because of the sign and mantissa bytes.
I guess, but you can create your own lists, and then they are also more flexible
Exactly, and you're not at the mercy of another prog overwriting one of the 10 strings.
right, your list can still be overwritten, but less chance of it
Yeah, and the more unique the name you use, the better.
Well, the name thing wouldn't be too hard, since it is for Pokemon... I just have to come up with a dynamic script that would be able to write to a digit of the value now, using Ipart... I wonder how large a number can be before it starts the short hand stuff...
That's easy - 12 digits. Just run one of the Brix Builder betas through SourceCoder and get my routine out. I'll find it if you want.
I will let you know if I can't find it, or can't make my own... Smile Shouldn't be too hard though...
  
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 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

 

Advertisement