The PokéCommunity Forums Fan Games Game Development Scripts & Tutorials
Essentials Script Script that reads Pokemon data from a GB/GBC savefile to be used in a fangame

Scripts & Tutorials This forum is for scripts and code, as well as all kinds of tutorials, software, tools and so forth. Remember to give credit!
The thread revival limit does not apply here.

Reply
 
Thread Tools
  #1    
Old February 2nd, 2017 (10:26 PM). Edited February 23rd, 2017 by rigbycwts.
rigbycwts's Avatar
rigbycwts rigbycwts is offline
Hmm, hmm.
     
    Join Date: Mar 2013
    Gender: Male
    Nature: Timid
    Posts: 98
    I was tremendously inspired by the latest Pokemon Bank update to write this script. Currently this reads a Gen 1 savefile that is placed inside a directory.

    Note: to avoid breaking codes, set the thread to Printable Version.

    Modify PokeBattle_Pokemon to enable the number that identifies the generated Pokemon, which explains the extra attribute.
    Add the following in the attr_accessors area of PokeBattle_Pokemon:
    Spoiler:

    Code:
      attr_accessor(:generated) # Determines where the Pokemon is generated:
                                # 0 - fangames
                                # 1 to 5 - official games, gens 1 to 5
                                # 6 - Pokemon Go

    Add the following methods above def timeEggHatched
    Spoiler:

    Code:
    # Returns the number corresponding to how the Pokemon is generated.
      def generated
        @generated=0 if [email protected]
        return
      end
    
    # Sets the number corresponding to how the Pokemon is generated.
      def generated=(value)
        @generated=value
      end

    Inside def initialize, add the following line, below calcStats:
    Spoiler:

    Code:
    @generated=0


    Save the following image as Choices.png and put it in Graphics/Pictures/PokeDepot:
    https://ibin.co/3Ca07P4GmgBv.png

    Savefile reading functions:
    Spoiler:

    Code:
    ###############################################################################
    # This script section contains methods that is used to read any save file.
    ###############################################################################
    
    ###############################################################################
    # Hex methods are for the OT and Pokemon nicknames.
    ###############################################################################
    def read_hex_io(io, offset, count)
      io.seek offset, File::SEEK_SET
      bytes = io.read count
      bytes.unpack("H*").shift
    end
    
    def read_hex(file, offset, count)
      File.open(file, "rb") do |io|
        read_hex_io io, offset, count
      end
    end
    
    ###############################################################################
    # Int methods are for the OT ID.
    # Note that Gen 1 games use Big Endian.
    ###############################################################################
    def read_intBigEndian_io(io, offset, count)
      io.seek offset, File::SEEK_SET
      bytes = io.read count
      bytes.unpack("n").shift
    end
    
    def read_intBigEndian(file, offset, count)
      File.open(file, "rb") do |io|
        read_intBigEndian_io io, offset, count
      end
    end
    
    ###############################################################################
    # Functions to determine which stat gets perfect IVs.
    ###############################################################################
    def numGen(array)
        random = rand(6)
    
      if array.include?(random)
            return numGen(array)
        end
        return random
    end
    
    def getIndexeswithPerfectIV(numPerfectIVs=3)
        arrayPerfectIVindexes = []
        for i in 0...numPerfectIVs
            arrayPerfectIVindexes.push(numGen(arrayPerfectIVindexes))
        end
        return arrayPerfectIVindexes.sort
    end
    
    ###############################################################################
    # Outside of class functions necessary for converting hex to strings and more.
    ###############################################################################
    
    # Converts the key to its ASCII equivalent on the table.
    # If the hex string is 0xAB, the key is AB.
    # Keys are treated as strings.
    def getCorrespondingCharacter(key, table)
        if table.include?(key)
            return table[key]
        end
    end
    
    # Converts bytes to integers.
    # Gen 1 uses big endian.
    def getBytesToInt16(savefile, offset, byteLength)
        return read_intBigEndian(savefile, offset, byteLength)
    end
    
    # Gets a single key, treated as string.
    def getSingleKeyInHex(savefile, offset, byteLength=2)
        return read_hex(savefile, offset, byteLength)
    end
    
    # Returns an array of keys.
    def getArrayOfKeys(savefile, offset, byteLength)
        return read_hex(savefile, offset, byteLength).scan(/../)
    end
    
    # The array of keys are converted to an array of characters.
    def getArrayOfCharacters(arrayOfKeys, table)
        arrayOfChars = []
        for i in 0...arrayOfKeys.length
            arrayOfChars.insert(i, getCorrespondingCharacter(arrayOfKeys[i].upcase, table))
        end
        return arrayOfChars
    end
    
    # Language-related methods.
    def isInternational(savefileName, japaneseOffsetChecker)
        return !isJapanese(savefileName, japaneseOffsetChecker)
    end
    
    def isJapanese(savefileName, japaneseOffsetChecker)
        partyPokemonList = getArrayOfKeys(savefileName, japaneseOffsetChecker[0], 30)
        for i in 0...partyPokemonList.length
            if partyPokemonList[i] != '00'
                return true
            end
        end
        return false
    end


    Gen 1 utilities:
    Spoiler:

    Code:
    ###############################################################################
    # This script section contains classes that read the save files from RBY.
    ###############################################################################
    
    # Constants for function use
    GEN1SAVE_DIRNAME = "Gen 1 Save"
    NULL_TERMINATOR = '\0'
    GEN1_MET = "Relocated from Kanto in the good old days."
    
    # Constants for box data manipulation
    GEN1_CURRENT_BOX_OFFSET = 0x284C
    ENTRIES_USED_OFFSET = 0x0000
    SPECIES_LIST_OFFSET = 0x0001
    POKEMON_LIST_OFFSET = 0x0016 # Multiply by 2, for example, to get 2nd Pokemon in the box
    OT_NAMES_OFFSET = 0x02AA
    POKEMON_NICKNAMES_OFFSET = 0x0386
    
    # Reads the Gen 1 Data Structures.
    SPECIES_INDEX_OFFSET = 0x00
    SPECIES_MOVES_OFFSETS = [0x08, 0x09, 0x0A, 0x0B]
    SPECIES_OT_ID_OFFSET = 0x0C # 2 bytes
    SPECIES_EXP_OFFSET = 0x0E # 3 bytes
    SPECIES_DV_OFFSET = 0x1B # 2 bytes, 4 bits for each DV/IV excluding HP
    
    # Savefile language checker
    US_OFFSET_CHECKER = [0x2F2C, 0x30C0]
    JP_OFFSET_CHECKER = [0x2ED5, 0x302D]
    
    ###############################################################################
    # Tables to be used by the hex and possibly int methods above.
    ###############################################################################
    # Used for Pokemon nicknames and OT names
    RBY_To_ASCII = {
        '50' => '\0', # null terminator
        '7F' => ' ', # space
        '80' => 'A',
        '81' => 'B',
        '82' => 'C',
        '83' => 'D',
        '84' => 'E',
        '85' => 'F',
        '86' => 'G',
        '87' => 'H',
        '88' => 'I',
        '89' => 'J',
        '8A' => 'K',
        '8B' => 'L',
        '8C' => 'M',
        '8D' => 'N',
        '8E' => 'O',
        '8F' => 'P',
        '90' => 'Q',
        '91' => 'R',
        '92' => 'S',
        '93' => 'T',
        '94' => 'U',
        '95' => 'V',
        '96' => 'W',
        '97' => 'X',
        '98' => 'Y',
        '99' => 'Z',
        '9A' => '[',
        '9B' => '\\',
        '9C' => ']',
        '9D' => '^',
        '9E' => '_',
        '9F' => '`',
        'A0' => 'a',
        'A1' => 'b',
        'A2' => 'c',
        'A3' => 'd',
        'A4' => 'e',
        'A5' => 'f',
        'A6' => 'g',
        'A7' => 'h',
        'A8' => 'i',
        'A9' => 'j',
        'AA' => 'k',
        'AB' => 'l',
        'AC' => 'm',
        'AD' => 'n',
        'AE' => 'o',
        'AF' => 'p',
        'B0' => 'q',
        'B1' => 'r',
        'B2' => 's',
        'B3' => 't',
        'B4' => 'u',
        'B5' => 'v',
        'B6' => 'w',
        'B7' => 'x',
        'B8' => 'y',
        'B9' => 'z',
        'E3' => '-',
        'E6' => '?',
        'E7' => '!',
        'E8' => '.',
        'EF' => '♂', # Male Gender icon
        'F2' => '.',
        'F3' => '/',
        'F4' => ',',
        'F5' => '♀', # Female Gender icon
        'F6' => '0', 
        'F7' => '1', 
        'F8' => '2', 
        'F9' => '3', 
        'FA' => '4', 
        'FB' => '5', 
        'FC' => '6', 
        'FD' => '7', 
        'FE' => '8', 
        'FF' => '9'
        }
      
    RBY_TO_CONVERTED_KANA = {
        '05' => 'Ga',
        '06' => 'Gi',
        '07' => 'Gu',
        '08' => 'Ge',
        '09' => 'Go',
        '0A' => 'Za',
        '0B' => 'Zi',
        '0C' => 'Zu',
        '0D' => 'Ze',
        '0E' => 'Zo',
        '0F' => 'Da',
        '10' => 'Di',
        '11' => 'Dzu',
        '12' => 'De',
        '13' => 'Do',
        '19' => 'Ba',
        '1A' => 'Bi',
        '1B' => 'Bu',
        '1C' => 'Bo',
        '26' => 'Ga',
        '27' => 'Gi',
        '28' => 'Gu',
        '29' => 'Ge',
        '2A' => 'Go',
        '2B' => 'Za',
        '2C' => 'Zi',
        '2D' => 'Zu',
        '2E' => 'Ze',
        '2F' => 'Zo',
        '30' => 'Da',
        '31' => 'Di',
        '32' => 'Dzu',
        '33' => 'De',
        '34' => 'Do',
        '3A' => 'Ba',
        '3B' => 'Bi',
        '3C' => 'Bu',
        '3D' => 'Be',
        '3E' => 'Bo',
        '40' => 'Pa',
        '41' => 'Pi',
        '42' => 'Pu',
        '43' => 'Po',
        '44' => 'Pa',
        '45' => 'Pi',
        '46' => 'Pu',
        '47' => 'Pe',
        '48' => 'Po',
        '50' => '\0',
        '80' => 'A',
        '81' => 'I',
        '82' => 'U',
        '83' => 'E',
        '84' => 'O',
        '85' => 'Ka',
        '86' => 'Ki',
        '87' => 'Ku',
        '88' => 'Ke',
        '89' => 'Ko',
        '8A' => 'Sa',
        '8B' => 'Si',
        '8C' => 'Su',
        '8D' => 'Se',
        '8E' => 'So',
        '8F' => 'Ta',
        '90' => 'Chi',
        '91' => 'Tsu',
        '92' => 'Te',
        '93' => 'To',
        '94' => 'Na',
        '95' => 'Ni',
        '96' => 'Nu',
        '97' => 'Ne',
        '98' => 'No',
        '99' => 'Ha',
        '9A' => 'Hi',
        '9B' => 'Hu',
        '9C' => 'Ho',
        '9D' => 'Ma',
        '9E' => 'Mi',
        '9F' => 'Mu',
        'A0' => 'Me',
        'A1' => 'Mo',
        'A2' => 'Ya',
        'A3' => 'Yu',
        'A4' => 'Yo',
        'A5' => 'Ra',
        'A6' => 'Ru',
        'A7' => 'Re',
        'A8' => 'Ro',
        'A9' => 'Wa',
        'AA' => 'Wo',
        'AB' => 'n',
        'AC' => '', # shortens sound
        'AD' => 'ya',
        'AE' => 'yu',
        'AF' => 'yo',
        'B0' => 'i',
        'B1' => 'A',
        'B2' => 'I',
        'B3' => 'U',
        'B4' => 'E',
        'B5' => 'O',
        'B6' => 'Ka',
        'B7' => 'Ki',
        'B8' => 'Ku',
        'B9' => 'Ke',
        'BA' => 'Ko',
        'BB' => 'Sa',
        'BC' => 'Shi',
        'BD' => 'Su',
        'BE' => 'Se',
        'BF' => 'So',
        'C0' => 'Ta',
        'C1' => 'Chi',
        'C2' => 'Tsu',
        'C3' => 'Te',
        'C4' => 'To',
        'C5' => 'Na',
        'C6' => 'Ni',
        'C7' => 'Nu',
        'C8' => 'Ne',
        'C9' => 'No',
        'CA' => 'Ha',
        'CB' => 'Hi',
        'CC' => 'Hu',
        'CD' => 'He',
        'CE' => 'Ho',
        'CF' => 'Ma',
        'D0' => 'Mi',
        'D1' => 'Mu',
        'D2' => 'Me',
        'D3' => 'Mo',
        'D4' => 'Ya',
        'D5' => 'Yu',
        'D6' => 'Yo',
        'D7' => 'Ra',
        'D8' => 'Ri',
        'D9' => 'Ru',
        'DA' => 'Re',
        'DB' => 'Ro',
        'DC' => 'Wa',
        'DD' => 'Wo',
        'DE' => 'n',
        'DF' => '', # shortens sound
        'E0' => 'ya',
        'E1' => 'yu',
        'E2' => 'yo',
        'E3' => '', # prolongs sound
        'E9' => 'a'
    }
    
    HEX_TO_PBSPECIES = {
        '01' => :RHYDON,
        '02' => :KANGASKHAN,
        '03' => :NIDORANmA,
        '04' => :CLEFAIRY,
        '05' => :SPEAROW,
        '06' => :VOLTORB,
        '07' => :NIDOKING,
        '08' => :SLOWBRO,
        '09' => :IVYSAUR,
        '0a' => :EXEGGUTOR,
        '0b' => :LICKITUNG,
        '0c' => :EXEGGCUTE,
        '0d' => :GRIMER,
        '0e' => :GENGAR,
        '0f' => :NIDORANfE,
        '10' => :NIDOQUEEN,
        '11' => :CUBONE,
        '12' => :RHYHORN,
        '13' => :LAPRAS,
        '14' => :ARCANINE,
        '15' => :MEW,
        '16' => :GYARADOS,
        '17' => :SHELLDER,
        '18' => :TENTACOOL,
        '19' => :GASTLY,
        '1a' => :SCYTHER,
        '1b' => :STARYU,
        '1c' => :BLASTOISE,
        '1d' => :PINSIR,
        '1e' => :TANGELA,
        '21' => :GROWLITHE,
        '22' => :ONIX,
        '23' => :FEAROW,
        '24' => :PIDGEY,
        '25' => :SLOWPOKE,
        '26' => :KADABRA,
        '27' => :GRAVELER,
        '28' => :CHANSEY,
        '29' => :MACHOKE,
        '2a' => :MRMIME,
        '2b' => :HITMONLEE,
        '2c' => :HITMONCHAN,
        '2d' => :ARBOK,
        '2e' => :PARASECT,
        '2f' => :PSYDUCK,
        '30' => :DROWZEE,
        '31' => :GOLEM,
        '33' => :MAGMAR,
        '35' => :ELECTABUZZ,
        '36' => :MAGNETON,
        '37' => :KOFFING,
        '39' => :MANKEY,
        '3a' => :SEEL,
        '3b' => :DIGLETT,
        '3c' => :TAUROS,
        '40' => :FARFETCHD,
        '41' => :VENONAT,
        '42' => :DRAGONITE,
        '46' => :DODUO,
        '47' => :POLIWAG,
        '48' => :JYNX,
        '49' => :MOLTRES,
        '4a' => :ARTICUNO,
        '4b' => :ZAPDOS,
        '4c' => :DITTO,
        '4d' => :MEOWTH,
        '4e' => :KRABBY,
        '52' => :VULPIX,
        '53' => :NINETALES,
        '54' => :PIKACHU,
        '55' => :RAICHU,
        '58' => :DRATINI,
        '59' => :DRAGONAIR,
        '5a' => :KABUTO,
        '5b' => :KABUTOPS,
        '5c' => :HORSEA,
        '5d' => :SEADRA,
        '60' => :SANDSHREW,
        '61' => :SANDSLASH,
        '62' => :OMANYTE,
        '63' => :OMASTAR,
        '64' => :JIGGLYPUFF,
        '65' => :WIGGLYTUFF,
        '66' => :EEVEE,
        '67' => :FLAREON,
        '68' => :JOLTEON,
        '69' => :VAPOREON,
        '6a' => :MACHOP,
        '6b' => :ZUBAT,
        '6c' => :EKANS,
        '6d' => :PARAS,
        '6e' => :POLIWHIRL,
        '6f' => :POLIWRATH,
        '70' => :WEEDLE,
        '71' => :KAKUNA,
        '72' => :BEEDRILL,
        '74' => :DODRIO,
        '75' => :PRIMEAPE,
        '76' => :DUGTRIO,
        '77' => :VENOMOTH,
        '78' => :DEWGONG,
        '7b' => :CATERPIE,
        '7c' => :METAPOD,
        '7d' => :BUTTERFREE,
        '7e' => :MACHAMP,
        '80' => :GOLDUCK,
        '81' => :HYPNO,
        '82' => :GOLBAT,
        '83' => :MEWTWO,
        '84' => :SNORLAX,
        '85' => :MAGIKARP,
        '88' => :MUK,
        '8a' => :KINGLER,
        '8b' => :CLOYSTER,
        '8d' => :ELECTRODE,
        '8e' => :CLEFABLE,
        '8f' => :WEEZING,
        '90' => :PERSIAN,
        '91' => :MAROWAK,
        '93' => :HAUNTER,
        '94' => :ABRA,
        '95' => :ALAKAZAM,
        '96' => :PIDGEOTTO,
        '97' => :PIDGEOT,
        '98' => :STARMIE,
        '99' => :BULBASAUR,
        '9a' => :VENUSAUR,
        '9b' => :TENTACRUEL,
        '9d' => :GOLDEEN,
        '9e' => :SEAKING,
        'a3' => :PONYTA,
        'a4' => :RAPIDASH,
        'a5' => :RATTATA,
        'a6' => :RATICATE,
        'a7' => :NIDORINO,
        'a8' => :NIDORINA,
        'a9' => :GEODUDE,
        'aa' => :PORYGON,
        'ab' => :AERODACTYL,
        'ad' => :MAGNEMITE,
        'b0' => :CHARMANDER,
        'b1' => :SQUIRTLE,
        'b2' => :CHARMELEON,
        'b3' => :WARTORTLE,
        'b4' => :CHARIZARD,
        'b9' => :ODDISH,
        'ba' => :GLOOM,
        'bb' => :VILEPLUME,
        'bc' => :BELLSPROUT,
        'bd' => :WEEPINBELL,
        'be' => :VICTREEBEL
    }
    
    HEX_TO_MOVES = {
        '01' => :POUND,
        '02' => :KARATECHOP,
        '03' => :DOUBLESLAP,
        '04' => :COMETPUNCH,
        '05' => :MEGAPUNCH,
        '06' => :PAYDAY,
        '07' => :FIREPUNCH,
        '08' => :ICEPUNCH,
        '09' => :THUNDERPUNCH,
        '0a' => :SCRATCH,
        '0b' => :VICEGRIP,
        '0c' => :GUILLOTINE,
        '0d' => :RAZORWIND,
        '0e' => :SWORDSDANCE,
        '0f' => :CUT,
        '10' => :GUST,
        '11' => :WINGATTACK,
        '12' => :WHIRLWIND,
        '13' => :FLY,
        '14' => :BIND,
        '15' => :SLAM,
        '16' => :VINEWHIP,
        '17' => :STOMP,
        '18' => :DOUBLEKICK,
        '19' => :MEGAKICK,
        '1a' => :JUMPKICK,
        '1b' => :ROLLINGKICK,
        '1c' => :SANDATTACK,
        '1d' => :HEADBUTT,
        '1e' => :HORNATTACK,
        '1f' => :FURYATTACK,
        '20' => :HORNDRILL,
        '21' => :TACKLE,
        '22' => :BODYSLAM,
        '23' => :WRAP,
        '24' => :TAKEDOWN,
        '25' => :THRASH,
        '26' => :DOUBLEEDGE,
        '27' => :TAILWHIP,
        '28' => :POISONSTING,
        '29' => :TWINEEDLE,
        '2a' => :PINMISSILE,
        '2b' => :LEER,
        '2c' => :BITE,
        '2d' => :GROWL,
        '2e' => :ROAR,
        '2f' => :SING,
        '30' => :SUPERSONIC,
        '31' => :SONICBOOM,
        '32' => :DISABLE,
        '33' => :ACID,
        '34' => :EMBER,
        '35' => :FLAMETHROWER,
        '36' => :MIST,
        '37' => :WATERGUN,
        '38' => :HYDROPUMP,
        '39' => :SURF,
        '3a' => :ICEBEAM,
        '3b' => :BLIZZARD,
        '3c' => :PSYBEAM,
        '3d' => :BUBBLEBEAM,
        '3e' => :AURORABEAM,
        '3f' => :HYPERBEAM,
        '40' => :PECK,
        '41' => :DRILLPECK,
        '42' => :SUBMISSION,
        '43' => :LOWKICK,
        '44' => :COUNTER,
        '45' => :SEISMICTOSS,
        '46' => :STRENGTH,
        '47' => :ABSORB,
        '48' => :MEGADRAIN,
        '49' => :LEECHSEED,
        '4a' => :GROWTH,
        '4b' => :RAZORLEAF,
        '4c' => :SOLARBEAM,
        '4d' => :POISONPOWDER,
        '4e' => :STUNSPORE,
        '4f' => :SLEEPPOWDER,
        '50' => :PETALDANCE,
        '51' => :STRINGSHOT,
        '52' => :DRAGONRAGE,
        '53' => :FIRESPIN,
        '54' => :THUNDERSHOCK,
        '55' => :THUNDERBOLT,
        '56' => :THUNDERWAVE,
        '57' => :THUNDER,
        '58' => :ROCKTHROW,
        '59' => :EARTHQUAKE,
        '5a' => :FISSURE,
        '5b' => :DIG,
        '5c' => :TOXIC,
        '5d' => :CONFUSION,
        '5e' => :PSYCHIC,
        '5f' => :HYPNOSIS,
        '60' => :MEDITATE,
        '61' => :AGILITY,
        '62' => :QUICKATTACK,
        '63' => :RAGE,
        '64' => :TELEPORT,
        '65' => :NIGHTSHADE,
        '66' => :MIMIC,
        '67' => :SCREECH,
        '68' => :DOUBLETEAM,
        '69' => :RECOVER,
        '6a' => :HARDEN,
        '6b' => :MINIMIZE,
        '6c' => :SMOKESCREEN,
        '6d' => :CONFUSERAY,
        '6e' => :WITHDRAW,
        '6f' => :DEFENSECURL,
        '70' => :BARRIER,
        '71' => :LIGHTSCREEN,
        '72' => :HAZE,
        '73' => :REFLECT,
        '74' => :FOCUSENERGY,
        '75' => :BIDE,
        '76' => :METRONOME,
        '77' => :MIRRORMOVE,
        '78' => :SELFDESTRUCT,
        '79' => :EGGBOMB,
        '7a' => :LICK,
        '7b' => :SMOG,
        '7c' => :SLUDGE,
        '7d' => :BONECLUB,
        '7e' => :FIREBLAST,
        '7f' => :WATERFALL,
        '80' => :CLAMP,
        '81' => :SWIFT,
        '82' => :SKULLBASH,
        '83' => :SPIKECANNON,
        '84' => :CONSTRICT,
        '85' => :AMNESIA,
        '86' => :KINESIS,
        '87' => :SOFTBOILED,
        '88' => :HIGHJUMPKICK,
        '89' => :GLARE,
        '8a' => :DREAMEATER,
        '8b' => :POISONGAS,
        '8c' => :BARRAGE,
        '8d' => :LEECHLIFE,
        '8e' => :LOVELYKISS,
        '8f' => :SKYATTACK,
        '90' => :TRANSFORM,
        '91' => :BUBBLE,
        '92' => :DIZZYPUNCH,
        '93' => :SPORE,
        '94' => :FLASH,
        '95' => :PSYWAVE,
        '96' => :SPLASH,
        '97' => :ACIDARMOR,
        '98' => :CRABHAMMER,
        '99' => :EXPLOSION,
        '9a' => :FURYSWIPES,
        '9b' => :BONEMERANG,
        '9c' => :REST,
        '9d' => :ROCKSLIDE,
        '9e' => :HYPERFANG,
        '9f' => :SHARPEN,
        'a0' => :CONVERSION,
        'a1' => :TRIATTACK,
        'a2' => :SUPERFANG,
        'a3' => :SLASH,
        'a4' => :SUBSTITUTE
    }
    
    # This class handles the save file.
    class Gen1Save
      attr_accessor :filename
      attr_accessor :box_offsets
      attr_accessor :num_boxes
      attr_accessor :ot_id_offset
      
      def initialize(savefileName="rbsave.sa1")
        if !FileTest.exist?("Gen 1 Save")
          @filename = nil
        else
          if FileTest.directory?("Gen 1 Save")
            if !FileTest.exist?("Gen 1 Save/" + savefileName)
              @filename = nil
            else
              @filename = "Gen 1 Save/" + savefileName
              @box_offsets = [0x4000, 0x4462, 0x48C4, 0x4D26, 0x5188, 0x55EA, 0x6000, 0x6462, 
                0x68C4, 0x6D26, 0x7188, 0x75EA]
              @num_boxes = 12
              @ot_id_offset = 0x2605
            end
          else
            @filename = nil
          end
        end
      end
      
      # Getter for filename
      def getSaveFileName
        return self.filename
      end
      
      # Gets the Gen 1 player's OT name
      def getSaveFileOTname
        if !self.filename
          return ""
        else
          keysArray = getArrayOfKeys(self.filename, 0x2598, 11)
          charsArray = getArrayOfCharacters(keysArray, RBY_To_ASCII)
          trainerName = ""
          for i in 0...charsArray.index(NULL_TERMINATOR)
            trainerName += charsArray[i]
          end
          return trainerName
        end
      end
      
      # Gets the Gen 1 player's OT ID
      def getSaveFileOTId
        if !self.filename
          return 0
        else
          return getBytesToInt16(self.filename, @ot_id_offset, 15)
        end
      end
      
      # These two functions below will be used to get the Gen 1 player's current box.
      # This will be used for mass transfer.
      def getCurrentPCBoxIndex
        if !self.filename
          return 0
        else
          boxIndexKey = getSingleKeyInHex(self.filename, GEN1_CURRENT_BOX_OFFSET)
          if BOXOFFSET_INDEX_TABLES.include?(boxIndexKey)
            return BOXOFFSET_INDEX_TABLES[boxIndexKey]
          else
            return 0
          end
        end
      end
      
      def getPCBoxOffset(useCurrent=false,index=0)
        if !self.filename
          return 0
        else
          if useCurrent
            return self.box_offsets[getCurrentPCBoxIndex]
          else
            return self.box_offsets[index]
          end
        end
      end
      
      def gen1ShinyCheck(dv_hash)
        if !dv_hash.include?("dv_attack") && !dv_hash.include?("dv_defense") && !dv_hash.include?("dv_speed") && !dv_hash.include?("dv_special")
          return false
        end
        # If the DVs (named IVs in modern gen games) are the following:
        # Attack IV of 10, 
        # a Special IV of 10, 
        # a Speed IV of 10, 
        # and a particular Defense IV (2, 3, 6, 7, 10, 11, 14 or 15), 
        # the Pokemon is shiny.
        return (dv_hash["dv_attack"] == 10) && (dv_hash["dv_special"] == 10) && (dv_hash["dv_speed"] == 10) && (dv_hash["dv_defense"] & 2)
      end
      
      # Reads a Pokemon from a box.
      def getGen1PokemonDataStruct(boxoffset, position=1, scanForGlitched=false)
        gen1poke = {}
        species = getSingleKeyInHex(self.filename, boxoffset + (POKEMON_LIST_OFFSET * position), 1)
        if HEX_TO_PBSPECIES.include?(species)
          gen1poke["species"] = species
          moves = []
          for i in 0...SPECIES_MOVES_OFFSETS.length
            moves.push(getSingleKeyInHex(self.filename, boxoffset + (POKEMON_LIST_OFFSET * position) + SPECIES_MOVES_OFFSETS[i], 1))
          end
          gen1poke["moves"] = moves
          levelhex = getSingleKeyInHex(self.filename, boxoffset + (POKEMON_LIST_OFFSET * position) + 0x03, 1)
          levelString = levelhex
          gen1poke["level"] = levelString.to_i(16)
          experience = getSingleKeyInHex(self.filename, boxoffset + (POKEMON_LIST_OFFSET * position) + SPECIES_EXP_OFFSET, 3)
          gen1poke["experience"] = experience.to_i(16)
          determinantValuesBits = getSingleKeyInHex(self.filename, boxoffset + (POKEMON_LIST_OFFSET * position) + SPECIES_DV_OFFSET, 2).to_i(16)
          dvAttack = (determinantValuesBits >> 12) & 0xF
          dvDefense = (determinantValuesBits >> 8) & 0xF
          dvSpeed = (determinantValuesBits >> 4) & 0xF
          dvSpecial = (determinantValuesBits >> 0) & 0xF
          dvHP = ((dvAttack & 1) << 3) | ((dvDefense & 1) << 2) | ((dvSpeed & 1) << 1) | ((dvSpecial & 1) << 0)
          gen1poke["determinant_values"] = {}
          gen1poke["determinant_values"]["dv_hp"] = dvHP
          gen1poke["determinant_values"]["dv_defense"] = dvDefense
          gen1poke["determinant_values"]["dv_attack"] = dvAttack
          gen1poke["determinant_values"]["dv_speed"] = dvSpeed
          gen1poke["determinant_values"]["dv_special"] = dvSpecial
          gen1poke["shiny"] = gen1ShinyCheck(gen1poke["determinant_values"])
        else
          if scanForGlitched
            gen1poke["species"] = species
            gen1poke["glitch"] = true
          end
        end
        return gen1poke
      end
      
      def filterEmptySpots(arrayOfGen1RawData)
        newGen1RawDataArray = []
        
        for i in 0...arrayOfGen1RawData.length
          if !arrayOfGen1RawData[i].empty?
            newGen1RawDataArray.push(arrayOfGen1RawData[i])
          end
        end
        
        return newGen1RawDataArray
      end
      
      # Converts the Pokemon from a Gen 1 to a Gen 7 Pokemon.
      # Copied: Species, nickname, experience, moves, OT info.
      # Give a random nature to the Pokemon.
      # Give it a hidden Ability.
      # Set it to a normal-formed Pokemon. No Alolan forms!
      # Set the met location to "Seems to have traveled across both space and time
      # to reach you from the Kanto region in the good old days." FRLG only uses
      # "in the good old days." (Thanks to IcyCatElf for this info)
      # Give it 3 random perfect IVs, except for Mew, who will be given 5 random
      #    perfect IVs instead.
      # NOTE: Bar MissingNo from being transferred.
      def convertToGen7Pokemon(speciesArray, language=2, removefromSave=false)
        pokemon = HEX_TO_PBSPECIES[speciesArray["species"]] # Get the PBSpecies thing
        level = speciesArray["level"]
        return false if pbBoxesFull? || !$Trainer || !speciesArray || speciesArray.empty?
        if pokemon.is_a?(String) || pokemon.is_a?(Symbol)
          pokemon=getID(PBSpecies,pokemon)
        end
        if pokemon.is_a?(Integer) && level.is_a?(Integer)
          pokemon=PokeBattle_Pokemon.new(pokemon,level,$Trainer)
        end
        $Trainer.seen[pokemon.species]=true
        $Trainer.owned[pokemon.species]=true
        pokemon.form=0
        pbSeenForm(pokemon)
        pokemon.exp=speciesArray["experience"] # Get the EXP
        nature = (speciesArray["experience"] % 25)
        if nature.is_a?(Integer)
          pokemon.setNature(nature)
        end
        pokemon.ot=getSaveFileOTname
        pokemon.trainerID=getSaveFileOTId
        pokemon.obtainText=_INTL(GEN1_MET)
        pokemon.language=language
        pokemon.generated=1
        pokemon.setAbility(2) # Give hidden ability
        # Give some perfect IVs. The IVs are an array.
        if (pokemon.species==PBSpecies::MEW)
          perfectIVs = getIndexeswithPerfectIV(5)
        else
          perfectIVs = getIndexeswithPerfectIV
        end
        for i in 0...6
          if perfectIVs.include?(i)
            pokemon.iv[i]=31
          else
            pokemon.iv[i]=rand(32)
          end
        end
        moves = speciesArray["moves"]
        for i in 0...moves.length
          if moves[i] != '00'
            pokemon.pbLearnMove(HEX_TO_MOVES[moves[i]])
          end
        end
        pokemon.calcStats # Always calculate stats.
        $PokemonStorage.pbStoreCaught(pokemon)
        return true
      end
    end
    
    #-------------------------------------------------------------------------------
    # This is a subclass of Gen1Save that reads Japanese save files. (BETA)
    #-------------------------------------------------------------------------------
    class Gen1SaveJapanese < Gen1Save
      
      def initialize(savefileName="rbsavejp.sa1")
        super(savefileName)
        @box_offsets = [0x4000, 0x4566, 0x4ACC, 0x5032, 0x6000, 0x6566, 0x6ACC, 0x7032]
        @num_boxes = 8
        @ot_id_offset = 0x25FB
      end
      
      # Gets the Gen 1 player's OT name.
      # Katakana/Hiragana will be converted.
      def getSaveFileOTname
        if !self.filename
          return ""
        else
          keysArray = getArrayOfKeys(self.filename, 0x2598, 11)
          charsArray = getArrayOfCharacters(keysArray, RBY_TO_CONVERTED_KANA)
          trainerName = ""
          for i in 0...charsArray.index(NULL_TERMINATOR)
            if i > 0
              trainerName += charsArray[i].downcase
            else
              trainerName += charsArray[i]
            end
          end
          return trainerName
        end
      end
      
      
    end


    PokeDepot_Scene:
    Spoiler:

    Code:
    #===============================================================================
    # ** Scene_iPod (Basis for Poke Depot UI, used in Essentials)
    # ** Created by xLeD (Scene_Jukebox)
    # ** Modified by Harshboy
    #-------------------------------------------------------------------------------
    #  This class performs menu screen processing.
    #-------------------------------------------------------------------------------
    #  Adapted by rigbycwts for use with the Poketransfer Utilities for Essentials.
    #===============================================================================
    class PokeDepot_Scene
      #-----------------------------------------------------------------------------
      # * Object Initialization
      #     menu_index : command cursor's initial position
      #-----------------------------------------------------------------------------
      def initialize(menu_index = 0)
        @menu_index = menu_index
      end
      #-----------------------------------------------------------------------------
      # * Main Processing
      #-----------------------------------------------------------------------------
      def main
        # Make command window
        fadein = true
        # Makes the text window
        @sprites={}
        @viewport=Viewport.new(0,0,Graphics.width,Graphics.height)
        @viewport.z=99999
        @sprites["background"] = IconSprite.new(0,0)
        @sprites["background"].setBitmap("Graphics/Pictures/PokeDepot/Choices")
        @sprites["background"].z=255
        @choices=[
           _INTL("Gen 1 Save Files"),
           _INTL("Gen 2 Save Files"),
           _INTL("Exit")
        ]
        @sprites["header"]=Window_UnformattedTextPokemon.newWithSize(_INTL("Pokemon Depot"),
           2,-18,200,64,@viewport)
        @sprites["header"].baseColor=Color.new(248,248,248)
        @sprites["header"].shadowColor=Color.new(0,0,0)
        @sprites["header"].windowskin=nil
        @sprites["command_window"] = Window_CommandPokemon.new(@choices,324)
        @sprites["command_window"].windowskin=nil
        @sprites["command_window"].index = @menu_index
        @sprites["command_window"].height = 224
        @sprites["command_window"].width = 324
        @sprites["command_window"].x = 94
        @sprites["command_window"].y = 92
        @sprites["command_window"].z = 256
        @custom = false
        @generation = 0
        # Execute transition
        Graphics.transition
        # Main loop
        loop do
          # Update game screen
          Graphics.update
          # Update input information
          Input.update
          # Frame update
          update
          # Abort loop if screen is changed
          if $scene != self
            break
          end
        end
        # Prepares for transition
        Graphics.freeze
        # Disposes the windows
        pbDisposeSpriteHash(@sprites)
        @viewport.dispose
      end
      #-----------------------------------------------------------------------------
      # * Frame Update
      #-----------------------------------------------------------------------------
      def update
        # Update windows
        pbUpdateSpriteHash(@sprites)
        if @generation > 0
          updateCustom
        else
          update_command
        end
        return
      end
      #-----------------------------------------------------------------------------
      # * Frame Update (when command window is active)
      #-----------------------------------------------------------------------------
      def updateCustom
        if Input.trigger?(Input::B)
          @sprites["command_window"][email protected]
          @sprites["command_window"].index=2
          @custom = false
          @generation = 0
          return
        end
        if Input.trigger?(Input::C)
          case @generation
          when 1 # Pokemon Red, Blue, and Yellow
            savefileName = @sprites["command_window"].commands[@sprites["command_window"].index].to_s
            savefileObject = isJapanese("Gen 1 Save/" + savefileName, JP_OFFSET_CHECKER) ? Gen1SaveJapanese.new(savefileName) : Gen1Save.new(savefileName)
            if Kernel.pbConfirmMessage(_INTL("Load this Gen 1 save file?"))
              if savefileName.is_a?(Gen1SaveJapanese)
                Kernel.pbMessage(_INTL("This is a Japanese save. Feature coming soon."))
              else
                $scene = PokeDepot_BoxSelection.new(savefileObject)
              end
            end
          end
        end
      end
    
      def update_command
        # If B button was pressed
        if Input.trigger?(Input::B)
          pbPlayCancelSE()
          # Switch to map screen
          $scene = Scene_Map.new
          return
        end
        # If C button was pressed
        if Input.trigger?(Input::C)
          # Branch by command window cursor position
          case @sprites["command_window"].index
          when 0 # Gen 1 saves
            files=[]
            Dir.chdir("Gen 1 Save/"){
               Dir.glob("*.sav"){|f| files.push(f) }
               Dir.glob("*.SAV"){|f| files.push(f) }
               Dir.glob("*.sa1"){|f| files.push(f) }
               Dir.glob("*.SA1"){|f| files.push(f) }
               Dir.glob("*.sa2"){|f| files.push(f) }
               Dir.glob("*.SA2"){|f| files.push(f) }
               Dir.glob("*.sa3"){|f| files.push(f) }
               Dir.glob("*.SA3"){|f| files.push(f) }
               Dir.glob("*.sa4"){|f| files.push(f) }
               Dir.glob("*.SA4"){|f| files.push(f) }
            }
            @sprites["command_window"].commands=files
            @sprites["command_window"].index=0
            @custom = true
            @generation = 1
          when 1 # Gen 2 saves
            Kernel.pbMessage(_INTL("This feature is coming soon."))
          when 2 # Exit
            pbPlayDecisionSE()
            $scene = Scene_Map.new
          end
          return
        end
      end
    end


    PokeDepot_BoxSelection:
    Spoiler:

    Code:
    #===============================================================================
    # ** Scene_iPod (Basis for Poke Depot UI, used in Essentials)
    # ** Created by xLeD (Scene_Jukebox)
    # ** Modified by Harshboy
    #-------------------------------------------------------------------------------
    #  This class performs menu screen processing.
    #-------------------------------------------------------------------------------
    #  Adapted by rigbycwts for use with the Poketransfer Utilities for Essentials.
    #===============================================================================
    class PokeDepot_BoxSelection
      #-----------------------------------------------------------------------------
      # * Object Initialization
      #     savefile   : the emulator save file to load
      #     menu_index : command cursor's initial position
      #-----------------------------------------------------------------------------
      def initialize(savefile, menu_index = 0)
        @savefile   = savefile
        @menu_index = menu_index
      end
      #-----------------------------------------------------------------------------
      # * Main Processing
      #-----------------------------------------------------------------------------
      def main
        # Make command window
        fadein = true
        # Makes the text window
        @sprites={}
        @viewport=Viewport.new(0,0,Graphics.width,Graphics.height)
        @viewport.z=99999
        @sprites["background"] = IconSprite.new(0,0)
        @sprites["background"].setBitmap("Graphics/Pictures/PokeDepot/Choices")
        @sprites["background"].z=255
        if @savefile.is_a?(Gen1Save)
          @numBoxes = @savefile.num_boxes
        else
          @numBoxes = 14
        end
        @choices=[]
        for i in [email protected]
          @choices.push(_INTL("Box {1}", i+1))
        end
        @choices.push(_INTL("Exit"))
        @sprites["header"]=Window_UnformattedTextPokemon.newWithSize(_INTL("Box Selection"),
           2,-18,200,64,@viewport)
        @sprites["header"].baseColor=Color.new(248,248,248)
        @sprites["header"].shadowColor=Color.new(0,0,0)
        @sprites["header"].windowskin=nil
        @sprites["command_window"] = Window_CommandPokemon.new(@choices,324)
        @sprites["command_window"].windowskin=nil
        @sprites["command_window"].index = @menu_index
        @sprites["command_window"].height = 224
        @sprites["command_window"].width = 324
        @sprites["command_window"].x = 94
        @sprites["command_window"].y = 92
        @sprites["command_window"].z = 256
        @sprites["trinfo_header"]=Window_UnformattedTextPokemon.newWithSize(_INTL("TRAINER INFO"),
           94,300,200,64,@viewport)
        @sprites["trinfo_header"].baseColor=Color.new(248,248,248)
        @sprites["trinfo_header"].shadowColor=Color.new(0,0,0)
        @sprites["trinfo_header"].windowskin=nil
        @sprites["trinfo_info"]=Window_UnformattedTextPokemon.newWithSize(_INTL("{1} / {2}", 
           @savefile.getSaveFileOTname, @savefile.getSaveFileOTId.to_s),
           94,330,200,64,@viewport)
        @sprites["trinfo_info"].baseColor=Color.new(248,248,248)
        @sprites["trinfo_info"].shadowColor=Color.new(0,0,0)
        @sprites["trinfo_info"].windowskin=nil
        @custom = false
        # Execute transition
        Graphics.transition
        # Main loop
        loop do
          # Update game screen
          Graphics.update
          # Update input information
          Input.update
          # Frame update
          update
          # Abort loop if screen is changed
          if $scene != self
            break
          end
        end
        # Prepares for transition
        Graphics.freeze
        # Disposes the windows
        pbDisposeSpriteHash(@sprites)
        @viewport.dispose
      end
      #-----------------------------------------------------------------------------
      # * Frame Update
      #-----------------------------------------------------------------------------
      def update
        # Update windows
        pbUpdateSpriteHash(@sprites)
        update_command
        return
      end
      #-----------------------------------------------------------------------------
      # * Frame Update (when command window is active)
      #-----------------------------------------------------------------------------
      def update_command
        # If B button was pressed
        if Input.trigger?(Input::B)
          pbPlayCancelSE()
          # Switch to map screen
          $scene = PokeDepot_Scene.new
          return
        end
        # If C button was pressed
        if Input.trigger?(Input::C)
          # Branch by command window cursor position
          case @sprites["command_window"].index
          when @numBoxes # Exit
            pbPlayDecisionSE()
            $scene = PokeDepot_Scene.new
          else
            currentBox = @sprites["command_window"].index
            if Kernel.pbConfirmMessage(_INTL("Load this box?"))
              pbPlayDecisionSE()
              Kernel.pbMessage(_INTL("Box {1} will be loaded.", (currentBox+1).to_s))
              $scene = PokeDepot_BoxMigrate.new(@savefile, currentBox)
            end
          end
          return
        end
      end
    end


    PokeDepot_BoxMigrate:
    Spoiler:

    Code:
    def pbSaveAfterMigrate(consoleSavefile)
      fangameName = "Collective/Mercantile"
      oldscene=$scene
      $scene=nil
      if consoleSavefile.is_a?(Gen1Save)
        Kernel.pbMessage(_INTL("Saving data from Pokemon {1} and Pokemon Red/Blue/Yellow...", fangameName))
      else
        Kernel.pbMessage(_INTL("Saving data from Pokemon {1}...", fangameName))
      end
      return if !$Trainer
      $game_system.save_count+=1
      $game_system.last_saved=retTimeFormatOne
      if safeExists?(RTP.getSaveFileName("Game.rxdata"))
        File.open(RTP.getSaveFileName("Game.rxdata"),  'rb') {|r|
          File.open(RTP.getSaveFileName("Game.rxdata.bak"), 'wb') {|w|
              while s = r.read(4096)
                w.write s
              end
            }
        }
      end
      if pbSave
        Kernel.pbMessage(_INTL("\\se[]The game was saved.\\se[save]\\wtnp[30]"))
      else
        Kernel.pbMessage(_INTL("\\se[]Save failed.\\wtnp[30]"))
      end
      $scene=oldscene
    end
    
    class PokeTransportPokemonIcon < IconSprite
      def initialize(pokemon,viewport=nil)
        super(0,0,viewport)
        @release=Interpolator.new
        @startRelease=false
        @pokemon=pokemon
        if pokemon
          self.setBitmap(pbPokemonIconFile(pokemon))
        else
          self.setBitmap(pbPokemonIconFile(nil))
        end
        self.src_rect=Rect.new(0,0,64,64)
      end
    
      def release
        self.ox=32
        self.oy=32
        self.x+=32
        self.y+=32
        @release.tween(self,[
           [Interpolator::ZOOM_X,0],
           [Interpolator::ZOOM_Y,0],
           [Interpolator::OPACITY,0]
        ],100)
        @startRelease=true
      end
    
      def releasing?
        return @release.tweening?
      end
    
      def update
        super
        @release.update
        self.color=Color.new(0,0,0,0)
        dispose if @startRelease && !releasing?
      end
    end
    
    #===============================================================================
    # ** Scene_iPod (Basis for Poke Depot UI, used in Essentials)
    # ** Created by xLeD (Scene_Jukebox)
    # ** Modified by Harshboy
    #-------------------------------------------------------------------------------
    #  This class performs menu screen processing.
    #-------------------------------------------------------------------------------
    #  Adapted by rigbycwts for use with the Poketransfer Utilities for Essentials.
    #===============================================================================
    class PokeDepot_BoxMigrate
      #-----------------------------------------------------------------------------
      # * Object Initialization
      #     savefile   : the emulator save file to load
      #     boxIndex   : the index from 0 to number of boxes-1
      #     menu_index : command cursor's initial position
      #-----------------------------------------------------------------------------
      def initialize(savefile, boxIndex = 0, menu_index = 0)
        @savefile   = savefile
        @boxIndex   = boxIndex
        @menu_index = menu_index
      end
      #-----------------------------------------------------------------------------
      # * Main Processing
      #-----------------------------------------------------------------------------
      def main
        # Make command window
        fadein = true
        # Makes the text window
        @sprites={}
        @viewport=Viewport.new(0,0,Graphics.width,Graphics.height)
        @viewport.z=99999
        @sprites["background"] = IconSprite.new(0,0)
        @sprites["background"].setBitmap("Graphics/Pictures/jukeboxbg")
        @sprites["background"].z=255
        @choices=[
           _INTL("Migrate Box"),
           _INTL("Cancel")
        ]
        @sprites["header"]=Window_UnformattedTextPokemon.newWithSize(_INTL("Current Box"),
           2,-18,200,64,@viewport)
        @sprites["header"].baseColor=Color.new(248,248,248)
        @sprites["header"].shadowColor=Color.new(0,0,0)
        @sprites["header"].windowskin=nil
        @sprites["command_window"] = Window_CommandPokemon.new(@choices,324)
        @sprites["command_window"].windowskin=nil
        @sprites["command_window"].index = @menu_index
        @sprites["command_window"].height = 224
        @sprites["command_window"].width = 324
        @sprites["command_window"].x = 94
        @sprites["command_window"].y = 92
        @sprites["command_window"].z = 256
        @sprites["trinfo_header"]=Window_UnformattedTextPokemon.newWithSize(_INTL("TRAINER INFO"),
           94,300,200,64,@viewport)
        @sprites["trinfo_header"].baseColor=Color.new(248,248,248)
        @sprites["trinfo_header"].shadowColor=Color.new(0,0,0)
        @sprites["trinfo_header"].windowskin=nil
        @sprites["trinfo_info"]=Window_UnformattedTextPokemon.newWithSize(_INTL("{1} / {2}", 
           @savefile.getSaveFileOTname, @savefile.getSaveFileOTId.to_s),
           94,330,200,64,@viewport)
        @sprites["trinfo_info"].baseColor=Color.new(248,248,248)
        @sprites["trinfo_info"].shadowColor=Color.new(0,0,0)
        @sprites["trinfo_info"].windowskin=nil
        @custom = false
        # Execute transition
        Graphics.transition
        # Main loop
        loop do
          # Update game screen
          Graphics.update
          # Update input information
          Input.update
          # Frame update
          update
          # Abort loop if screen is changed
          if $scene != self
            break
          end
        end
        # Prepares for transition
        Graphics.freeze
        # Disposes the windows
        pbDisposeSpriteHash(@sprites)
        @viewport.dispose
      end
      #-----------------------------------------------------------------------------
      # * Frame Update
      #-----------------------------------------------------------------------------
      def update
        # Update windows
        pbUpdateSpriteHash(@sprites)
        update_command
        return
      end
      #-----------------------------------------------------------------------------
      # * Frame Update (when command window is active)
      #-----------------------------------------------------------------------------
      def update_command
        # If B button was pressed
        if Input.trigger?(Input::B)
          pbPlayCancelSE()
          # Switch to map screen
          $scene = PokeDepot_BoxSelection.new(@savefile)
          return
        end
        # If C button was pressed
        if Input.trigger?(Input::C)
          # Branch by command window cursor position
          case @sprites["command_window"].index
          when 1 # Exit
            pbPlayDecisionSE()
            $scene = PokeDepot_BoxSelection.new(@savefile)
          else
            pbPlayDecisionSE()
            if Kernel.pbConfirmMessage(_INTL("Migrate all Pokemon in this Box?"))
              if pbBatteryLow?
                Kernel.pbMessage(_INTL("WARNING!"))
                Kernel.pbMessage(_INTL("Both data on this fangame and in the emulator save will be overwritten after transfer."))
                Kernel.pbMessage(_INTL("In the event of a power failure, the save data of either game will be corrupted."))
                if Kernel.pbConfirmMessage(_INTL("Are you sure you want to proceed?"))
                  migrateWholeBox
                  pbSaveAfterMigrate(@savefile)
                  $scene = PokeDepot_BoxSelection.new(@savefile)
                end
              else
                migrateWholeBox
                pbSaveAfterMigrate(@savefile)
                $scene = PokeDepot_BoxSelection.new(@savefile)
              end
            end
          end
          return
        end
      end
      
      #-----------------------------------------------------------------------------
      # * Migrate Whole Pokemon Box
      #-----------------------------------------------------------------------------
      def migrateWholeBox
        boxIndex = @boxIndex
        boxOffset = @savefile.box_offsets[boxIndex] if @savefile.is_a?(Gen1Save)
        failed = false
        unfilteredRawData = []
        for i in 1..20
          unfilteredRawData.push(@savefile.getGen1PokemonDataStruct(boxOffset + (33 * (i-1))))
        end
        filteredRawData = @savefile.filterEmptySpots(unfilteredRawData)
        if filteredRawData.length > 0
          for j in 0...filteredRawData.length
            if @savefile.convertToGen7Pokemon(filteredRawData[j]) # Transfer failed
              failed = false
            else
              if j==0
                Kernel.pbMessage("Box migration failed!") if !failed
              else
                Kernel.pbMessage("Some Pokemon cannot be transferred!") if !failed
              end
              Kernel.pbMessage("Please check if your PC Boxes are full!") if !failed
              failed = true
            end
          end
          Kernel.pbMessage("Box migration complete.") if !failed
        else
          Kernel.pbMessage("Cannot migrate this box, it's empty.")
          $scene = PokeDepot_BoxSelection.new(@savefile)
        end
      end
    end


    Put the scripts in this order:


    How to use:


    Old version of this thread:
    Spoiler:

    These are the utility functions and classes. Put the following above Main:
    Spoiler:

    Code:
    ###############################################################################
    # This script section contains classes that read the save files from RBY.
    ###############################################################################
    
    # Constants for function use
    GEN1SAVE_DIRNAME = "Gen 1 Save"
    NULL_TERMINATOR = '\0'
    GEN1_NUMBOXES = 12
    GEN1_MET = "Relocated from Kanto in the good old days."
    GEN1_CURRENT_BOX_OFFSET = 0x284C
    
    # Constants for data manipulation
    ENTRIES_USED_OFFSET = 0x0000
    SPECIES_LIST_OFFSET = 0x0001
    POKEMON_LIST_OFFSET = 0x0016 # Multiply by 2, for example, to get 2nd Pokemon in the box
    OT_NAMES_OFFSET = 0x02AA
    POKEMON_NICKNAMES_OFFSET = 0x0386
    
    # Reads the Gen 1 Data Structures.
    SPECIES_INDEX_OFFSET = 0x00
    SPECIES_MOVES_OFFSETS = [0x08, 0x09, 0x0A, 0x0B]
    SPECIES_OT_ID_OFFSET = 0x0C # 2 bytes
    SPECIES_EXP_OFFSET = 0x0E # 3 bytes
    SPECIES_DV_OFFSET = 0x1B # 2 bytes, 4 bits for each DV/IV excluding HP
    
    ###############################################################################
    # Hex methods are for the OT and Pokemon nicknames.
    ###############################################################################
    def read_hex_io(io, offset, count)
      io.seek offset, File::SEEK_SET
      bytes = io.read count
      bytes.unpack("H*").shift
    end
    
    def read_hex(file, offset, count)
      File.open(file, "rb") do |io|
        read_hex_io io, offset, count
      end
    end
    
    ###############################################################################
    # Int methods are for the OT ID.
    # Note that Gen 1 games use Big Endian.
    ###############################################################################
    def read_intBigEndian_io(io, offset, count)
      io.seek offset, File::SEEK_SET
      bytes = io.read count
      bytes.unpack("n").shift
    end
    
    def read_intBigEndian(file, offset, count)
      File.open(file, "rb") do |io|
        read_intBigEndian_io io, offset, count
      end
    end
    
    ###############################################################################
    # Functions to determine which stat gets perfect IVs.
    ###############################################################################
    def numGen(array)
        random = rand(6)
    
      if array.include?(random)
            return numGen(array)
        end
        return random
    end
    
    def getIndexeswithPerfectIV(numPerfectIVs=3)
        arrayPerfectIVindexes = []
        for i in 0...numPerfectIVs
            arrayPerfectIVindexes.push(numGen(arrayPerfectIVindexes))
        end
        return arrayPerfectIVindexes.sort
    end
    
    ###############################################################################
    # Tables to be used by the hex and possibly int methods above.
    ###############################################################################
    # Used for boxes.
    BOXOFFSET_INDEX_TABLES = {
      '8b' => 11
    }
    
    BOX_OFFSETS = [0x4000, 0x4462, 0x48C4, 0x4D26, 0x5188, 0x55EA, 0x6000, 0x6462, 
      0x68C4, 0x6D26, 0x7188, 0x75EA]
    
    # Used for Pokemon nicknames and OT names
    RBY_To_ASCII = {
        '50' => '\0', # null terminator
        '7F' => ' ', # space
        '80' => 'A',
        '81' => 'B',
        '82' => 'C',
        '83' => 'D',
        '84' => 'E',
        '85' => 'F',
        '86' => 'G',
        '87' => 'H',
        '88' => 'I',
        '89' => 'J',
        '8A' => 'K',
        '8B' => 'L',
        '8C' => 'M',
        '8D' => 'N',
        '8E' => 'O',
        '8F' => 'P',
        '90' => 'Q',
        '91' => 'R',
        '92' => 'S',
        '93' => 'T',
        '94' => 'U',
        '95' => 'V',
        '96' => 'W',
        '97' => 'X',
        '98' => 'Y',
        '99' => 'Z',
        '9A' => '[',
        '9B' => '\\',
        '9C' => ']',
        '9D' => '^',
        '9E' => '_',
        '9F' => '`',
        'A0' => 'a',
        'A1' => 'b',
        'A2' => 'c',
        'A3' => 'd',
        'A4' => 'e',
        'A5' => 'f',
        'A6' => 'g',
        'A7' => 'h',
        'A8' => 'i',
        'A9' => 'j',
        'AA' => 'k',
        'AB' => 'l',
        'AC' => 'm',
        'AD' => 'n',
        'AE' => 'o',
        'AF' => 'p',
        'B0' => 'q',
        'B1' => 'r',
        'B2' => 's',
        'B3' => 't',
        'B4' => 'u',
        'B5' => 'v',
        'B6' => 'w',
        'B7' => 'x',
        'B8' => 'y',
        'B9' => 'z',
        'E3' => '-',
        'E6' => '?',
        'E7' => '!',
        'E8' => '.',
        'EF' => '♂', # Male Gender icon
        'F2' => '.',
        'F3' => '/',
        'F4' => ',',
        'F5' => '♀', # Female Gender icon
        'F6' => '0', 
        'F7' => '1', 
        'F8' => '2', 
        'F9' => '3', 
        'FA' => '4', 
        'FB' => '5', 
        'FC' => '6', 
        'FD' => '7', 
        'FE' => '8', 
        'FF' => '9'
        }
    
    HEX_TO_PBSPECIES = {
        '01' => :RHYDON,
        '02' => :KANGASKHAN,
        '03' => :NIDORANmA,
        '04' => :CLEFAIRY,
        '05' => :SPEAROW,
        '06' => :VOLTORB,
        '07' => :NIDOKING,
        '08' => :SLOWBRO,
        '09' => :IVYSAUR,
        '0a' => :EXEGGUTOR,
        '0b' => :LICKITUNG,
        '0c' => :EXEGGCUTE,
        '0d' => :GRIMER,
        '0e' => :GENGAR,
        '0f' => :NIDORANfE,
        '10' => :NIDOQUEEN,
        '11' => :CUBONE,
        '12' => :RHYHORN,
        '13' => :LAPRAS,
        '14' => :ARCANINE,
        '15' => :MEW,
        '16' => :GYARADOS,
        '17' => :SHELLDER,
        '18' => :TENTACOOL,
        '19' => :GASTLY,
        '1a' => :SCYTHER,
        '1b' => :STARYU,
        '1c' => :BLASTOISE,
        '1d' => :PINSIR,
        '1e' => :TANGELA,
        '21' => :GROWLITHE,
        '22' => :ONIX,
        '23' => :FEAROW,
        '24' => :PIDGEY,
        '25' => :SLOWPOKE,
        '26' => :KADABRA,
        '27' => :GRAVELER,
        '28' => :CHANSEY,
        '29' => :MACHOKE,
        '2a' => :MRMIME,
        '2b' => :HITMONLEE,
        '2c' => :HITMONCHAN,
        '2d' => :ARBOK,
        '2e' => :PARASECT,
        '2f' => :PSYDUCK,
        '30' => :DROWZEE,
        '31' => :GOLEM,
        '33' => :MAGMAR,
        '35' => :ELECTABUZZ,
        '36' => :MAGNETON,
        '37' => :KOFFING,
        '39' => :MANKEY,
        '3a' => :SEEL,
        '3b' => :DIGLETT,
        '3c' => :TAUROS,
        '40' => :FARFETCHD,
        '41' => :VENONAT,
        '42' => :DRAGONITE,
        '46' => :DODUO,
        '47' => :POLIWAG,
        '48' => :JYNX,
        '49' => :MOLTRES,
        '4a' => :ARTICUNO,
        '4b' => :ZAPDOS,
        '4c' => :DITTO,
        '4d' => :MEOWTH,
        '4e' => :KRABBY,
        '52' => :VULPIX,
        '53' => :NINETALES,
        '54' => :PIKACHU,
        '55' => :RAICHU,
        '58' => :DRATINI,
        '59' => :DRAGONAIR,
        '5a' => :KABUTO,
        '5b' => :KABUTOPS,
        '5c' => :HORSEA,
        '5d' => :SEADRA,
        '60' => :SANDSHREW,
        '61' => :SANDSLASH,
        '62' => :OMANYTE,
        '63' => :OMASTAR,
        '64' => :JIGGLYPUFF,
        '65' => :WIGGLYTUFF,
        '66' => :EEVEE,
        '67' => :FLAREON,
        '68' => :JOLTEON,
        '69' => :VAPOREON,
        '6a' => :MACHOP,
        '6b' => :ZUBAT,
        '6c' => :EKANS,
        '6d' => :PARAS,
        '6e' => :POLIWHIRL,
        '6f' => :POLIWRATH,
        '70' => :WEEDLE,
        '71' => :KAKUNA,
        '72' => :BEEDRILL,
        '74' => :DODRIO,
        '75' => :PRIMEAPE,
        '76' => :DUGTRIO,
        '77' => :VENOMOTH,
        '78' => :DEWGONG,
        '7b' => :CATERPIE,
        '7c' => :METAPOD,
        '7d' => :BUTTERFREE,
        '7e' => :MACHAMP,
        '80' => :GOLDUCK,
        '81' => :HYPNO,
        '82' => :GOLBAT,
        '83' => :MEWTWO,
        '84' => :SNORLAX,
        '85' => :MAGIKARP,
        '88' => :MUK,
        '8a' => :KINGLER,
        '8b' => :CLOYSTER,
        '8d' => :ELECTRODE,
        '8e' => :CLEFABLE,
        '8f' => :WEEZING,
        '90' => :PERSIAN,
        '91' => :MAROWAK,
        '93' => :HAUNTER,
        '94' => :ABRA,
        '95' => :ALAKAZAM,
        '96' => :PIDGEOTTO,
        '97' => :PIDGEOT,
        '98' => :STARMIE,
        '99' => :BULBASAUR,
        '9a' => :VENUSAUR,
        '9b' => :TENTACRUEL,
        '9d' => :GOLDEEN,
        '9e' => :SEAKING,
        'a3' => :PONYTA,
        'a4' => :RAPIDASH,
        'a5' => :RATTATA,
        'a6' => :RATICATE,
        'a7' => :NIDORINO,
        'a8' => :NIDORINA,
        'a9' => :GEODUDE,
        'aa' => :PORYGON,
        'ab' => :AERODACTYL,
        'ad' => :MAGNEMITE,
        'b0' => :CHARMANDER,
        'b1' => :SQUIRTLE,
        'b2' => :CHARMELEON,
        'b3' => :WARTORTLE,
        'b4' => :CHARIZARD,
        'b9' => :ODDISH,
        'ba' => :GLOOM,
        'bb' => :VILEPLUME,
        'bc' => :BELLSPROUT,
        'bd' => :WEEPINBELL,
        'be' => :VICTREEBEL
    }
    
    HEX_TO_MOVES = {
        '01' => :POUND,
        '02' => :KARATECHOP,
        '03' => :DOUBLESLAP,
        '04' => :COMETPUNCH,
        '05' => :MEGAPUNCH,
        '06' => :PAYDAY,
        '07' => :FIREPUNCH,
        '08' => :ICEPUNCH,
        '09' => :THUNDERPUNCH,
        '0a' => :SCRATCH,
        '0b' => :VICEGRIP,
        '0c' => :GUILLOTINE,
        '0d' => :RAZORWIND,
        '0e' => :SWORDSDANCE,
        '0f' => :CUT,
        '10' => :GUST,
        '11' => :WINGATTACK,
        '12' => :WHIRLWIND,
        '13' => :FLY,
        '14' => :BIND,
        '15' => :SLAM,
        '16' => :VINEWHIP,
        '17' => :STOMP,
        '18' => :DOUBLEKICK,
        '19' => :MEGAKICK,
        '1a' => :JUMPKICK,
        '1b' => :ROLLINGKICK,
        '1c' => :SANDATTACK,
        '1d' => :HEADBUTT,
        '1e' => :HORNATTACK,
        '1f' => :FURYATTACK,
        '20' => :HORNDRILL,
        '21' => :TACKLE,
        '22' => :BODYSLAM,
        '23' => :WRAP,
        '24' => :TAKEDOWN,
        '25' => :THRASH,
        '26' => :DOUBLEEDGE,
        '27' => :TAILWHIP,
        '28' => :POISONSTING,
        '29' => :TWINEEDLE,
        '2a' => :PINMISSILE,
        '2b' => :LEER,
        '2c' => :BITE,
        '2d' => :GROWL,
        '2e' => :ROAR,
        '2f' => :SING,
        '30' => :SUPERSONIC,
        '31' => :SONICBOOM,
        '32' => :DISABLE,
        '33' => :ACID,
        '34' => :EMBER,
        '35' => :FLAMETHROWER,
        '36' => :MIST,
        '37' => :WATERGUN,
        '38' => :HYDROPUMP,
        '39' => :SURF,
        '3a' => :ICEBEAM,
        '3b' => :BLIZZARD,
        '3c' => :PSYBEAM,
        '3d' => :BUBBLEBEAM,
        '3e' => :AURORABEAM,
        '3f' => :HYPERBEAM,
        '40' => :PECK,
        '41' => :DRILLPECK,
        '42' => :SUBMISSION,
        '43' => :LOWKICK,
        '44' => :COUNTER,
        '45' => :SEISMICTOSS,
        '46' => :STRENGTH,
        '47' => :ABSORB,
        '48' => :MEGADRAIN,
        '49' => :LEECHSEED,
        '4a' => :GROWTH,
        '4b' => :RAZORLEAF,
        '4c' => :SOLARBEAM,
        '4d' => :POISONPOWDER,
        '4e' => :STUNSPORE,
        '4f' => :SLEEPPOWDER,
        '50' => :PETALDANCE,
        '51' => :STRINGSHOT,
        '52' => :DRAGONRAGE,
        '53' => :FIRESPIN,
        '54' => :THUNDERSHOCK,
        '55' => :THUNDERBOLT,
        '56' => :THUNDERWAVE,
        '57' => :THUNDER,
        '58' => :ROCKTHROW,
        '59' => :EARTHQUAKE,
        '5a' => :FISSURE,
        '5b' => :DIG,
        '5c' => :TOXIC,
        '5d' => :CONFUSION,
        '5e' => :PSYCHIC,
        '5f' => :HYPNOSIS,
        '60' => :MEDITATE,
        '61' => :AGILITY,
        '62' => :QUICKATTACK,
        '63' => :RAGE,
        '64' => :TELEPORT,
        '65' => :NIGHTSHADE,
        '66' => :MIMIC,
        '67' => :SCREECH,
        '68' => :DOUBLETEAM,
        '69' => :RECOVER,
        '6a' => :HARDEN,
        '6b' => :MINIMIZE,
        '6c' => :SMOKESCREEN,
        '6d' => :CONFUSERAY,
        '6e' => :WITHDRAW,
        '6f' => :DEFENSECURL,
        '70' => :BARRIER,
        '71' => :LIGHTSCREEN,
        '72' => :HAZE,
        '73' => :REFLECT,
        '74' => :FOCUSENERGY,
        '75' => :BIDE,
        '76' => :METRONOME,
        '77' => :MIRRORMOVE,
        '78' => :SELFDESTRUCT,
        '79' => :EGGBOMB,
        '7a' => :LICK,
        '7b' => :SMOG,
        '7c' => :SLUDGE,
        '7d' => :BONECLUB,
        '7e' => :FIREBLAST,
        '7f' => :WATERFALL,
        '80' => :CLAMP,
        '81' => :SWIFT,
        '82' => :SKULLBASH,
        '83' => :SPIKECANNON,
        '84' => :CONSTRICT,
        '85' => :AMNESIA,
        '86' => :KINESIS,
        '87' => :SOFTBOILED,
        '88' => :HIGHJUMPKICK,
        '89' => :GLARE,
        '8a' => :DREAMEATER,
        '8b' => :POISONGAS,
        '8c' => :BARRAGE,
        '8d' => :LEECHLIFE,
        '8e' => :LOVELYKISS,
        '8f' => :SKYATTACK,
        '90' => :TRANSFORM,
        '91' => :BUBBLE,
        '92' => :DIZZYPUNCH,
        '93' => :SPORE,
        '94' => :FLASH,
        '95' => :PSYWAVE,
        '96' => :SPLASH,
        '97' => :ACIDARMOR,
        '98' => :CRABHAMMER,
        '99' => :EXPLOSION,
        '9a' => :FURYSWIPES,
        '9b' => :BONEMERANG,
        '9c' => :REST,
        '9d' => :ROCKSLIDE,
        '9e' => :HYPERFANG,
        '9f' => :SHARPEN,
        'a0' => :CONVERSION,
        'a1' => :TRIATTACK,
        'a2' => :SUPERFANG,
        'a3' => :SLASH,
        'a4' => :SUBSTITUTE
    }
      
    ###############################################################################
    # Outside of class functions necessary for converting hex to strings and more.
    ###############################################################################
    
    # Converts the key to its ASCII equivalent on the table.
    # If the hex string is 0xAB, the key is AB.
    # Keys are treated as strings.
    def getCorrespondingCharacter(key, table=RBY_To_ASCII)
        if table.include?(key)
            return table[key]
        end
    end
    
    # Converts bytes to integers.
    # Gen 1 uses big endian.
    def getBytesToInt16(savefile, offset, byteLength)
        return read_intBigEndian(savefile, offset, byteLength)
    end
    
    # Gets a single key, treated as string.
    def getSingleKeyInHex(savefile, offset, byteLength=2)
        return read_hex(savefile, offset, byteLength)
    end
    
    # Returns an array of keys.
    def getArrayOfKeys(savefile, offset, byteLength)
        return read_hex(savefile, offset, byteLength).scan(/../)
    end
    
    # The array of keys are converted to an array of characters.
    def getArrayOfCharacters(arrayOfKeys)
        arrayOfChars = []
        for i in 0...arrayOfKeys.length
            arrayOfChars.insert(i, getCorrespondingCharacter(arrayOfKeys[i].upcase))
        end
        return arrayOfChars
    end
    
    # This class handles the save file.
    class Gen1Save
      attr_accessor :filename
      
      def initialize
        if !FileTest.exist?("Gen 1 Save")
          @filename = nil
        else
          if FileTest.directory?("Gen 1 Save")
            if !FileTest.exist?("Gen 1 Save/rbsave.sa1")
              @filename = nil
            else
              @filename = "Gen 1 Save/rbsave.sa1"
            end
          else
            @filename = nil
          end
        end
      end
      
      # Getter for filename
      def getSaveFileName
        return self.filename
      end
      
      # Gets the Gen 1 player's OT name
      def getSaveFileOTname
        if !self.filename
          return ""
        else
          keysArray = getArrayOfKeys(self.filename, 0x2598, 11)
          charsArray = getArrayOfCharacters(keysArray)
          trainerName = ""
          for i in 0...charsArray.index(NULL_TERMINATOR)
            trainerName += charsArray[i]
          end
          return trainerName
        end
      end
      
      # Gets the Gen 1 player's OT ID
      def getSaveFileOTId
        if !self.filename
          return 0
        else
          return getBytesToInt16(self.filename, 0x2605, 15)
        end
      end
      
      # These two functions below will be used to get the Gen 1 player's current box.
      # This will be used for mass transfer.
      def getCurrentPCBoxIndex
        if !self.filename
          return 0
        else
          boxIndexKey = getSingleKeyInHex(self.filename, GEN1_CURRENT_BOX_OFFSET)
          if BOXOFFSET_INDEX_TABLES.include?(boxIndexKey)
            return BOXOFFSET_INDEX_TABLES[boxIndexKey]
          else
            return 0
          end
        end
      end
      
      def getPCBoxOffset(useCurrent=false,index=0)
        if !self.filename
          return 0
        else
          if useCurrent
            return BOX_OFFSETS[getCurrentPCBoxIndex]
          else
            return BOX_OFFSETS[index]
          end
        end
      end
      
      def gen1ShinyCheck(dv_hash)
        if !dv_hash.include?("dv_attack") && !dv_hash.include?("dv_defense") && !dv_hash.include?("dv_speed") && !dv_hash.include?("dv_special")
          return false
        end
        # If the DVs are the following:
        # Attack IV of 10, a Special IV of 10, a Speed IV of 10 and a particular Defense IV (2, 3, 6, 7, 10, 11, 14 or 15), the Pokemon is shiny.
        return (dv_hash["dv_attack"] == 10) && (dv_hash["dv_special"] == 10) && (dv_hash["dv_speed"] == 10) && (dv_hash["dv_defense"] & 2)
      end
      
      # Reads a Pokemon from a box.
      def getGen1PokemonDataStruct(boxoffset, position=1)
        gen1poke = {}
        species = getSingleKeyInHex(self.filename, boxoffset + (POKEMON_LIST_OFFSET * position), 1)
        if HEX_TO_PBSPECIES.include?(species)
          gen1poke["species"] = species
          moves = []
          for i in 0...SPECIES_MOVES_OFFSETS.length
            moves.push(getSingleKeyInHex(self.filename, boxoffset + (POKEMON_LIST_OFFSET * position) + SPECIES_MOVES_OFFSETS[i], 1))
          end
          gen1poke["moves"] = moves
          levelhex = getSingleKeyInHex(self.filename, boxoffset + (POKEMON_LIST_OFFSET * position) + 0x03, 1)
          levelString = levelhex
          gen1poke["level"] = levelString.to_i(16)
          experience = getSingleKeyInHex(self.filename, boxoffset + (POKEMON_LIST_OFFSET * position) + SPECIES_EXP_OFFSET, 3)
          gen1poke["experience"] = experience.to_i(16)
          determinantValuesBits = getSingleKeyInHex(self.filename, boxoffset + (POKEMON_LIST_OFFSET * position) + SPECIES_DV_OFFSET, 2).to_i(16)
          dvAttack = (determinantValuesBits >> 12) & 0xF
          dvDefense = (determinantValuesBits >> 8) & 0xF
          dvSpeed = (determinantValuesBits >> 4) & 0xF
          dvSpecial = (determinantValuesBits >> 0) & 0xF
          dvHP = ((dvAttack & 1) << 3) | ((dvDefense & 1) << 2) | ((dvSpeed & 1) << 1) | ((dvSpecial & 1) << 0)
          gen1poke["determinant_values"] = {}
          gen1poke["determinant_values"]["dv_hp"] = dvHP
          gen1poke["determinant_values"]["dv_defense"] = dvDefense
          gen1poke["determinant_values"]["dv_attack"] = dvAttack
          gen1poke["determinant_values"]["dv_speed"] = dvSpeed
          gen1poke["determinant_values"]["dv_special"] = dvSpecial
          gen1poke["shiny"] = gen1ShinyCheck(gen1poke["determinant_values"])
        end
        return gen1poke
      end
      
      def filterEmptySpots(arrayOfGen1RawData)
        newGen1RawDataArray = []
        
        for i in 0...arrayOfGen1RawData.length
          if !arrayOfGen1RawData[i].empty?
            newGen1RawDataArray.push(arrayOfGen1RawData[i])
          end
        end
        
        return newGen1RawDataArray
      end
      
      # Converts the Pokemon from a Gen 1 to a Gen 7 Pokemon.
      # Copied: Species, nickname, experience, moves, OT info.
      # Give a random nature to the Pokemon.
      # Give it a hidden Ability.
      # Set it to a normal-formed Pokemon. No Alolan forms!
      # Set the met location to "Seems to have traveled across both space and time
      # to reach you from the Kanto region in the good old days." FRLG only uses
      # "in the good old days." (Thanks to IcyCatElf for this info)
      # Give it 3 random perfect IVs, except for Mew, who will be given 5 random
      #    perfect IVs instead.
      # NOTE: Bar MissingNo from being transferred.
      def convertToGen7Pokemon(speciesArray, trainerInfo=nil, removefromSave=false)
        pokemon = HEX_TO_PBSPECIES[speciesArray["species"]] # Get the PBSpecies thing
        level = speciesArray["level"]
        return false if pbBoxesFull? || !$Trainer || !speciesArray || speciesArray.empty?
        if pokemon.is_a?(String) || pokemon.is_a?(Symbol)
          pokemon=getID(PBSpecies,pokemon)
        end
        if pokemon.is_a?(Integer) && level.is_a?(Integer)
          pokemon=PokeBattle_Pokemon.new(pokemon,level,$Trainer)
        end
        $Trainer.seen[pokemon.species]=true
        $Trainer.owned[pokemon.species]=true
        pokemon.form=0
        pbSeenForm(pokemon)
        pokemon.exp=speciesArray["experience"] # Get the EXP
        nature = (speciesArray["experience"] % 25)
        if nature.is_a?(Integer)
          pokemon.setNature(nature)
        end
        pokemon.ot=getSaveFileOTname
        #pokemon.trainerID=01912
        pokemon.obtainText=_INTL(GEN1_MET)
        if (pokemon.species==PBSpecies::GASTLY) || (pokemon.species==PBSpecies::KOFFING) || (pokemon.species==PBSpecies::MEW)
          pokemon.setAbility(0) # These have no HA's.
        else
          pokemon.setAbility(2) # Give hidden ability
        end
        # Give some perfect IVs. The IVs are an array.
        if (pokemon.species==PBSpecies::MEW)
          perfectIVs = getIndexeswithPerfectIV(5)
        else
          perfectIVs = getIndexeswithPerfectIV
        end
        for i in 0...6
          if perfectIVs.include?(i)
            pokemon.iv[i]=31
          else
            pokemon.iv[i]=rand(32)
          end
        end
        moves = speciesArray["moves"]
        for i in 0...moves.length
          if moves[i] != '00'
            pokemon.pbLearnMove(HEX_TO_MOVES[moves[i]])
          end
        end
        pokemon.calcStats # Always calculate stats.
        $PokemonStorage.pbStoreCaught(pokemon)
        return true
      end
    end


    Sample Scene. Put below utilities script.
    Spoiler:

    Code:
    class PokeTransporterScene
      attr_accessor :gen1save
      
      def initialize
        @gen1save = Gen1Save.new
      end
      
      def pbPokeTransporterReadGen1Save
        Kernel.pbMessage("Trainer Name: " + self.gen1save.getSaveFileOTname)
        Kernel.pbMessage("Trainer ID: " + self.gen1save.getSaveFileOTId.to_s)
      end
      
      def pbPokeTransporterGetPokemonRawData
        rawData = self.gen1save.getGen1PokemonDataStruct(0x4D26)
        Kernel.pbMessage("Species hex code: " + rawData["species"])
        Kernel.pbMessage("EXP: " + rawData["experience"].to_s)
        Kernel.pbMessage("Level: " + rawData["level"].to_s)
        if rawData["shiny"]
          Kernel.pbMessage("Shiny: yes")
        else
          Kernel.pbMessage("Shiny: no")
        end
        Kernel.pbMessage("Attempting transfer...")
        if self.gen1save.convertToGen7Pokemon(rawData)
          Kernel.pbMessage("Transfer successful! Don't forget to save your game!")
        else
          Kernel.pbMessage("Transfer failed! Please check if your PC Boxes are full!")
        end
      end
      
      def pbPokeTransporterGetWholeBox(boxIndex=0)
        boxOffset = BOX_OFFSETS[boxIndex]
        Kernel.pbMessage("Reading Pokemon Box number " + (boxIndex + 1).to_s + ".")
        unfilteredRawData = []
        for i in 1..20
          unfilteredRawData.push(self.gen1save.getGen1PokemonDataStruct(boxOffset + (33 * (i-1))))
        end
        filteredRawData = self.gen1save.filterEmptySpots(unfilteredRawData)
        Kernel.pbMessage("Box number " + (boxIndex + 1).to_s + " has " + filteredRawData.length.to_s + " Pokemon in it.")
        if filteredRawData.length > 0
          for j in 0...filteredRawData.length
            Kernel.pbMessage("Transferring Pokemon " + (j+1).to_s + " out of " + filteredRawData.length.to_s + "...")
            if self.gen1save.convertToGen7Pokemon(filteredRawData[j])
              Kernel.pbMessage("Transfer successful!")
            else
              Kernel.pbMessage("Transfer failed! Please check if your PC Boxes are full!")
            end
          end
          Kernel.pbMessage("Box migration complete. Please save your game.")
        else
          Kernel.pbMessage("Please pick a different box and try again.")
        end
      end
    end

    How to use: Call the scene on the event like this:


    To-do on this script:
    • Actually remove the transferred Pokemon from the Gen 1 save file (this can be made optional)
    • Reading of Gen 2 savefiles
    • and more features not yet known
    __________________
    Coming soon: Pokemon Collective and Mercantile Versions.

    My college-life-advice blog.
    Reply With Quote
      #2    
    Old February 3rd, 2017 (4:03 AM).
    khkramer's Avatar
    khkramer khkramer is offline
       
      Join Date: Apr 2010
      Gender: Male
      Posts: 317
      Huh this is really cool, I'm definitely going to try this today!
      I would suggest making the removal from the save-game an option though, in case people want to the preserve the save game as is.
      __________________


      Lurking for 8 years..
      Reply With Quote
        #3    
      Old February 3rd, 2017 (8:05 AM).
      Zeak6464's Avatar
      Zeak6464 Zeak6464 is offline
      Zeak #3205 - Discord
         
        Join Date: Mar 2013
        Location: USA
        Age: 25
        Gender: Male
        Nature: Calm
        Posts: 551
        how does one use this script ?
        I have tried calling the script "Gen1Save.new" and "Gen1Save" but no luck.



        __________________
        Looking for a team to help me finish Pokemon Green Remix

        DM please
        Reply With Quote
          #4    
        Old February 3rd, 2017 (10:51 AM).
        khkramer's Avatar
        khkramer khkramer is offline
           
          Join Date: Apr 2010
          Gender: Male
          Posts: 317
          Quote:
          Originally Posted by Zeak6464 View Post
          how does one use this script ?
          I have tried calling the script "Gen1Save.new" and "Gen1Save" but no luck.




          I think you have to call
          Code:
          getGen1PokemonDataStruct()
          __________________


          Lurking for 8 years..
          Reply With Quote
            #5    
          Old February 3rd, 2017 (11:05 AM).
          rigbycwts's Avatar
          rigbycwts rigbycwts is offline
          Hmm, hmm.
             
            Join Date: Mar 2013
            Gender: Male
            Nature: Timid
            Posts: 98
            Quote:
            Originally Posted by Zeak6464 View Post
            how does one use this script ?
            I have tried calling the script "Gen1Save.new" and "Gen1Save" but no luck.



            Those are only utilities, you need to create your own "scene" for that.
            Here's a sample scene:
            Spoiler:

            Code:
            class PokeTransporterScene
              attr_accessor :gen1save
              
              def initialize
                @gen1save = Gen1Save.new
              end
              
              def pbPokeTransporterReadGen1Save
                Kernel.pbMessage("Trainer Name: " + self.gen1save.getSaveFileOTname)
                Kernel.pbMessage("Trainer ID: " + self.gen1save.getSaveFileOTId.to_s)
              end
            end
            __________________
            Coming soon: Pokemon Collective and Mercantile Versions.

            My college-life-advice blog.
            Reply With Quote
              #6    
            Old February 5th, 2017 (6:55 PM). Edited February 5th, 2017 by XerneasNeeds.
            XerneasNeeds's Avatar
            XerneasNeeds XerneasNeeds is offline
            Portalzone
               
              Join Date: Dec 2013
              Gender: Male
              Nature: Jolly
              Posts: 9
              Can somebody help me on making a sample scene for transferring, when I try to insert the scene into a script it doesn't load onto it.
              Reply With Quote
                #7    
              Old February 6th, 2017 (2:11 AM).
              khkramer's Avatar
              khkramer khkramer is offline
                 
                Join Date: Apr 2010
                Gender: Male
                Posts: 317
                Quote:
                Originally Posted by XerneasNeeds View Post
                Can somebody help me on making a sample scene for transferring, when I try to insert the scene into a script it doesn't load onto it.
                Do you initialize the scene somewhere?
                You have to manually call the scene if you want it to show.
                __________________


                Lurking for 8 years..
                Reply With Quote
                  #8    
                Old February 6th, 2017 (8:29 PM). Edited February 7th, 2017 by rigbycwts.
                rigbycwts's Avatar
                rigbycwts rigbycwts is offline
                Hmm, hmm.
                   
                  Join Date: Mar 2013
                  Gender: Male
                  Nature: Timid
                  Posts: 98
                  Updated the first post to allow the transferred Pokemon to keep the moves it had before transfer, and allows transfer of an entire box.
                  Also included a sample scene in the first post.

                  EDIT: Fixed a crash when trying to transfer Pokemon with less than 4 moves. Also, can confirm that this works with Pokemon Yellow.
                  __________________
                  Coming soon: Pokemon Collective and Mercantile Versions.

                  My college-life-advice blog.
                  Reply With Quote
                    #9    
                  Old February 7th, 2017 (11:06 AM). Edited February 7th, 2017 by Zeak6464.
                  Zeak6464's Avatar
                  Zeak6464 Zeak6464 is offline
                  Zeak #3205 - Discord
                     
                    Join Date: Mar 2013
                    Location: USA
                    Age: 25
                    Gender: Male
                    Nature: Calm
                    Posts: 551


                    Script Call:
                    Code:
                    s = PokeTransporterScene.new
                    s.pbVariableScreen(26)
                    v = $game_variables[26]-1
                    s.pbPokeTransporterReadGen1Save
                    s.pbPokeTransporterGetWholeBox(v)
                    New Def for Utilities:
                    Code:
                      def pbVariableScreen(id)
                       value=0
                      if $game_variables[id].is_a?(Numeric)
                        value=$game_variables[id]
                      end
                       params=ChooseNumberParams.new
                       params.setDefaultValue(value)
                       params.setMaxDigits(2)
                       params.setNegativesAllowed(false)
                       value=Kernel.pbMessageChooseNumber(_INTL("Set Box Number}."),params)
                      $game_variables[id]=[value,99999999].min
                      $game_variables[id]=[$game_variables[id],-99999999].max
                      end
                    __________________
                    Looking for a team to help me finish Pokemon Green Remix

                    DM please
                    Reply With Quote
                      #10    
                    Old February 7th, 2017 (4:31 PM).
                    rigbycwts's Avatar
                    rigbycwts rigbycwts is offline
                    Hmm, hmm.
                       
                      Join Date: Mar 2013
                      Gender: Male
                      Nature: Timid
                      Posts: 98
                      Quote:
                      Originally Posted by Zeak6464 View Post


                      Script Call:
                      Code:
                      s = PokeTransporterScene.new
                      s.pbVariableScreen(26)
                      v = $game_variables[26]-1
                      s.pbPokeTransporterReadGen1Save
                      s.pbPokeTransporterGetWholeBox(v)
                      New Def for Utilities:
                      Code:
                        def pbVariableScreen(id)
                         value=0
                        if $game_variables[id].is_a?(Numeric)
                          value=$game_variables[id]
                        end
                         params=ChooseNumberParams.new
                         params.setDefaultValue(value)
                         params.setMaxDigits(2)
                         params.setNegativesAllowed(false)
                         value=Kernel.pbMessageChooseNumber(_INTL("Set Box Number}."),params)
                        $game_variables[id]=[value,99999999].min
                        $game_variables[id]=[$game_variables[id],-99999999].max
                        end
                      I was thinking of a list of boxes though, but this will also do.

                      Also, for those who had an error regarding the Gen 1 Trainer name, I added a fix on the Utilities that resolves the issue. Check the first post.
                      __________________
                      Coming soon: Pokemon Collective and Mercantile Versions.

                      My college-life-advice blog.
                      Reply With Quote
                        #11    
                      Old February 7th, 2017 (4:51 PM).
                      Zeak6464's Avatar
                      Zeak6464 Zeak6464 is offline
                      Zeak #3205 - Discord
                         
                        Join Date: Mar 2013
                        Location: USA
                        Age: 25
                        Gender: Male
                        Nature: Calm
                        Posts: 551
                        When the code comes together:

                        __________________
                        Looking for a team to help me finish Pokemon Green Remix

                        DM please
                        Reply With Quote
                          #12    
                        Old February 16th, 2017 (2:19 AM).
                        rigbycwts's Avatar
                        rigbycwts rigbycwts is offline
                        Hmm, hmm.
                           
                          Join Date: Mar 2013
                          Gender: Male
                          Nature: Timid
                          Posts: 98
                          Updated the first post for a major overhaul and enabled selection of one of the multiple save files in the Gen 1 saves folder.
                          __________________
                          Coming soon: Pokemon Collective and Mercantile Versions.

                          My college-life-advice blog.
                          Reply With Quote
                            #13    
                          Old February 22nd, 2017 (10:54 PM). Edited March 9th, 2017 by IceGod64.
                          IceGod64's Avatar
                          IceGod64 IceGod64 is offline
                          In the Lost & Found bin!
                             
                            Join Date: Oct 2008
                            Location: Castelia City
                            Age: 30
                            Gender: Male
                            Nature: Naive
                            Posts: 624
                            I'm getting a couple different errors:
                            The line "pokemon.generated=1" is giving me an error in Essentialy v16.2 unmofidied, as is the function "retTimeFormatOne" in pbSaveAfterMigrate.

                            Also, it may be silly, but I've made a "completed" Pokemon list that also brings over glitch Pokemon, converting them to their Gen II counterparts.
                            Because I had a couple of glitch Pokemon in my save, and it was messing with things.

                            Code:
                            HEX_TO_PBSPECIES = {
                                #'00' => :KANGASKHAN, #Glitch Poke Missingno
                                '01' => :RHYDON,
                                '02' => :KANGASKHAN,
                                '03' => :NIDORANmA,
                                '04' => :CLEFAIRY,
                                '05' => :SPEAROW,
                                '06' => :VOLTORB,
                                '07' => :NIDOKING,
                                '08' => :SLOWBRO,
                                '09' => :IVYSAUR,
                                '0a' => :EXEGGUTOR,
                                '0b' => :LICKITUNG,
                                '0c' => :EXEGGCUTE,
                                '0d' => :GRIMER,
                                '0e' => :GENGAR,
                                '0f' => :NIDORANfE,
                                '10' => :NIDOQUEEN,
                                '11' => :CUBONE,
                                '12' => :RHYHORN,
                                '13' => :LAPRAS,
                                '14' => :ARCANINE,
                                '15' => :MEW,
                                '16' => :GYARADOS,
                                '17' => :SHELLDER,
                                '18' => :TENTACOOL,
                                '19' => :GASTLY,
                                '1a' => :SCYTHER,
                                '1b' => :STARYU,
                                '1c' => :BLASTOISE,
                                '1d' => :PINSIR,
                                '1e' => :TANGELA,
                                '1f' => :SCIZOR, #Glitch Poke
                                '20' => :SHUCKLE,#Glitch Poke
                                '21' => :GROWLITHE,
                                '22' => :ONIX,
                                '23' => :FEAROW,
                                '24' => :PIDGEY,
                                '25' => :SLOWPOKE,
                                '26' => :KADABRA,
                                '27' => :GRAVELER,
                                '28' => :CHANSEY,
                                '29' => :MACHOKE,
                                '2a' => :MRMIME,
                                '2b' => :HITMONLEE,
                                '2c' => :HITMONCHAN,
                                '2d' => :ARBOK,
                                '2e' => :PARASECT,
                                '2f' => :PSYDUCK,
                                '30' => :DROWZEE,
                                '31' => :GOLEM,
                                '32' => :HERACROSS, #Glitch Poke
                                '33' => :MAGMAR,
                                '34' => :HOOH, #Glitch Poke
                                '35' => :ELECTABUZZ,
                                '36' => :MAGNETON,
                                '37' => :KOFFING,
                                '38' => :SNEASEL, #Glitch Poke
                                '39' => :MANKEY,
                                '3a' => :SEEL,
                                '3b' => :DIGLETT,
                                '3c' => :TAUROS,
                                '3d' => :TEDDIURSA, #Glitch Poke
                                '3e' => :URSARING,  #Glitch Poke
                                '3f' => :SLUGMA,    #Glitch Poke
                                '40' => :FARFETCHD,
                                '41' => :VENONAT,
                                '42' => :DRAGONITE,
                                '43' => :MAGCARGO,  #Glitch Poke
                                '44' => :SWINUB,    #Glitch Poke
                                '45' => :PILOSWINE, #Glitch Poke
                                '46' => :DODUO,
                                '47' => :POLIWAG,
                                '48' => :JYNX,
                                '49' => :MOLTRES,
                                '4a' => :ARTICUNO,
                                '4b' => :ZAPDOS,
                                '4c' => :DITTO,
                                '4d' => :MEOWTH,
                                '4e' => :KRABBY,
                                '4f' => :CORSOLA,    #Glitch Poke
                                '50' => :REMORAID,  #Glitch Poke
                                '51' => :OCTILLERY, #Glitch Poke
                                '52' => :VULPIX,
                                '53' => :NINETALES,
                                '54' => :PIKACHU,
                                '55' => :RAICHU,
                                '56' => :DELIBIRD,  #Glitch Poke
                                '57' => :MANTINE,   #Glitch Poke
                                '58' => :DRATINI,
                                '59' => :DRAGONAIR,
                                '5a' => :KABUTO,
                                '5b' => :KABUTOPS,
                                '5c' => :HORSEA,
                                '5d' => :SEADRA,
                                '5e' => :SKARMORY,  #Glitch Poke
                                '5f' => :HOUNDOUR,  #Glitch Poke
                                '60' => :SANDSHREW,
                                '61' => :SANDSLASH,
                                '62' => :OMANYTE,
                                '63' => :OMASTAR,
                                '64' => :JIGGLYPUFF,
                                '65' => :WIGGLYTUFF,
                                '66' => :EEVEE,
                                '67' => :FLAREON,
                                '68' => :JOLTEON,
                                '69' => :VAPOREON,
                                '6a' => :MACHOP,
                                '6b' => :ZUBAT,
                                '6c' => :EKANS,
                                '6d' => :PARAS,
                                '6e' => :POLIWHIRL,
                                '6f' => :POLIWRATH,
                                '70' => :WEEDLE,
                                '71' => :KAKUNA,
                                '72' => :BEEDRILL,
                                '73' => :HOUNDOOOM, #Glitch Poke
                                '74' => :DODRIO,
                                '75' => :PRIMEAPE,
                                '76' => :DUGTRIO,
                                '77' => :VENOMOTH,
                                '78' => :DEWGONG,
                                '79' => :KINGDRA, #Glitch Poke
                                '7a' => :PHANPY,  #Glitch Poke
                                '7b' => :CATERPIE,
                                '7c' => :METAPOD,
                                '7d' => :BUTTERFREE,
                                '7e' => :MACHAMP,
                                '7f' => :DONPHAN, #Glitch Poke
                                '80' => :GOLDUCK,
                                '81' => :HYPNO,
                                '82' => :GOLBAT,
                                '83' => :MEWTWO,
                                '84' => :SNORLAX,
                                '85' => :MAGIKARP,
                                '86' => :PORYGON2,  #Glitch Poke
                                '87' => :STANTLER,  #Glitch Poke
                                '88' => :MUK,
                                '8a' => :KINGLER,
                                '8b' => :CLOYSTER,
                                '8c' => :TYROGUE, #Glitch Poke
                                '8d' => :ELECTRODE,
                                '8e' => :CLEFABLE,
                                '8f' => :WEEZING,
                                '90' => :PERSIAN,
                                '91' => :MAROWAK,
                                '92' => :HITMONTOP, #Glitch Poke
                                '93' => :HAUNTER,
                                '94' => :ABRA,
                                '95' => :ALAKAZAM,
                                '96' => :PIDGEOTTO,
                                '97' => :PIDGEOT,
                                '98' => :STARMIE,
                                '99' => :BULBASAUR,
                                '9a' => :VENUSAUR,
                                '9b' => :TENTACRUEL,
                                '9c' => :SMOOCHUM,  #Glitch Poke
                                '9d' => :GOLDEEN,
                                '9e' => :SEAKING,
                                '9f' => :ELEKID,  #Glitch Poke
                                'a0' => :MAGBY,   #Glitch Poke
                                'a1' => :MILTANK, #Glitch Poke
                                'a2' => :BLISSEY, #Glitch Poke
                                'a3' => :PONYTA,
                                'a4' => :RAPIDASH,
                                'a5' => :RATTATA,
                                'a6' => :RATICATE,
                                'a7' => :NIDORINO,
                                'a8' => :NIDORINA,
                                'a9' => :GEODUDE,
                                'aa' => :PORYGON,
                                'ab' => :AERODACTYL,
                                'ac' => :RAIKOU,  #Glitch Poke
                                'ad' => :MAGNEMITE,
                                'ae' => :ENTEI,   #Glitch Poke
                                'af' => :SUICUNE, #Glitch Poke
                                'b0' => :CHARMANDER,
                                'b1' => :SQUIRTLE,
                                'b2' => :CHARMELEON,
                                'b3' => :WARTORTLE,
                                'b4' => :CHARIZARD,
                                'b5' => :LARVITAR,  #Glitch Poke
                                'b6' => :PUPITAR,   #Glitch Poke
                                'b7' => :TYRANITAR, #Glitch Poke
                                'b8' => :LUGIA,     #Glitch Poke
                                'b9' => :ODDISH,
                                'ba' => :GLOOM,
                                'bb' => :VILEPLUME,
                                'bc' => :BELLSPROUT,
                                'bd' => :WEEPINBELL,
                                'be' => :VICTREEBEL,
                                #End of legitimate roster.
                                'bf' => :CHIKORITA, #Glitch Poke >A
                                'c0' => :BAYLEEF,   #Glitch Poke a
                                'c1' => :MEGANIUM,  #Glitch Poke 
                                'c2' => :CYNDAWUIL, #Glitch Poke % .4
                                'c3' => :QUILAVA,   #Glitch Poke, h POKé
                                'c4' => :TYPHLOSION,#Glitch Poke PokéWTrainer
                                'c5' => :TOTODILE,  #Glitch Poke PkMn
                                'c6' => :CROCONAW,  #Glitch Poke %L%M 4
                                'c7' => :FERALIGATR,#Glitch Poke P% %%T
                                'c8' => :SENTRET,   #Glitch Poke %U?
                                'c9' => :FURRET,    #Glitch Poke >% 8
                                'ca' => :HOOTHOOT,  #Glitch Poke PC4SH
                                'cb' => :NOCTOWL,   #Glitch Poke p
                                'cc' => :LEDYBA,    #Glitch Poke PkMn>n
                                'cd' => :LEDIAN,    #Glitch Poke Trainer
                                'ce' => :SPINARAK,  #Glitch Poke V W G d
                                'cf' => :ARIADOS,   #Glitch Poke OPlMn4X
                                'd0' => :CROBAT,    #Glitch Poke PkMnPkMnT
                                'd1' => :CHINCHOU,  #Glitch Poke 4B 8 4 8
                                'd2' => :LANTURN,   #Glitch Poke % '
                                'd3' => :PICHU,     #Glitch Poke M p'u %
                                'd4' => :CLEFFA,    #Glitch Poke A% G
                                'd5' => :IGGLYBUFF, #Glitch Poke P% % %
                                'd6' => :TOGEPI,    #Glitch Poke 4 h
                                'd7' => :TOGETIC,   #Glitch Poke
                                'd8' => :NATU,      #Glitch Poke PkMnaPkMn%^fPkMn
                                'd9' => :XATU,      #Glitch Poke PkMnRPkMn"
                                'da' => :MAREEP,    #Glitch Poke B
                                'db' => :FLAFFY,    #Glitch Poke
                                'dc' => :AMPHAROS,  #Glitch Poke
                                'dd' => :BELLOSSOM, #Glitch Poke 7PkMn'v
                                'de' => :MARILL,    #Glitch Poke -PkMn
                                'df' => :AZUMARILL, #Glitch Poke .PkMn
                                'e0' => :SUDOWOODO, #Glitch Poke /PkMn V PkMn
                                'e1' => :POLITOED,  #Glitch Poke 'v
                                'e2' => :HOPPIP,    #Glitch Poke ......
                                'e3' => :SKIPLOOM,  #Glitch Poke
                                'e4' => :JUMPLUFF,  #Glitch Poke
                                'e5' => :AIPOM,     #Glitch Poke C
                                'e6' => :SUNKERN,   #Glitch Poke - -
                                'e7' => :SUNFLORA,  #Glitch Poke P& 4$
                                'e8' => :YANMA,     #Glitch Poke C X
                                'e9' => :WOOPER,    #Glitch Poke c
                                'ea' => :QUAGSIRE,  #Glitch Poke A
                                'eb' => :ESPEON,    #Glitch Poke
                                'ec' => :UMBREON,   #Glitch Poke
                                'ed' => :MURKROW,   #Glitch Poke h%
                                'ee' => :SLOWKING,  #Glitch Poke .g
                                'ef' => :MISDREAVUS,#Glitch Poke %$'M
                                'f0' => :UNOWN,     #Glitch Poke %$
                                'f1' => :WOBBUFFET, #Glitch Poke 94
                                'f2' => :GIRAFARIG, #Glitch Poke
                                'f3' => :PINECO,    #Glitch Poke
                                'f4' => :FORRETRESS,#Glitch Poke
                                'f5' => :DUNSPARCE, #Glitch Poke
                                'f6' => :GLIGAR,    #Glitch Poke G'Mp
                                'f7' => :STEELIX,   #Glitch Poke 'Ng'Mp
                                'f8' => :SNUBBULL,  #Glitch Poke 'Ng %$
                                'f9' => :GRANBULL,  #Glitch Poke 94 h
                                'fa' => :QWILFISH,  #Glitch Poke
                                'fb' => :CELEBI,    #Glitch Poke 'M 'N g
                                'fc' => :TREEKO,    #Glitch Poke O
                                'fd' => :GROVYLE,   #Glitch Poke %$ 6%
                                'fe' => :SCEPTILE,  #Glitch Poke 'M
                                'ff' => :TORCHIC    #Glitch Poke 'M
                            }
                            Of course, it'll still glitch out if said Pokemon known moves beyond a4, but I just filled those in as Pound.

                            However, I notice that nicknames do not carry over... I suppose that's intended for later?
                            __________________

                            Reply With Quote
                              #14    
                            Old February 23rd, 2017 (3:09 AM). Edited February 23rd, 2017 by rigbycwts.
                            rigbycwts's Avatar
                            rigbycwts rigbycwts is offline
                            Hmm, hmm.
                               
                              Join Date: Mar 2013
                              Gender: Male
                              Nature: Timid
                              Posts: 98
                              Quote:
                              Originally Posted by IceGod64 View Post
                              I'm getting a couple different errors:
                              The line "pokemon.generated=1" is giving me an error in Essentialy v16.2 unmofidied, as is the function "retTimeFormatOne" in pbSaveAfterMigrate.

                              ...

                              However, I notice that nicknames do not carry over... I suppose that's intended for later?
                              Added on how to fix the generated attribute error in the first post, since my intention with it is to make the Gameboy icon appear on the summary.
                              Regarding nicknames, it is intended for later.

                              EDIT: retTimeFormatOne is used in shiney570's BW2 mod. Looks like I forgot to filter that part out.
                              __________________
                              Coming soon: Pokemon Collective and Mercantile Versions.

                              My college-life-advice blog.
                              Reply With Quote
                                #15    
                              Old September 27th, 2017 (10:47 AM).
                              rigbycwts's Avatar
                              rigbycwts rigbycwts is offline
                              Hmm, hmm.
                                 
                                Join Date: Mar 2013
                                Gender: Male
                                Nature: Timid
                                Posts: 98
                                Since Gold and Silver already have Virtual Console releases, Gen 2 support for this script is currently being worked on.
                                Also, I need to test this if it still works on Essentials v17.
                                __________________
                                Coming soon: Pokemon Collective and Mercantile Versions.

                                My college-life-advice blog.
                                Reply With Quote
                                Reply

                                Quick Reply

                                Join the conversation!

                                Create an account to post a reply in this thread, participate in other discussions, and more!

                                Create a PokéCommunity Account
                                Thread Tools

                                Posting Rules
                                You may not post new threads
                                You may not post replies
                                You may not post attachments
                                You may not edit your posts

                                BB code is On
                                Smilies are On
                                [IMG] code is On
                                HTML code is Off

                                Forum Jump


                                All times are GMT -8. The time now is 9:05 PM.