Hey everyone i'm a little new to Cemetech and TI-Basic and I'm working on a text-based Pokemon game. It's going pretty well so far but to make things miles more efficient I need to know how to store the user's decisions as a variable or in a list or something along that path. For example, when the user is given the choice of three pokemon at the beginning, I need to store their decision as a pokemon that they can later use in battle. Any ideas? Graphing Calculator
Hey, welcome to Cemetech!

One way I would do it is to use a list. if you assign each of your Pokémon to a unique number, then you could have a list called ʟPKMN with 6 spots (or however many Pokémon you want your character to hold) to hold your characters Pokémon. Then in battle you could have the program look at that list to see which Pokémon your character is holding.

If you are relatively new to programming or need help with your program TI-Basic Developer is an amazing place to find answers. Personally I use their command index and their starter kit the most.

Good luck! Very Happy
Thanks a bunch @TheLastMillennial!
Yep, I think the method mentioned above is a good way to go. Basically, you could have a list like: {1,2,4,5} which represents {Bulbasaur, Ivysaur, Charmander, Charmeleon}
Then, when you want to know what Pokémon the player has, you can just refer to that list. One thing you might want to note though, is that using this method makes it exceedingly easy for users to cheat and give themselves whatever Pokémon they want. But then again, this is a calculator game, so there isn't really any motivation for someone to cheat...
This seems like a popular endeavor for rising calculator connoisseurs! I suggest creating another development topic to showcase what you've been working on and to get suggestions! Take a look here for inspiration, if you need any.
Um here's a couple of code I just whipped up

Code:

Clrhome
Disp"Pokemon","Pokemon 1","Pokemon 2","Pokemon 3"

Or you can just use a menu
The issue with using a list in this instance is that you cannot save each pokemon's data in-line with it; you have to create disassociated lists or something. If storing data like this, perhaps a matrix, while unyeildy, might be better, so that you can save stats like HP and what moves your pokemon knows. Then you merely have a single variable for pointing to which is the active pokemon.
Luxen wrote:
The issue with using a list in this instance is that you cannot save each pokemon's data in-line with it; you have to create disassociated lists or something. If storing data like this, perhaps a matrix, while unyeildy, might be better, so that you can save stats like HP and what moves your pokemon knows. Then you merely have a single variable for pointing to which is the active pokemon.


However, be mindful of the limitations of a matrix:

1) Slow and bulky
2) Their max total size is 400 "squares". (IIRC)
3) They can get a little confusing. (i.e. using row, column instead of x,y. This is something you just have to get used to, unfortunately.)

I recommend using separate lists to store pokemon, or even strings.
Strings are somewhat harder to work with, but with their length being unlimited, they may actually be worth it.

EDIT: Yes you could store it all in one list:
{poke1stat1, poke1stat2, poke1stat3, poke2stat1, poke2stat2, poke2stat3...pokeBstatA -> L1 (assuming L1 is the list you are using)
Let's call the number of stats per pokemon 'N'
Then, you could reference stat 'A' of pokemon 'B' by using:


Code:
L1(NB - ((N + 1) - A))

It sounds complicated, but it really isn't.

Let's break it down:

There are 'N' attributes that each pokemon has (say, health, level, id or whatnot, I've never played the game)
You can store each of these into the list, side by side. Using my examples of health, level, and id, it would look like this for only one pokemon:

Code:
{health, level, id -> L1

You can easily reference this pokemon's health, level, and id!

Now, let's string a bunch of those together. Say, 3.

Code:
{health, level, id, health, level, id, health, level, id -> L1


Here are my example statistics:
The first pokemon has 100 health, is level 2 and has an ID of 3
The second pokemon has 75 health, is level 8 and has an ID of 1
The third pokemon has 125 health, is level 3 and has an ID of 9
(I pulled these out of a hat, it doesn't matter. I just want to use an example.)

With this information, our list looks like this:

Code:
{100, 2, 3, 75, 8, 1, 125, 3, 9 -> L1


Now, it's a little more complicated.
You have the stats of 3 pokemon in one list, but you only want to reference the stats of one of the pokemon, for this example I will use the second one.

Using the formula I gave above, we can get the stats of the second pokemon like this:

Code:
{100, 2, 3, 75, 8, 1, 125, 3, 9 -> L1
3 -> N //3 stats per pokemon
2 -> B //we want to see the stats of the second pokemon
//I will use a for( loop to get each stat of the pokemon
For(A, 1, N
Disp L1(NB - ((N+1) - A)
End


Of course, you would want to replace 'N' with the actual number and simplify from there.

I hope this helps... (I tried not to ramble on and on but I probably did)
Alvajoy123 wrote:
Um here's a couple of code I just whipped up

Code:

Clrhome
Disp"Pokemon","Pokemon 1","Pokemon 2","Pokemon 3"

Or you can just use a menu

For a menu you need to know how you want to program; with lots of gotos and labels(the menu command) or lots of variables from custom menus, and this examples isn't that great, because 1, it uses disp when output would work better, and you can't select anything. You would need to add a loops with get key to actually have that working.

So basically, use gotos and labels, which isn't the best practice, or do a custom menu which is a bit harder but more worthwhile imo.

Good luck Smile
Hey thanks for all your help you guys. I'm taking a break for the summer however because i am working on bigger projects that are not for the calculator, but for the computer (a system which I am more familiar with and is more fun to work with.) I will get back to work when the school year starts, as all the work I did on this project was during study hall 😆. Sorry this project that should be small is taking so long, but hopefully I can get it done quickly when school starts back up.
E1T1gre wrote:
Hey thanks for all your help you guys. I'm taking a break for the summer however because i am working on bigger projects that are not for the calculator, but for the computer (a system which I am more familiar with and is more fun to work with.) I will get back to work when the school year starts, as all the work I did on this project was during study hall 😆. Sorry this project that should be small is taking so long, but hopefully I can get it done quickly when school starts back up.

It's okay, don't worry. Wink Also, you might post about the project, if it's interesting? Rolling Eyes
E1T1gre wrote:
Hey thanks for all your help you guys. I'm taking a break for the summer however because i am working on bigger projects that are not for the calculator, but for the computer (a system which I am more familiar with and is more fun to work with.) I will get back to work when the school year starts, as all the work I did on this project was during study hall 😆. Sorry this project that should be small is taking so long, but hopefully I can get it done quickly when school starts back up.


I agree with every single point in here, I am significantly demotivated to be on my calc during the summer, and would much rather be writing a computer program!
PT_ wrote:
E1T1gre wrote:
Hey thanks for all your help you guys. I'm taking a break for the summer however because i am working on bigger projects that are not for the calculator, but for the computer (a system which I am more familiar with and is more fun to work with.) I will get back to work when the school year starts, as all the work I did on this project was during study hall 😆. Sorry this project that should be small is taking so long, but hopefully I can get it done quickly when school starts back up.

It's okay, don't worry. Wink Also, you might post about the project, if it's interesting? Rolling Eyes


Oh yea, I'll post the code for the game soon. There are parts with empty space for future code and parts that might not make much sense (they will be changed ) but I'll post it so u guys can see.
  
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 1
» 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