Jump to content



Photo
- - - - -

more variables for memory


  • Please log in to reply
15 replies to this topic

#1 glra2222

glra2222

    Newbie

  • Members
  • Pip
  • 17 posts

Posted 04 April 2003 - 11:59 PM

Im making an rpg and seem to be running out of variables for memory. Is there any other way of storing memory instead of using the variables?

#2 BiTwhise

BiTwhise

    Casio Overgod

  • [Legends]
  • PipPipPipPipPipPipPip
  • 627 posts
  • Gender:Male
  • Location:Guildford, Surry, UK
  • Interests:Programming, games, consoles, martial arts

  • Calculators:
    FX9700WE, CFX9970G, AFX2.0, Classpad 300

Posted 05 April 2003 - 12:40 AM

Use lists or matrixes

#3 CrimsonCasio

CrimsonCasio

    UCF Ambassador

  • [Legends]
  • PipPipPipPipPipPipPipPipPipPip
  • 3579 posts
  • Gender:Male
  • Location:USA
  • Interests:Claculators, Stephen King, Video Games, Calculators, Programming, Calculators, Reading, Calculators... hmm, what else... Ah! Calculators!

  • Calculators:
    Algebra FX2.0, CFX 9850Ga+, Classpad 300

Posted 05 April 2003 - 12:44 AM

sigh, I really got to get my tutorial out...

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. B)

#4 BiTwhise

BiTwhise

    Casio Overgod

  • [Legends]
  • PipPipPipPipPipPipPip
  • 627 posts
  • Gender:Male
  • Location:Guildford, Surry, UK
  • Interests:Programming, games, consoles, martial arts

  • Calculators:
    FX9700WE, CFX9970G, AFX2.0, Classpad 300

Posted 05 April 2003 - 12:49 AM

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.

unofficial standard... :lol:
and who figured out this naming convention?

#5 CrimsonCasio

CrimsonCasio

    UCF Ambassador

  • [Legends]
  • PipPipPipPipPipPipPipPipPipPip
  • 3579 posts
  • Gender:Male
  • Location:USA
  • Interests:Claculators, Stephen King, Video Games, Calculators, Programming, Calculators, Reading, Calculators... hmm, what else... Ah! Calculators!

  • Calculators:
    Algebra FX2.0, CFX 9850Ga+, Classpad 300

Posted 05 April 2003 - 12:52 AM

just something I have knoticed over the years, just take a look at almost any program. I think its just the natural thing to do and people have been doing it for years. :D

#6 BiTwhise

BiTwhise

    Casio Overgod

  • [Legends]
  • PipPipPipPipPipPipPip
  • 627 posts
  • Gender:Male
  • Location:Guildford, Surry, UK
  • Interests:Programming, games, consoles, martial arts

  • Calculators:
    FX9700WE, CFX9970G, AFX2.0, Classpad 300

Posted 05 April 2003 - 12:57 AM

Yeah, but it totally depends on what program your making, and in what context the matrix is put...

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 CrimsonCasio

CrimsonCasio

    UCF Ambassador

  • [Legends]
  • PipPipPipPipPipPipPipPipPipPip
  • 3579 posts
  • Gender:Male
  • Location:USA
  • Interests:Claculators, Stephen King, Video Games, Calculators, Programming, Calculators, Reading, Calculators... hmm, what else... Ah! Calculators!

  • Calculators:
    Algebra FX2.0, CFX 9850Ga+, Classpad 300

Posted 05 April 2003 - 12:59 AM

of course, my current rpg uses Mat L for the saves, Mat B for the battle map, Mat M for other maps.

#8 BiTwhise

BiTwhise

    Casio Overgod

  • [Legends]
  • PipPipPipPipPipPipPip
  • 627 posts
  • Gender:Male
  • Location:Guildford, Surry, UK
  • Interests:Programming, games, consoles, martial arts

  • Calculators:
    FX9700WE, CFX9970G, AFX2.0, Classpad 300

Posted 05 April 2003 - 01:02 AM

Exactly :)

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 B)

#9 CrimsonCasio

CrimsonCasio

    UCF Ambassador

  • [Legends]
  • PipPipPipPipPipPipPipPipPipPip
  • 3579 posts
  • Gender:Male
  • Location:USA
  • Interests:Claculators, Stephen King, Video Games, Calculators, Programming, Calculators, Reading, Calculators... hmm, what else... Ah! Calculators!

  • Calculators:
    Algebra FX2.0, CFX 9850Ga+, Classpad 300

Posted 05 April 2003 - 01:03 AM

agreed. B)

#10 glra2222

glra2222

    Newbie

  • Members
  • Pip
  • 17 posts

Posted 05 April 2003 - 01:43 AM

wait a minute, I use matrix for collision in maps but how do you use them for battle screens and saves?
plus, which one is better? lists or matrixes?

#11 CrimsonCasio

CrimsonCasio

    UCF Ambassador

  • [Legends]
  • PipPipPipPipPipPipPipPipPipPip
  • 3579 posts
  • Gender:Male
  • Location:USA
  • Interests:Claculators, Stephen King, Video Games, Calculators, Programming, Calculators, Reading, Calculators... hmm, what else... Ah! Calculators!

  • Calculators:
    Algebra FX2.0, CFX 9850Ga+, Classpad 300

Posted 05 April 2003 - 01:49 AM

same way you use them for anything, they are simply another type of variable.

here is an example:
List 1
<span class=1' />= Character Type
<span class=2' />= HP
<span class=3' />= MP
<span class=4' />= AP
<span class=5' />= DEF
<span class=6' />= ACC
<span class=7' />= Level
<span class=8' />...<span class=9' />...

in general, Lists are better than Matrixes for storing temporary data and Matrixes are better for long term storage.

#12 BiTwhise

BiTwhise

    Casio Overgod

  • [Legends]
  • PipPipPipPipPipPipPip
  • 627 posts
  • Gender:Male
  • Location:Guildford, Surry, UK
  • Interests:Programming, games, consoles, martial arts

  • Calculators:
    FX9700WE, CFX9970G, AFX2.0, Classpad 300

Posted 05 April 2003 - 09:59 AM

And lists are slightly faster in most cases..

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 rjstephens

rjstephens

    Casio Freak

  • Members
  • PipPipPipPip
  • 239 posts
  • Location:Brisbane, Queensland, Australia

  • Calculators:
    CFX9850GB+

Posted 05 April 2003 - 10:17 AM

also lists are limitless and you have a maximum matrix size of 99*99 (although a matrix this big doesn't fit in the memory of a 64k calc anyway)

#14 BiTwhise

BiTwhise

    Casio Overgod

  • [Legends]
  • PipPipPipPipPipPipPip
  • 627 posts
  • Gender:Male
  • Location:Guildford, Surry, UK
  • Interests:Programming, games, consoles, martial arts

  • Calculators:
    FX9700WE, CFX9970G, AFX2.0, Classpad 300

Posted 05 April 2003 - 10:32 AM

limitless... lists have a maximum dimension of 255 elements

#15 rjstephens

rjstephens

    Casio Freak

  • Members
  • PipPipPipPip
  • 239 posts
  • Location:Brisbane, Queensland, Australia

  • Calculators:
    CFX9850GB+

Posted 05 April 2003 - 10:43 AM

ok i was wrong. thanks for correcting me.

#16 CrimsonCasio

CrimsonCasio

    UCF Ambassador

  • [Legends]
  • PipPipPipPipPipPipPipPipPipPip
  • 3579 posts
  • Gender:Male
  • Location:USA
  • Interests:Claculators, Stephen King, Video Games, Calculators, Programming, Calculators, Reading, Calculators... hmm, what else... Ah! Calculators!

  • Calculators:
    Algebra FX2.0, CFX 9850Ga+, Classpad 300

Posted 05 April 2003 - 12:38 PM

List also take up less space, List 11 takes les memory than Mat A[1,1]. but I still favor Matrixes or a mixture of both.




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users