codemonkey85 Posted July 27, 2009 Posted July 27, 2009 Of course, I'll have to do a hex conversion or something Why? VB knows that 1 is the same thing as &H1, just like it knows 10 is the same thing as &HA. There's no need to convert anything as far as index numbers are concerned; the 1 - 467 will be fine.
greentea Posted July 27, 2009 Author Posted July 27, 2009 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.
codemonkey85 Posted July 27, 2009 Posted July 27, 2009 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.
greentea Posted July 27, 2009 Author Posted July 27, 2009 (edited) 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 July 27, 2009 by greentea
codemonkey85 Posted July 28, 2009 Posted July 28, 2009 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.
greentea Posted July 28, 2009 Author Posted July 28, 2009 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.
greentea Posted July 31, 2009 Author Posted July 31, 2009 (edited) 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 July 31, 2009 by greentea
codemonkey85 Posted July 31, 2009 Posted July 31, 2009 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.
greentea Posted August 1, 2009 Author Posted August 1, 2009 (edited) 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 August 1, 2009 by greentea
codemonkey85 Posted August 1, 2009 Posted August 1, 2009 (edited) 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. 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 August 1, 2009 by codemonkey85
greentea Posted August 1, 2009 Author Posted August 1, 2009 So if stat is HP, X = 0? And What exactly is N? And I'm not so familiar with math programming, like floor and ceiling stuff. Care to explain what floor is here?
Jiggy-Ninja Posted August 1, 2009 Posted August 1, 2009 If the stat is HP, X = Level + 10. N is the bonus Nature has on that stat. It's always either 0.9, 1.0, or 1.1. Floor means that you always round the number in parenthesis down. Floor( 2.999999 ) = 2.
greentea Posted August 1, 2009 Author Posted August 1, 2009 OK, I wasn't sure about floor. I remember seeing a similar formula when I first started, and I know about the increase stats.
Delta Blast Burn Posted August 1, 2009 Posted August 1, 2009 Stat = floor((floor((2 x BS + I + floor(EV/4)) x Level / 100) + X) x N) I Believe, If You use "Math.Floor" (w/o Quotations) At The Beginning Of The Entire Equation, It Applies To The Whole Thing. New Equation: Stat = Math.floor((((2 * BS + I + (EV/4)) * Level / 100) + X) * N) I Find That Alot Easier.
greentea Posted August 1, 2009 Author Posted August 1, 2009 I think math.floor will round the answer if you place it there. You need to round several times during the equation. It seems to me as though they would have already tried that.
codemonkey85 Posted August 2, 2009 Posted August 2, 2009 greentea is right about that. You need to do the floor on several parts of the equation separately for the whole thing to come out right. ;p
greentea Posted August 3, 2009 Author Posted August 3, 2009 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.
codemonkey85 Posted August 3, 2009 Posted August 3, 2009 The level is also calculated on the fly for PC storage Pokémon (Pokémon that are only 136 bytes, or 0x88 in hex). 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. See here for more info.
greentea Posted August 3, 2009 Author Posted August 3, 2009 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.
codemonkey85 Posted August 3, 2009 Posted August 3, 2009 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. 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).
greentea Posted August 3, 2009 Author Posted August 3, 2009 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?
codemonkey85 Posted August 3, 2009 Posted August 3, 2009 Again, I don't recommend using Long. Use UInt32. And I didn't show you the page to scare you with the formulas, just to show you the EXP tables and my source.
greentea Posted August 3, 2009 Author Posted August 3, 2009 Well, either way. It's going to take a while, well actually, I've been getting people to do them for me all along so yea =P.
greentea Posted August 4, 2009 Author Posted August 4, 2009 Thanks yet again you guys, after getting all the text files and a few hours of programming (because it took a while just to put all the information in), I've got the stats up =P
greentea Posted August 6, 2009 Author Posted August 6, 2009 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.
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now