Jump to content

Recommended Posts

  • Replies 89
  • Created
  • Last Reply

Top Posters In This Topic

I am going to read in the numbers in decimal. However, the number in the array of hex will be in hex. 100 decimal is not 100 hex. So if I did a search, I'd be searching say 42 in hex in my file and it will not get 66 dec like it should. I need to do a conversion at some point to a number so they're in the same format. It's two lines, I'm not worried.

Link to comment
Share on other sites

I am going to read in the numbers in decimal. However, the number in the array of hex will be in hex. 100 decimal is not 100 hex. So if I did a search, I'd be searching say 42 in hex in my file and it will not get 66 dec like it should. I need to do a conversion at some point to a number so they're in the same format. It's two lines, I'm not worried.

I do not understand what you are doing. Your database will be in an external text file? What format is the data going to be stored in? How are you performing these searches? What is this "hex array" you are referring to... is it a String array?

Those numbers are just index numbers. You could easily make a List(Of String) and add each move to that list at startup. Then you could pull the name of a given Move by using List(index), where index is the number of that move. Either 100 or &H64 would pull up the same move.

FYI: When I first started PKMDS, my data was also in external files, in CSV format. In order to obtain info, I would iterate through the file, reading one line at a time, and splitting each line into a string array using String.Split(","). Later I wisened up and began hardcoding my data, so now I use Dictionaries (basically hashtables) for lookup. It's much faster and more reliable than external files, and there is minimal (if any) data conversion necessary.

Link to comment
Share on other sites

OK, the .pkm file is read in byte by byte into a large array.

The information I am using, the Unicode values, the pokemon names, pokemon abilities etc are all in plain .txt files and read in line by line into record of arrays.

The point of converting is this. The array that stores the .pkm file stores it in hexadecimal. The file that I plan to have for the moves will list the moves by number. That number is in decimal format. What will happen is I will take the value of the move from the array that stores the .pkm file information, and search for it in my record of array for the move. Just for example, if I search A3, it would error because A3 doesn't exist, or 66 would bring up 66 instead of the other value it is supposed to. A simple conversion so they are the same format will work, and it's not hard, nor am I worried about it.

The other thing is that I will be constantly updating certain information in the program. I'll likely devise a format for it and allow others to help me. Text files are simple and make sense. Other parts might be easier, but I understand working with text files this way.

Edited by greentea
Link to comment
Share on other sites

OK, the .pkm file is read in byte by byte into a large array.

...

The array that stores the .pkm file stores it in hexadecimal.

So the data type of this array is Byte? Or is it String? Because if it is a Byte array, it would be much easier for you to arrange the data in a line-by-line format, so you can simply use the index number as a sort of pointer to the correct data in the file.

If it is a String array, then I insist that you are doing things the hard way.

Link to comment
Share on other sites

The array is a byte array. The way I access the offsets, I just say which number it is in the array. I have to name the offset in decimal not hex, but it's fine by me, it's never been a problem.

I got the ability up and someone already finished a list of the moves for me, so I'll try doing that sometime soon.

Link to comment
Share on other sites

Hey, been a few days, but everything so far is sorted out. I want to do the characteristics now and I saw http://www.serebii.net/games/characteristics.shtml. Is that accurate enough? I'm a little curious about what happens with ties, maybe I can get someone to check it.

I did some testing and found that there's a specific order they go in if they are tied. It goes in the normal order they are except HP goes to the bottom.

Edited by greentea
Link to comment
Share on other sites

I did some testing and found that there's a specific order they go in if they are tied. It goes in the normal order they are except HP goes to the bottom.

This is incorrect; see below.

In regards to ties for highest IVs, I posted this on Smogon a while ago:

I have finally figured out how the Pokémon DS games figure out which Characteristic to display in the Trainer Memo in the case of a tie for highest IVs.

Take the PID Mod 6, and that gives you the index number of a stat in this order: HP, Attack, Defense, Speed, Special Attack, Special Defense. In the event of a tie in IVs, the first IV checked is the result of the PID Mod 6. If that IV is not part of the tie, it moves on to the next index number in the aforementioned order. If it goes past 5 (Special Defense), it wraps around back to 0 (HP). When it finds an IV that is part of the tie, that is the IV that will determine the Characteristic displayed.

For the actual Characteristic texts, I recommend the article at Bulbapedia... I haven't looked at Serebii in a while, but I think there were typos in there somewhere.

EDIT:

By the way, the table at Serebii is a bit more complex than it needs to be. You're better off doing IV Mod 5 to figure out which of the five Characteristics to use for a particular IV.

Link to comment
Share on other sites

I'll check it all out later when I'm working on it. I don't mind if I have to do it Serebii style, it's not that hard really. I guess the simplest way is probably just another text file with some simple code like this. I will manipulate your part and a part to determine which IV largest is, but still not that hard honestly.

For counter = 0 to 31

if largest = characteristic(counter).attack_number

txtCharacteristic.text = characterstic(counter).char

Exit for

I guess I was wrong, it just seemed to go that way for every file I tested with. But I'm glad I got you to show me the real way.

Just a question, but I don't suppose I can show the stats can I? HP is offset 90 and a lot of files don't go that high in their hex. If it's possible, and not too hard, I wouldn't mind knowing some of that, stats would be useful.

Edited by greentea
Link to comment
Share on other sites

Once again, you should be more precise. Don't forget that "offset 90" the way you refer to it should really be 0x90, since it's a hex value. :D

Anyway, for PC storage Pokémon, the stats are calculated on the fly. X-Act posted the formula here.

In the stats formula section, I always write one formula that holds both for HP and for the other stats:

Stat = floor((floor((2 x BS + I + floor(EV/4)) x Level / 100) + X) x N)

where X = 5 if stat is not HP, and Level + 10 if stat is HP.

Note that BS = the base stat, I = the IV, and EV and Level are obvious enough.

Edited by codemonkey85
Link to comment
Share on other sites

I ran into a problem. The file I'm mainly working with, the hex goes up to 0x87. That code relies on myself having the level of the Pokemon, which is 0x8C. I'm currently programming it to work on the met at level but I'll definitely run into touched stuff.

Link to comment
Share on other sites

So basically I'm going to have to understand those formulas =(. Confusing enough, this is gonna take some time. I'm pretty much lost with the formula.

But aside from understanding it, I check to see which formula the pokemon uses, return the value, and check in a table of exp values.

Link to comment
Share on other sites

What you need to do is determine the growth rate of the PKM you are looking at, read its EXP, and find that value (or the next one down) in an EXP table.
But aside from understanding it, I check to see which formula the pokemon uses, return the value, and check in a table of exp values.

That's basically what I said. :P Incidentally, the games themselves don't use those formulas as far as I know; to save performance time, they simply use lookup tables (just like I've been doing, and just like I suggest you do).

Link to comment
Share on other sites

So then I can take http://www.upokecenter.com/games/rs/guides/exptable.php and code it, likely as a record of arrays from an input txt file. Then check the exp, 0x10-0x13, and convert it to long. Check where it lies on the chart and determine the level. Sites like Serebii have the info for which exp one they use.

Sounds good to me. Point of scaring me with those formulas?

Link to comment
Share on other sites

Just wanted to tell you that I produced a beta version of this. I plan to add a lot more to it later on, but the things I plan on doing, I am capable of doing them myself, it's mostly simple checks and an output to a file. Thanks for all of your help, without it, I would not have been able to create this program.

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...