Calculator Community > Pokemon Red

Pokemon Stats Generator

<< < (2/3) > >>

BuckeyeDude:
Cool thanks magic banana.
For the attack list stuff, thats because I stole this from my asm macros and had to do a find and replace on the equates, because C# you can't define stuff :( (although now that I think of it not sure why I didn't make them constants)
Good call on the other stuff, although the IVs would get calculated, the stats just wouldnt get updated :P.
As for why I commented out the moves learned code, I was too lazy to get it working. You can just select the move you want for the damage calculation :P. It works in the real game :P

Magic Banana:
No problem. :)

The only thing I couldn't figure out was how to organize a class by type so that I can get the attacks to be in alphabetical order. I've never worked in C# so I was just going off of what I knew in C and VB.NET to fix the other things. I've tried to use the normal Array.Sort( but it's not a 1 dimensional array. I tried to figure out how to use IComparable and CompareTo but I had no luck on it. If I can get that working, then I can just attach them to radio buttons so you can sort by index or name.

BuckeyeDude:
Just going off memory, you should override the Equals( method of the move class, compare the strings (string.Equals), then i think you can just say combobox.sorted = true;

EDIT: maybe combobox.sort() or combobox.items.sort() if any of those exist

Magic Banana:
Well, the combobox does have a sorted property, but using that just tears the program apart. I'm trying to think of a way to tell it which type it should be looking at when sorting the list before putting it into the combobox, because the normal Sort( commands just moves the name of the item and not all of the other members of that class. (I'm pretty sure Psychic isn't a normal move with 40 power and 30 pp).

I know CompareTo can be used to compare multiple data types, which can be changed using a public enum for the members in a class, but I don't know how to implement it.

If anything else, I can always make a second list and just replace the old one in the combobox, but that just seems like a waste of space for the program. Either that, or I can just rip out the index of the attacks since most people would probably prefer attacks to be sorted alphabetically while the pokemon are still sorted by index.

BuckeyeDude:

--- Quote from: Magic Banana on June 26, 2010, 03:18:25 pm ---Well, the combobox does have a sorted property, but using that just tears the program apart. I'm trying to think of a way to tell it which type it should be looking at when sorting the list before putting it into the combobox, because the normal Sort( commands just moves the name of the item and not all of the other members of that class. (I'm pretty sure Psychic isn't a normal move with 40 power and 30 pp).

--- End quote ---
When using the sorted property, the sorting uses the Equals() method to compare items.

add this to the Moves class

--- Code: ---public override bool Equals(object obj)
{
    return string.Equals(name, obj);
}
--- End code ---
and then you can use the sorted property of the combobox

Navigation

[0] Message Index

[#] Next page

[*] Previous page

Go to full version