# Omnimaga

## Calculator Community => TI Calculators => TI-BASIC => Topic started by: elfprince13 on February 07, 2006, 07:46:00 am

Title: stats routine
Post by: elfprince13 on February 07, 2006, 07:46:00 am
while helping tifreak8x over at UTI I had the idea for the following pseudo code, that I though all you RPG type guys might find useful:

QuoteBegin-elfprince13+Feb 7 2006, 01:32 PM-->
QUOTE (elfprince13 @ Feb 7 2006, 01:32 PM)

SetUpEditor will automatically create the list and/or unarchive it. then if you add one slot to the beginning of the list as a flag with a value like 3.979 you can tell if you had already created it and had data saved, or if its a blank list with no data in it.

for pokemon stats, have a variable length list that stores all the data, then use a routine based on the length of the stats. another trick you can use to save space is instead of using different slots for each stat, you can use one complex number to store all the stats for a single pokemon, and have the flag item be the starting pokemon.

here is some pseudo code to extract a stat from a complex number assuming that all stats other than HP max out at 100.

note that I am using (L) to represent the little L

c1-->
 CODE ec1//storing code[def](100^5)+[atk](100^4)+[spec](100^3)......+[hp]i->(L)PKMST(34)//extract atk4->I //atk has index 4...see above(L)PKMST(34)->DiPart(D/(100^(I-1->D(100)fPart(D/(100^I->DText(1,1,"Atk = ",DText(10,1,"HP = ",imag((L)PKMST(34)c2
ec2

Title: stats routine
Post by: kalan_vod on February 08, 2006, 02:15:00 am
The code looks great, but could you set up a situation where it would become useful? Maybe I am the only one not understanding it, but I am like that some times :D.
Title: stats routine
Post by: elfprince13 on February 08, 2006, 02:19:00 am
for example, Tifreak is planning to use lists to store save info for each pokemons stats, however instead of having say, 6 different items in the list for every pokemon you can cut it to only 1 list item per pokemon.
Title: stats routine
Post by: kalan_vod on February 08, 2006, 04:53:00 am
Oh, well thanks for clearing it up!