more variables for memory
#1
Posted 04 April 2003 - 11:59 PM
#2
Posted 05 April 2003 - 12:40 AM
#3
Posted 05 April 2003 - 12:44 AM
the best way is to use list files and matrixes
here is something I wrote in another post:
tipically use a matrix if I want multiple save "files" with each row or colum as a whole file. Lists are better for single save files, and they are simpler.
to access a cell in a matrix do this: (using matrix A)
Mat A[y,x] // y and x are coordinates in the matrix.
you can treat this just like a normal variable, anyplace you could put a number you can put this.
same goes with lists but the sentax is diffrent: (using list 1)
List 1[n] // n is the index number in the list
to create a matrix in a program do the folowing:
{r,c}->Dim Mat A // r is the number of rows and c is the number of colums
for lists it goes:
n->Dim List 1 // n is the number of cells
using the Dim function automatically sets all the cells in a matrix or list to 0, you have to fill them aftreward, this also means that you cannot have it Dim your save file every time you run the program because it would erase all the data. have an initalize option in the main menu to prevent this.
also remember that any thing you can do to one of the letter variables (A,B,C...r,o) you can do to a List or Mat, just make sure you dont try to access a place in the List/Mat that doesnt exist ( in a 10x10 Mat dont try Mat A[11,2]).
hope that helps.
from this you should be able to understand how to make and use matricies and lists, it is much more secure than using the letter variables (A~Z,r,o) because most programs use only one matrix/list. In my experiance Lists are more used than matrixes so they are more likley to be over written by other programs. another unofficial standard is that if you use a matrix you should use the one which corresponds to the first letter of the name of your program.
Hope this helps, make sure to keep us informed as to your progress.
#4
Posted 05 April 2003 - 12:49 AM
unofficial standard...another unofficial standard is that if you use a matrix you should use the one which corresponds to the first letter of the name of your program.
and who figured out this naming convention?
#5
Posted 05 April 2003 - 12:52 AM
#6
Posted 05 April 2003 - 12:57 AM
Say your working with something 3D (just as an example)
You might set your rotation matrix to Mat R, your Transformation matrix to Mat T, component rotation matrixes to Mat X, Y, and Z, your world matrix to W, and so on...
#7
Posted 05 April 2003 - 12:59 AM
#8
Posted 05 April 2003 - 01:02 AM
Since you can't specify unique variable names in Casio Basic, you always run the chance of having your data corrupted by other programs..
Anyway, lets just leave it at that, so we don't stray to far off topic
#9
Posted 05 April 2003 - 01:03 AM
#10
Posted 05 April 2003 - 01:43 AM
plus, which one is better? lists or matrixes?
#11
Posted 05 April 2003 - 01:49 AM
here is an example:
List 1
1' />= Character Type
2' />= HP
3' />= MP
4' />= AP
5' />= DEF
6' />= ACC
7' />= Level
8' />...9' />...
in general, Lists are better than Matrixes for storing temporary data and Matrixes are better for long term storage.
#12
Posted 05 April 2003 - 09:59 AM
plus they have some mathematical posibilities the matrix don't (and the other way around)
lists can be used as a sequence of variables in any mathematical expression..
they can also be sorted, if that's of any need
on the other hand,
matrixes can be augmented, transformed, Turned, used as vectors, etc
#13
Posted 05 April 2003 - 10:17 AM
#14
Posted 05 April 2003 - 10:32 AM
#15
Posted 05 April 2003 - 10:43 AM
#16
Posted 05 April 2003 - 12:38 PM
0 user(s) are reading this topic
0 members, 0 guests, 0 anonymous users