Author Topic: stats routine  (Read 3329 times)

0 Members and 1 Guest are viewing this topic.

elfprince13

  • Guest
stats routine
« 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 atk
4->I //atk has index 4...see above
(L)PKMST(34)->D
iPart(D/(100^(I-1->D
(100)fPart(D/(100^I->D
Text(1,1,"Atk = ",D
Text(10,1,"HP = ",imag((L)PKMST(34)
c2
ec2


Offline kalan_vod

  • LV11 Super Veteran (Next: 3000)
  • ***********
  • Posts: 2715
  • Rating: +10/-0
    • View Profile
    • kalanrock.us
stats routine
« Reply #1 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 :Dbiggrin.gif.

elfprince13

  • Guest
stats routine
« Reply #2 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.

Offline kalan_vod

  • LV11 Super Veteran (Next: 3000)
  • ***********
  • Posts: 2715
  • Rating: +10/-0
    • View Profile
    • kalanrock.us
stats routine
« Reply #3 on: February 08, 2006, 04:53:00 am »
Oh, well thanks for clearing it up!