• Our software update is now concluded. You will need to reset your password to log in. In order to do this, you will have to click "Log in" in the top right corner and then "Forgot your password?".
  • Welcome to PokéCommunity! Register now and join one of the best fan communities on the 'net to talk Pokémon and more! We are not affiliated with The Pokémon Company or Nintendo.

-REQUEST- Custom EV/Happiness Screen for Pokegear

302
Posts
13
Years
    • Seen Aug 25, 2014
    Hi, I apologize ahead of time if this isn't the right place to make script requests for Essentials, because I don't see it anywhere on this board, and this isn't really suited for the "resource request" topic (isn't it?).

    Anyway, I would like to request a new "summary-like" or display type of script that would serve as a feature of the Pokegear. In my game, the screen would be called the "PokeExaminer," and it's purpose is to show the player how many Effort Points a species has, the value of their happiness, and also preferred berry flavor.

    I am fully aware of the EV/IV screen script listed on PE's Wiki, but that script is not only poorly worded, the layout isn't desirable for me and I don't want this part of the summary screen, and instead accessed from the Pokegear.

    As I can explain all of this better through pictures than with words, let me show you the following mock-ups to illustrate precisely what I want:

    PokeExaminer_mockup1.png

    Basically, though my custom-made gear, the player would select a button that would go to the "PokeExaminer" screen.

    PokeExaminer_mockup2.png

    This is the mock-up for the examiner screen itself. I generally want the same layout, similar to that of a typical summary screen. You don't need to provide a graphic for the background of this scene, by the way. I'll do that myself.

    The pink bubbled numbers correlate to the following notes:

    Spoiler:



    If anyone could make this script for me, that would be awesome and would be greatly appreciated. If you think this is a hefty task or something I can do myself, I understand as well. Keep in mind, however, that because I'm somewhat inept when it comes to scripting, I would love to receive help from someone to make this happen.

    Thanks!
     
    14
    Posts
    10
    Years
    • Seen Jun 7, 2014
    I would have no idea how to do this, but it sounds like a great idea. You wouldn't mind if I borrowed it, would you?
     

    Nickalooose

    --------------------
    1,309
    Posts
    16
    Years
    • Seen Dec 28, 2023
    I've seen a similar request like this somewhere else and the advice given was to use the PokéGear script, I think... However, everything you want is already made, the Summary screen already does this... Take a page from that (literally; pageone, pagetwo, pagethree, pagefour) and remove things such as descriptions, abilities and moves etc.

    All you need to do is change the positions of things and the titles, text and coloring.

    You don't need scripting knowledge to do things like this just the know-how, of functions such as:
    ctrl+shift+f
    ctrl+f
    ctrl+v
    ctrl+c

    Have a go at it yourself, when you've tried everything... Come back... Show us what you've done and we will help you thereon... Remember, just because an Apple produces juice, doesn't mean it has to be squeezed.
     
    302
    Posts
    13
    Years
    • Seen Aug 25, 2014
    So I decided to take Nickalooose's advice on this, even deciding to change things around with it by displaying the breeding group of a Pokemon (for this I copied a bit from FL's advanced Pokedex Script. I guess I'll credit him for it?).


    Unfortunately, I don't know whether it works or not because I can't even access the scene from the Pokegear. During gameplay, I see the option for the examiner displayed on the menu, but it takes me to the Jukebox instead, for some reason. The jukebox app, in turn, does nothing.

    I'll post both the edited PokemonPokegear and the new PokemonExaminer script I have for you guys to pick apart, because I'm not sure what I'm doing wrong, exactly.

    PokemonPokegear:
    Code:
    class PokegearButton < SpriteWrapper
      attr_reader :index
      attr_reader :name
      attr_accessor :selected
    
      def initialize(x,y,name="",index=0,viewport=nil)
        super(viewport)
        @index=index
        @name=name
        @selected=false
        fembutton=pbResolveBitmap(sprintf("Graphics/Pictures/pokegearButtonf"))
        if $Trainer.gender==1 && fembutton
          @button=AnimatedBitmap.new("Graphics/Pictures/pokegearButtonf")
        else
          @button=AnimatedBitmap.new("Graphics/Pictures/pokegearButton")
        end
        @contents=BitmapWrapper.new(@button.width,@button.height)
        self.bitmap=@contents
        self.x=x
        self.y=y
        update
      end
    
      def dispose
        @button.dispose
        @contents.dispose
        super
      end
    
      def refresh
        self.bitmap.clear
        self.bitmap.blt(0,0,@button.bitmap,Rect.new(0,0,@button.width,@button.height))
        pbSetSystemFont(self.bitmap)
        textpos=[          # Name is written on both unselected and selected buttons
           [@name,self.bitmap.width/349,93,2,Color.new(248,248,248),Color.new(40,40,40)],
           [@name,self.bitmap.width/2,62,2,Color.new(248,248,248),Color.new(40,40,40)]
        ]
        pbDrawTextPositions(self.bitmap,textpos)
        icon=sprintf("Graphics/Pictures/pokegear"+@name)
        imagepos=[         # Icon is put on both unselected and selected buttons
           [icon,64,64,0,0,-1,-1],
           [icon,64,192,0,0,-1,-1],
           [icon,224,192,0,0,-1,-1],
           [icon,224,192,0,0,-1,-1],
        ]
        pbDrawImagePositions(self.bitmap,imagepos)
      end
    
      def update
        if self.selected
          self.src_rect.set(0,self.bitmap.height/2,self.bitmap.width,self.bitmap.height/2)
        else
          self.src_rect.set(0,0,self.bitmap.width,self.bitmap.height/2)
        end
        refresh
        super
      end
    end
    
    
    
    #===============================================================================
    # - Scene_Pokegear
    #-------------------------------------------------------------------------------
    # Modified By Harshboy
    # Modified by Peter O.
    # Also Modified By OblivionMew
    # Overhauled by Maruno
    #===============================================================================
    class Scene_Pokegear
      #-----------------------------------------------------------------------------
      # initialize
      #-----------------------------------------------------------------------------
      def initialize(menu_index = 0)
        @menu_index = menu_index
      end
      #-----------------------------------------------------------------------------
      # main
      #-----------------------------------------------------------------------------
      def main
        commands=[]
    # OPTIONS - If you change these, you should also change update_command below.
        @cmdMap=-1
        @cmdPhone=-1
        @cmdJukebox=-1
        @cmdExaminer=-1
        commands[@cmdMap=commands.length]=_INTL("Map")
        commands[@cmdPhone=commands.length]=_INTL("Phone") if $PokemonGlobal.phoneNumbers &&
                                                              $PokemonGlobal.phoneNumbers.length>0
        commands[@cmdJukebox=commands.length]=_INTL("Jukebox")
        commands[@cmdJukebox=commands.length]=_INTL("Examiner")
    
        @viewport=Viewport.new(0,0,Graphics.width,Graphics.height)
        @viewport.z=99999
        @button=AnimatedBitmap.new("Graphics/Pictures/pokegearButton")
        @sprites={}
        @sprites["background"] = IconSprite.new(0,0)
        femback=pbResolveBitmap(sprintf("Graphics/Pictures/pokegearbgf"))
        if $Trainer.gender==1 && femback
          @sprites["background"].setBitmap("Graphics/Pictures/pokegearbgf")
        else
          @sprites["background"].setBitmap("Graphics/Pictures/pokegearbg")
        end
        @sprites["command_window"] = Window_CommandPokemon.new(commands,160)
        @sprites["command_window"].index = @menu_index
        @sprites["command_window"].x = Graphics.width
        @sprites["command_window"].y = 0
        for i in 0...commands.length
          x=118
          y=196 - (commands.length*24) + (i*48)
          @sprites["button#{i}"]=PokegearButton.new(x,y,commands[i],i,@viewport)
          @sprites["button#{i}"].selected=(i==@sprites["command_window"].index)
          @sprites["button#{i}"].update
        end
        Graphics.transition
        loop do
          Graphics.update
          Input.update
          update
          if $scene != self
            break
          end
        end
        Graphics.freeze
        pbDisposeSpriteHash(@sprites)
      end
      #-----------------------------------------------------------------------------
      # update the scene
      #-----------------------------------------------------------------------------
      def update
        pbUpdateSpriteHash(@sprites)
        for i in 0...@sprites["command_window"].commands.length
          sprite=@sprites["button#{i}"]
          sprite.selected=(i==@sprites["command_window"].index) ? true : false
        end
        #update command window and the info if it's active
        if @sprites["command_window"].active
          update_command
          return
        end
      end
      #-----------------------------------------------------------------------------
      # update the command window
      #-----------------------------------------------------------------------------
      def update_command
        if Input.trigger?(Input::B)
          pbPlayCancelSE()
          $scene = Scene_Map.new
          return
        end
        if Input.trigger?(Input::C)
          if @cmdMap>=0 && @sprites["command_window"].index==@cmdMap
            pbPlayDecisionSE()
            pbShowMap(-1,false)
          end
          if @cmdPhone>=0 && @sprites["command_window"].index==@cmdPhone
            pbPlayDecisionSE()
            pbFadeOutIn(99999) {
               PokemonPhoneScene.new.start
            }
          end
          if @cmdJukebox>=0 && @sprites["command_window"].index==@cmdJukebox
            pbPlayDecisionSE()
            $scene = Scene_Jukebox.new
          end
          if @cmdExaminer>=0 && @sprites["command_window"].index==@cmdExaminer
            pbPlayDecisionSE()
            pbFadeOutIn(99999) {
               PokemonExaminer.new.initialize
            }
          end
          return
        end
      end
    end
    I'm also having trouble getting the button graphics to display like the mock-up I've shown in the first post, but that's a new help topic altogether.


    PokemonExaminer:
    Code:
    class Scene_Examiner
      def pbPokerus(pkmn)
        return pkmn.pokerusStage
      end
    
      def pbUpdate
        pbUpdateSpriteHash(@sprites)
      end
    
      def pbStartScene(party,partyindex)
        @viewport=Viewport.new(0,0,Graphics.width,Graphics.height)
        @viewport.z=99999
        @party=party
        @partyindex=partyindex
        @pokemon=@party[@partyindex]
        @sprites={}
        @typebitmap=AnimatedBitmap.new(_INTL("Graphics/Pictures/types"))
        @sprites["background"]=IconSprite.new(0,0,@viewport)
        @sprites["overlay"]=BitmapSprite.new(Graphics.width,Graphics.height,@viewport)
        @sprites["pokemon"]=PokemonSprite.new(@viewport)
        @sprites["pokemon"].setPokemonBitmap(@pokemon)
        @sprites["pokemon"].mirror=true
        @sprites["pokemon"].color=Color.new(0,0,0,0)
        pbPositionPokemonSprite(@sprites["pokemon"],40,134)
        @sprites["pokeicon"]=PokemonBoxIcon.new(@pokemon,@viewport)
        @sprites["pokeicon"].x=14
        @sprites["pokeicon"].y=52
        @sprites["pokeicon"].mirror=false
        @sprites["pokeicon"].visible=false
        @sprites["movepresel"]=MoveSelectionSprite.new(@viewport)
        @sprites["movepresel"].visible=false
        @sprites["movepresel"].preselected=true
        @sprites["movesel"]=MoveSelectionSprite.new(@viewport)
        @sprites["movesel"].visible=false
        @page=0
        drawPageOne(@pokemon)
        pbFadeInAndShow(@sprites) { pbUpdate }
      end
    
      def pbEndScene
        pbFadeOutAndHide(@sprites) { pbUpdate }
        pbDisposeSpriteHash(@sprites)
        @typebitmap.dispose
        @viewport.dispose
      end
    
      #Draw the page
      def drawPageOne(pokemon)
        if pokemon.egg?
          drawPageOneEgg(pokemon)
          return
        end
        overlay=@sprites["overlay"].bitmap
        overlay.clear
        @sprites["background"].setBitmap("Graphics/Pictures/pokeexamScreen")
        imagepos=[]
        if pbPokerus(pokemon)==1 || pokemon.hp==0 || @pokemon.status>0
          status=6 if pbPokerus(pokemon)==1
          [email protected] if @pokemon.status>0
          status=5 if pokemon.hp==0
          imagepos.push(["Graphics/Pictures/statuses",124,100,0,16*status,44,16])
        end
        if pokemon.isShiny?
          imagepos.push([sprintf("Graphics/Pictures/shiny"),2,134,0,0,-1,-1])
        end
        if pbPokerus(pokemon)==2
          imagepos.push([sprintf("Graphics/Pictures/summaryPokerus"),176,100,0,0,-1,-1])
        end
        [email protected] ? @pokemon.ballused : 0
        ballimage=sprintf("Graphics/Pictures/summaryball%02d",@pokemon.ballused)
        imagepos.push([ballimage,14,60,0,0,-1,-1])
        if (pokemon.isShadow? rescue false)
          imagepos.push(["Graphics/Pictures/summaryShadow",224,240,0,0,-1,-1])
          shadowfract=pokemon.heartgauge*1.0/PokeBattle_Pokemon::HEARTGAUGESIZE
          imagepos.push(["Graphics/Pictures/summaryShadowBar",242,280,0,0,(shadowfract*248).floor,-1])
        end
        #-----------Define things I guess----------
        pbDrawImagePositions(overlay,imagepos)
        base=Color.new(248,248,248)
        shadow=Color.new(104,104,104)
        statshadows=[]
        for i in 0...5; statshadows[i]=shadow; end
        if !(pokemon.isShadow? rescue false) || pokemon.heartStage<=3
          natup=(pokemon.nature/5).floor
          natdn=(pokemon.nature%5).floor
          statshadows[natup]=Color.new(136,96,72) if natup!=natdn
          statshadows[natdn]=Color.new(64,120,152) if natup!=natdn
        end
        pbSetSystemFont(overlay)
        numberbase=(pokemon.isShiny?) ? Color.new(248,56,32) : Color.new(64,64,64)
        numbershadow=(pokemon.isShiny?) ? Color.new(224,152,144) : Color.new(176,176,176)
        speciesname=PBSpecies.getName(pokemon.species)
        growthrate=pokemon.growthrate
        [email protected]
        natureBoost=_INTL("")
        natureBoost=_INTL("+10%") if pokemon.nature==natup
        natureBoost=_INTL("-10%") if pokemon.nature==natdn
        #V------ I stole this code from FL's Advanced Pokedex script
        pbDexDataOffset(dexdata,@species,31)
        compat10=dexdata.fgetb
        compat11=dexdata.fgetb
        eggGroupArray=[
            nil,_INTL("Monster"),_INTL("Water1"),_INTL("Bug"),_INTL("Flying"),
            _INTL("Field"),_INTL("Fairy"),_INTL("Plant"),_INTL("Human-Like"),
            _INTL("Water3"),_INTL("Mineral"),_INTL("Amorphous"),
            _INTL("Water2"),_INTL("Ditto"),_INTL("Dragon"),_INTL("No Eggs")
        ]
        eggGroups = compat10==compat11 ? eggGroupArray[compat10] : 
            _INTL("{1}, {2}",eggGroupArray[compat10],eggGroupArray[compat11])
        #-------End of awesomely stolen code
        if @pokemon.name.split('').last=="♂" || @pokemon.name.split('').last=="♀"
          [email protected][0..-2]
        end
        textpos=[
           [_INTL("POKéMON EXAMINER"),26,16,0,base,shadow],
           [pokename,46,62,0,base,shadow],
           [_INTL("{1}",pokemon.level),46,92,0,Color.new(64,64,64),Color.new(176,176,176)],
           [_INTL("Egg Group"),16,320,0,base,shadow],
           [eggGroups,16,352,0,Color.new(64,64,64),Color.new(176,176,176)],
           [_INTL("HP"),232,114,2,base,shadow],
           [_ISPRINTF("{1:d}",pokemon.totalhp),293,114,1,Color.new(64,64,64),Color.new(176,176,176)],
           [_ISPRINTF(""),360,114,1,base,shadow],
           [_ISPRINTF("+{1:3d}",pokemon.ev[0]),440,114,1,Color.new(0,136,72),Color.new(176,176,176)],
           [_INTL("Atk:"),232,146,0,base,shadow],
           [natureBoost,360,146,1,statshadows[0],shadow],
           [_ISPRINTF("{1:d}",pokemon.attack),293,146,1,Color.new(64,64,64),Color.new(176,176,176)],
           [_ISPRINTF("+{1:3d}",pokemon.ev[1]),440,146,1,Color.new(0,136,72),Color.new(176,176,176)],
           [_INTL("Def:"),232,178,0,base,shadow],
           [natureBoost,360,178,1,statshadows[1],shadow],
           [_ISPRINTF("{1:d}",pokemon.defense),293,178,1,Color.new(64,64,64),Color.new(176,176,176)],
           [_ISPRINTF("+{1:3d}",pokemon.ev[2]),440,178,1,Color.new(0,136,72),Color.new(176,176,176)],
           [_INTL("SpAtk:"),232,210,0,base,shadow],
           [natureBoost,360,210,1,statshadows[3],shadow],
           [_ISPRINTF("{1:d}",pokemon.spatk),293,210,1,Color.new(64,64,64),Color.new(176,176,176)],
           [_ISPRINTF("+{1:3d}",pokemon.ev[4]),440,210,1,Color.new(0,136,72),Color.new(176,176,176)],
           [_INTL("SpDef:"),232,242,0,base,shadow],
           [natureBoost,360,242,1,statshadows[4],shadow],
           [_ISPRINTF("{1:d}",pokemon.spdef),293,242,1,Color.new(64,64,64),Color.new(176,176,176)],
           [_ISPRINTF("+{1:3d}",pokemon.ev[5]),440,242,1,Color.new(0,136,72),Color.new(176,176,176)],
           [_INTL("Spd:"),232,274,0,base,shadow],
           [natureBoost,360,274,1,statshadows[2],shadow],
           [_ISPRINTF("{1:d}",pokemon.speed),293,274,1,Color.new(64,64,64),Color.new(176,176,176)],
           [_ISPRINTF("+{1:3d}",pokemon.ev[3]),440,274,1,Color.new(0,136,72),Color.new(176,176,176)],
           [_INTL("{1:d}",pokemon.happiness),340,312,0,base,shadow],
        ]
        if pokemon.gender==0
          textpos.push([_INTL("♂"),178,62,0,Color.new(24,112,216),Color.new(136,168,208)])
        elsif pokemon.gender==1
          textpos.push([_INTL("♀"),178,62,0,Color.new(248,56,32),Color.new(224,152,144)])
        end
        pbDrawTextPositions(overlay,textpos)
      end
    
      def drawPageOneEgg(pokemon)
        overlay=@sprites["overlay"].bitmap
        overlay.clear
        @sprites["background"].setBitmap("Graphics/Pictures/pokeexamScreen")
        imagepos=[]
        [email protected] ? @pokemon.ballused : 0
        ballimage=sprintf("Graphics/Pictures/summaryball%02d",@pokemon.ballused)
        imagepos.push([ballimage,14,60,0,0,-1,-1])
        #-----------Define things I guess----------
        pbDrawImagePositions(overlay,imagepos)
        base=Color.new(248,248,248)
        shadow=Color.new(104,104,104)
        pbSetSystemFont(overlay)
        textpos=[
           [_INTL("POKéMON EXAMINER"),26,16,0,base,shadow],
           [pokemon.name,46,62,0,base,shadow],
           [_INTL("???"),46,92,0,Color.new(64,64,64),Color.new(176,176,176)],
           [_INTL("Egg Group"),16,320,0,base,shadow],
           [_ISPRINTF("???"),16,352,0,Color.new(64,64,64),Color.new(176,176,176)],
           [_INTL("HP"),292,76,2,base,shadow],
           [_ISPRINTF("???"),462,76,1,Color.new(64,64,64),Color.new(176,176,176)],
           [_INTL("Attack"),248,120,0,base,shadow],
           [_ISPRINTF("???"),456,120,1,Color.new(64,64,64),Color.new(176,176,176)],
           [_INTL("Defense"),248,152,0,base,shadow],
           [_ISPRINTF("???"),456,152,1,Color.new(64,64,64),Color.new(176,176,176)],
           [_INTL("Sp. Atk"),248,184,0,base,shadow],
           [_ISPRINTF("???"),456,184,1,Color.new(64,64,64),Color.new(176,176,176)],
           [_INTL("Sp. Def"),248,216,0,base,shadow],
           [_ISPRINTF("???"),456,216,1,Color.new(64,64,64),Color.new(176,176,176)],
           [_INTL("Speed"),248,248,0,base,shadow],
           [_ISPRINTF("???"),456,248,1,Color.new(64,64,64),Color.new(176,176,176)],
           [_INTL("???"),248,248,0,base,shadow],
        ]
        pbDrawTextPositions(overlay,textpos)
      end
    
      def pbGoToPrevious
        if @page!=0
          newindex=@partyindex
          while newindex>0
            newindex-=1
            if @party[newindex] && !@party[newindex].egg?
              @partyindex=newindex
              break
            end
          end
        else
          newindex=@partyindex
          while newindex>0
            newindex-=1
            if @party[newindex]
              @partyindex=newindex
              break
            end
          end
        end
      end
    
      def pbGoToNext
        if @page!=0
          newindex=@partyindex
          while newindex<@party.length-1
            newindex+=1
            if @party[newindex] && !@party[newindex].egg?
              @partyindex=newindex
              break
            end
          end
        else
          newindex=@partyindex
          while newindex<@party.length-1
            newindex+=1
            if @party[newindex]
              @partyindex=newindex
              break
            end
          end
        end
      end
    
      def pbScene
        pbPlayCry(@pokemon)
        loop do
          Graphics.update
          Input.update
          pbUpdate
          if Input.trigger?(Input::B)
            break
          end
          dorefresh=false
          if Input.trigger?(Input::C)
            if @page==0
              break
            elsif @page==3
              pbMoveSelection
              dorefresh=true
              drawPageFour(@pokemon)
            end
          end
          if Input.trigger?(Input::UP) && @partyindex>0
            pbGoToPrevious
            @pokemon=@party[@partyindex]
            @sprites["pokemon"].setPokemonBitmap(@pokemon)
            @sprites["pokemon"].color=Color.new(0,0,0,0)
            pbPositionPokemonSprite(@sprites["pokemon"],40,144)
            dorefresh=true
            pbPlayCry(@pokemon)
          end
          if Input.trigger?(Input::DOWN) && @partyindex<@party.length-1
            pbGoToNext
            @pokemon=@party[@partyindex]
            @sprites["pokemon"].setPokemonBitmap(@pokemon)
            @sprites["pokemon"].color=Color.new(0,0,0,0)
            pbPositionPokemonSprite(@sprites["pokemon"],40,144)
            dorefresh=true
            pbPlayCry(@pokemon)
          end
          if dorefresh
            case @page
              when 0
                drawPageOne(@pokemon)
              when 1
                drawPageTwo(@pokemon)
              when 2
                drawPageThree(@pokemon)
              when 3
                drawPageFour(@pokemon)
              when 4
                drawPageFive(@pokemon)
            end
          end
        end
        return @partyindex
      end
    end
    
    
    
    class PokemonExaminer
      def initialize(scene)
        @scene=scene
      end
    
      def pbStartScreen(party,partyindex)
        @scene.pbStartScene(party,partyindex)
        [email protected]
        @scene.pbEndScene
        return ret
      end
    end
     

    ~JV~

    Dev of Pokémon Uranium
    684
    Posts
    16
    Years
  • To test your script just do a script call in any event with "$scene = Scene_Examiner.new".
     
    302
    Posts
    13
    Years
    • Seen Aug 25, 2014
    To test your script just do a script call in any event with "$scene = Scene_Examiner.new".

    I actually decided to put that in the Pokegear script itself. I figured out why the Pokegear didn't call the script correctly, because on line 91 I listed "@cmdJukebox" twice instead of the examiner, so calling the script from the Pokegear finally works.


    ... But now I got this:
    Code:
    Exception: NoMethodError
    Message: undefined method `main' for #<Scene_Examiner:0xa87fed0>
    PokemonUtilities:992:in `pbLoadRpgxpScene'
    PokemonPauseMenu:169:in `pbStartPokemonMenu'
    PokemonPauseMenu:144:in `loop'
    PokemonPauseMenu:264:in `pbStartPokemonMenu'
    Scene_Map:188:in `call_menu'
    Scene_Map:159:in `update'
    Scene_Map:68:in `main'
    Scene_Map:65:in `loop'
    Scene_Map:72:in `main'
    Main:37:in `mainFunctionDebug'
    I don't see a "main" in Scene_Examiner at all, so I don't understand what this error message is talking about. Any help would be appreciated.
     

    Nickalooose

    --------------------
    1,309
    Posts
    16
    Years
    • Seen Dec 28, 2023
    If it works, what's the problem?

    Do you click something in your examiner?
    Does the examiner even load?
    Does the error appear when you click the icon in PokéGear?

    Try calling PokemonExaminer instead of Scene_Examiner

    Congrats on doing this yourself btw and you tried getting someone to do this for you... It's not as hard as everyone thinks, is it ;)
     
    302
    Posts
    13
    Years
    • Seen Aug 25, 2014
    If it works, what's the problem?

    Do you click something in your examiner?
    Does the examiner even load?
    Does the error appear when you click the icon in PokéGear?

    Try calling PokemonExaminer instead of Scene_Examiner

    Congrats on doing this yourself btw and you tried getting someone to do this for you... It's not as hard as everyone thinks, is it ;)

    The error message appeared when I selected the Examiner from the Pokegear. To clarify, what "works" is that the Pokegear is actually calling what I specified instead of loading the Jukebox, which occurred due to the typo I mentioned in my last post. So yeah, the new problem is that the Examiner won't even start.

    I tried calling PokemonExaminer instead of Scene_Examiner, as you suggested. However, I got an argument error:
    Code:
    Exception: ArgumentError
    Message: wrong number of arguments(0 for 1)
    PokemonPokegear:168:in `initialize'
    PokemonPokegear:168:in `new'
    PokemonPokegear:168:in `update_command'
    PokemonPokegear:138:in `update'
    PokemonPokegear:119:in `main'
    PokemonPokegear:116:in `loop'
    PokemonPokegear:123:in `main'
    PokemonUtilities:992:in `pbLoadRpgxpScene'
    PokemonPauseMenu:169:in `pbStartPokemonMenu'
    PokemonPauseMenu:144:in `loop'

    This is the exact code I typed in line 166 of the Pokegear script:
    Code:
          if @cmdExaminer>=0 && @sprites["command_window"].index==@cmdExaminer
            pbPlayDecisionSE()
            $scene = PokemonExaminer.new
          end
     
    1,224
    Posts
    10
    Years
  • I don't know if it's your main problem, but the fact that you don't have def's for these
    Code:
    when 1
                drawPageTwo(@pokemon)
              when 2
                drawPageThree(@pokemon)
              when 3
                drawPageFour(@pokemon)
              when 4
                drawPageFive(@pokemon)
    will probably present problems later at the very least.
     

    Nickalooose

    --------------------
    1,309
    Posts
    16
    Years
    • Seen Dec 28, 2023
    Try:
    Code:
        scene=Scene_Examiner.new
        screen=PokemonExaminer.new(scene)
        screen.pbStartScreen(party,partyindex)
     
    302
    Posts
    13
    Years
    • Seen Aug 25, 2014
    Try:
    Code:
        scene=Scene_Examiner.new
        screen=PokemonExaminer.new(scene)
        screen.pbStartScreen(party,partyindex)

    Did this sometime around last night, and it still gave me an error message, specifically an "undefined local variable" message. One problem I think I've narrowed down is that "party" and "partyindex" are two variables that aren't defined in the PokeGear script. I don't know what code I should use that would get both information on the player's party and the party member the player has currently selected.

    Thanks for sticking with me on this, though.

    --------------
    EDIT:

    I tried this:
    Code:
                party=@party
                partyindex=@partyindex
                scene=Scene_Examiner.new
                screen=PokemonExaminer.new(scene)
                screen.pbStartScreen(party,partyindex)

    I think that should take care of the issues defining the variables, but now I have this bizarre error:
    Code:
    Exception: NoMethodError
    Message: undefined method `[]' for nil:NilClass
    --PokemonExaminer:15:in `pbStartScene'
    --PokemonExaminer:290:in `pbStartScreen'
    PokemonPokegear:173:in `update_command'
    PokemonPokegear:168:in `pbFadeOutIn'
    PokemonPokegear:168:in `update_command'
    PokemonPokegear:138:in `update'
    PokemonPokegear:119:in `main'
    PokemonPokegear:116:in `loop'
    PokemonPokegear:123:in `main'
    PokemonUtilities:992:in `pbLoadRpgxpScene'
    ... A set of brackets are being looked at as a method?
    I wonder how Maruno puts up with this. :(
     
    Last edited:

    Nickalooose

    --------------------
    1,309
    Posts
    16
    Years
    • Seen Dec 28, 2023
    What does party and partyindex do? Remove them from start scene def... Within the brackets I mean... I don't understand why they are there
     
    302
    Posts
    13
    Years
    • Seen Aug 25, 2014
    What does party and partyindex do? Remove them from start scene def... Within the brackets I mean... I don't understand why they are there
    I'd assume it would call the Pokemon you currently have selected? Then again, considering this is a pokegear app that wouldn't make much sense. I removed it.

    Now, however, it's popping up with a lot of "undefined" errors that kind of baffle me. "egg", "nature", and the icon for the "ball used" (all of these seem to cause no problems in the original summary script, and I see no defs for them anywhere) are popping up as undefined in this script. Is there something I need to reference?
     

    Nickalooose

    --------------------
    1,309
    Posts
    16
    Years
    • Seen Dec 28, 2023
    It's because you originally had partyindex, which you're script wasn't calling properly, so the script never got this far before, so now you're making progress, because you're getting to the final stages of your script.

    You need to define pokemon as something, because atm you're checking if pokemon.egg? exists, which it can't because, pokemon doesn't mean anything.

    I see what you've done now, you copied the summary screen, literally... I didn't see this before.

    Since you've removed partyindex... What you could do is, set partyindex to a number, like 0 and possibly pokemon too... And always have it at 0 at the start of your script... Then add one to the number when down is pressed and take one away when up is pressed... Assuming you only have the one page, all the @page and drawpagetwo etc. is unnecessary, so your next and previous def's can literally look like this.
    Code:
      def pbGoToPrevious
        newindex=partyindex
        while newindex>0
          newindex-=1
          if partyindex!=newindex
            partyindex=newindex
            break
          end
        end
      end
    
      def pbGoToNext
        newindex=partyindex
        while newindex<$Trainer.party.length-1
          newindex+=1
          if partyindex!=newindex
            partyindex=newindex
            break
          end
        end
      end
    Edit to accompany what you need.
     

    Maruno

    Lead Dev of Pokémon Essentials
    5,286
    Posts
    16
    Years
    • Seen yesterday
    Since you asked for my help, I thought I'd respond in here (because I don't like hiding information away by putting it in a PM to just one person when this thread is public). I've just glanced over what you've all been saying, though.

    You're not quite opening the Examiner screen properly. Since you're copying the summary screen scripts, it'd make sense to also copy how, say, the party screen opens the summary screen. It does so like this:

    Code:
        scene=PokemonSummaryScene.new
        screen=PokemonSummary.new(scene)
        screen.pbStartScreen(@party,pkmnid)
    @party is just $Trainer.party (in battle it's a bit different, with the active Pokémon always at the top, so it makes a new party which is $Trainer.party jumbled up a bit to use instead, which is why it uses @party here. In the storage screen, @party is an array of the Pokémon in the current box and has nothing to do with $Trainer.party. You don't need to worry about that, though). pkmnid is the index in the party of the Pokémon you want to look at first. I'm assuming here that you'll always want to start at the top.

    Use this code, but replace @party with $Trainer.party, and replace pkmnid with 0. And, you know, use Scene_Examiner and PokemonExaminer (respectively) for the class names. That'll get it open.

    You don't need to replace the previous/next methods like Nickalooose suggested; the existing ones should work just fine. I imagine that the ONLY changes you'd need to make to the original summary screen scripts (aside from renaming the classes) are what I just mentioned along with disabling the left/right buttons so that you can only have one page. After that, it's just a matter of editing what text is displayed on the page (and there's plenty of examples of displaying text and different numbers already to help you). Remember to show nothing for eggs, because that's even more cheating than the Examiner screen already is.

    Code:
    @sprites["pokemon"].mirror=false
    This makes Pokémon look to the left. Set it to true instead to make them look to the right. I generally dislike this, because of some asymmetric Pokémon like Torterra and Togekiss and Kingler.

    Code:
    Exception: NoMethodError
    Message: undefined method `[]' for nil:NilClass
    --PokemonExaminer:15:in `pbStartScene'
    --PokemonExaminer:290:in `pbStartScreen'
    PokemonPokegear:173:in `update_command'
    PokemonPokegear:168:in `pbFadeOutIn'
    PokemonPokegear:168:in `update_command'
    PokemonPokegear:138:in `update'
    PokemonPokegear:119:in `main'
    PokemonPokegear:116:in `loop'
    PokemonPokegear:123:in `main'
    PokemonUtilities:992:in `pbLoadRpgxpScene'
    ... A set of brackets are being looked at as a method?
    I wonder how Maruno puts up with this.
    3.%20frown.gif
    [] is a method. Have a look in the script section Game_Switches to see a method with this name. Even an array is a class, and [] is a method which applies to that class. = is also a method. If you have $Trainer.party[0], then $Trainer.party is the array and [0] is a method (whose parameter is 0) which returns the 0th element of that array.

    An array is a very basic class, but it's still a class and it has associated methods. See here for a list of methods that an array has. (RMXP uses an older version of Ruby than detailed on that page, so some of the methods listed may not be in RMXP.)

    Your error message was referring to the line @pokemon=@party[@partyindex]. The array is @party, the method is [], and the parameter is @partyindex. The error was caused by @party being nil rather than an array, and nil has no methods at all, let alone the method [] which is what this line was trying to call.
     
    302
    Posts
    13
    Years
    • Seen Aug 25, 2014
    Real big thanks, Maruno. Your post actually helped me understand this thing a little bit more. After narrowing through some other kinks I was able to get this scene to activate without any error messages.
    PokeRMN_examErrors.png

    ... It still has some problems, as you can see.
    1) The text positions are wonky - That's something I can easily fix on my own.
    2) The "egg group" field will display "Monster" regardless of the Pokemon I have selected.
    3) The strings that correspond to the Pokemon's nature ("+10%" and "-10%") aren't displaying at all.
    4) The value for "Happiness:" seems to be derped as well, not displaying the right value.
    5) If I select an Egg within my party, it shows the egg as if it were a level 1 Pokemon with no EVs, instead of anything I specified in "drawPageOneEgg" (the "???" strings).

    What works, however:
    1) The controls to scroll between Pokemon in the party.
    2) Both the total stats and the effort values are displaying.
    3) The battler graphic and things.

    Here is my most up to date version of the Pokemon Examiner script:
    Code:
    class Scene_Examiner
      def pbUpdate
        pbUpdateSpriteHash(@sprites)
      end
    
      def pbStartScene(party,partyindex)
        @viewport=Viewport.new(0,0,Graphics.width,Graphics.height)
        @viewport.z=99999
        @party=party
        @partyindex=partyindex
        @pokemon=@party[@partyindex]
        @sprites={}
        @typebitmap=AnimatedBitmap.new(_INTL("Graphics/Pictures/types"))
        @sprites["background"]=IconSprite.new(0,0,@viewport)
        @sprites["overlay"]=BitmapSprite.new(Graphics.width,Graphics.height,@viewport)
        @sprites["pokemon"]=PokemonSprite.new(@viewport)
        @sprites["pokemon"].setPokemonBitmap(@pokemon)
        @sprites["pokemon"].mirror=true
        @sprites["pokemon"].color=Color.new(0,0,0,0)
        pbPositionPokemonSprite(@sprites["pokemon"],40,134)
        @sprites["pokeicon"]=PokemonBoxIcon.new(@pokemon,@viewport)
        @sprites["pokeicon"].x=14
        @sprites["pokeicon"].y=52
        @sprites["pokeicon"].mirror=false
        @sprites["pokeicon"].visible=false
        @sprites["movepresel"]=MoveSelectionSprite.new(@viewport)
        @sprites["movepresel"].visible=false
        @sprites["movepresel"].preselected=true
        @sprites["movesel"]=MoveSelectionSprite.new(@viewport)
        @sprites["movesel"].visible=false
        @page=0
        drawPageOne(@pokemon)
        pbFadeInAndShow(@sprites) { pbUpdate }
      end
    
      def pbEndScene
        pbFadeOutAndHide(@sprites) { pbUpdate }
        pbDisposeSpriteHash(@sprites)
        @typebitmap.dispose
        @viewport.dispose
      end
    
      #Draw the page
      def drawPageOne(pokemon)
        overlay=@sprites["overlay"].bitmap
        overlay.clear
        @sprites["background"].setBitmap("Graphics/Pictures/pokeexamScreen")
        imagepos=[]
        [email protected] ? @pokemon.ballused : 0
        ballimage=sprintf("Graphics/Pictures/summaryball%02d",@pokemon.ballused)
        imagepos.push([ballimage,14,60,0,0,-1,-1])
        if (pokemon.isShadow? rescue false)
          imagepos.push(["Graphics/Pictures/summaryShadow",224,240,0,0,-1,-1])
          shadowfract=pokemon.heartgauge*1.0/PokeBattle_Pokemon::HEARTGAUGESIZE
          imagepos.push(["Graphics/Pictures/summaryShadowBar",242,280,0,0,(shadowfract*248).floor,-1])
        end
        #-----------Define things I guess----------
        pbDrawImagePositions(overlay,imagepos)
        base=Color.new(248,248,248)
        shadow=Color.new(104,104,104)
        statshadows=[]
        for i in 0...5; statshadows[i]=shadow; end
        if !(pokemon.isShadow? rescue false) || pokemon.heartStage<=3
          natup=(pokemon.nature/5).floor
          natdn=(pokemon.nature%5).floor
          statshadows[natup]=Color.new(136,96,72) if natup!=natdn
          statshadows[natdn]=Color.new(64,120,152) if natup!=natdn
        end
        pbSetSystemFont(overlay)
        numberbase=(pokemon.isShiny?) ? Color.new(248,56,32) : Color.new(64,64,64)
        numbershadow=(pokemon.isShiny?) ? Color.new(224,152,144) : Color.new(176,176,176)
        speciesname=PBSpecies.getName(pokemon.species)
        growthrate=pokemon.growthrate
        [email protected]
        natureBoost=_INTL("")
        natureBoost=_INTL("+10%") if pokemon.nature==natup
        natureBoost=_INTL("-10%") if pokemon.nature==natdn
        #V------ I stole this code from FL's Advanced Pokedex script
        dexdata=pbOpenDexData
        compat10=dexdata.fgetb
        compat11=dexdata.fgetb
        eggGroupArray=[
            _INTL("Monster"),_INTL("Water1"),_INTL("Bug"),_INTL("Flying"),
            _INTL("Field"),_INTL("Fairy"),_INTL("Plant"),_INTL("Human-Like"),
            _INTL("Water3"),_INTL("Mineral"),_INTL("Amorphous"),
            _INTL("Water2"),_INTL("Ditto"),_INTL("Dragon"),_INTL("No Eggs")
        ]
        eggGroups = compat10==compat11 ? eggGroupArray[compat10] : 
            _INTL("{1}, {2}",eggGroupArray[compat10],eggGroupArray[compat11])
        #-------End of awesomely stolen code
        if @pokemon.name.split('').last=="♂" || @pokemon.name.split('').last=="♀"
          [email protected][0..-2]
        end
        textpos=[
           [_INTL("POKéMON EXAMINER"),26,16,0,base,shadow],
           [pokename,46,62,0,base,shadow],
           [_INTL("{1}",pokemon.level),46,92,0,Color.new(64,64,64),Color.new(176,176,176)],
           [_INTL("Egg Group"),16,320,0,base,shadow],
           [eggGroups,16,352,0,Color.new(64,64,64),Color.new(176,176,176)],
           [_INTL("HP"),232,114,2,base,shadow],
           [_ISPRINTF("{1:d}",pokemon.totalhp),293,114,1,Color.new(64,64,64),Color.new(176,176,176)],
           [_ISPRINTF(""),360,114,1,base,shadow],
           [_ISPRINTF("+{1:3d}",pokemon.ev[0]),440,114,1,Color.new(0,136,72),Color.new(176,176,176)],
           [_INTL("Atk:"),232,146,0,base,shadow],
           [natureBoost,360,146,1,statshadows[0],shadow],
           [_ISPRINTF("{1:d}",pokemon.attack),293,146,1,Color.new(64,64,64),Color.new(176,176,176)],
           [_ISPRINTF("+{1:3d}",pokemon.ev[1]),440,146,1,Color.new(0,136,72),Color.new(176,176,176)],
           [_INTL("Def:"),232,178,0,base,shadow],
           [natureBoost,360,178,1,statshadows[1],shadow],
           [_ISPRINTF("{1:d}",pokemon.defense),293,178,1,Color.new(64,64,64),Color.new(176,176,176)],
           [_ISPRINTF("+{1:3d}",pokemon.ev[2]),440,178,1,Color.new(0,136,72),Color.new(176,176,176)],
           [_INTL("SpAtk:"),232,210,0,base,shadow],
           [natureBoost,360,210,1,statshadows[3],shadow],
           [_ISPRINTF("{1:d}",pokemon.spatk),293,210,1,Color.new(64,64,64),Color.new(176,176,176)],
           [_ISPRINTF("+{1:3d}",pokemon.ev[4]),440,210,1,Color.new(0,136,72),Color.new(176,176,176)],
           [_INTL("SpDef:"),232,242,0,base,shadow],
           [natureBoost,360,242,1,statshadows[4],shadow],
           [_ISPRINTF("{1:d}",pokemon.spdef),293,242,1,Color.new(64,64,64),Color.new(176,176,176)],
           [_ISPRINTF("+{1:3d}",pokemon.ev[5]),440,242,1,Color.new(0,136,72),Color.new(176,176,176)],
           [_INTL("Spd:"),232,274,0,base,shadow],
           [natureBoost,360,274,1,statshadows[2],shadow],
           [_ISPRINTF("{1:d}",pokemon.speed),293,274,1,Color.new(64,64,64),Color.new(176,176,176)],
           [_ISPRINTF("+{1:3d}",pokemon.ev[3]),440,274,1,Color.new(0,136,72),Color.new(176,176,176)],
           [_INTL("{1:d}",pokemon.happiness),340,312,0,base,shadow],
        ]
        if pokemon.gender==0
          textpos.push([_INTL("♂"),178,62,0,Color.new(24,112,216),Color.new(136,168,208)])
        elsif pokemon.gender==1
          textpos.push([_INTL("♀"),178,62,0,Color.new(248,56,32),Color.new(224,152,144)])
        end
        pbDrawTextPositions(overlay,textpos)
      end
    
      def drawPageOneEgg(pokemon)
        overlay=@sprites["overlay"].bitmap
        overlay.clear
        @sprites["background"].setBitmap("Graphics/Pictures/pokeexamScreen")
        imagepos=[]
        [email protected] ? @pokemon.ballused : 0
        ballimage=sprintf("Graphics/Pictures/summaryball%02d",@pokemon.ballused)
        imagepos.push([ballimage,14,60,0,0,-1,-1])
        #-----------Define things I guess----------
        pbDrawImagePositions(overlay,imagepos)
        base=Color.new(248,248,248)
        shadow=Color.new(104,104,104)
        pbSetSystemFont(overlay)
        textpos=[
           [_INTL("POKéMON EXAMINER"),26,16,0,base,shadow],
           [pokemon.name,46,62,0,base,shadow],
           [_INTL("???"),46,92,0,Color.new(64,64,64),Color.new(176,176,176)],
           [_INTL("Egg Group"),16,320,0,base,shadow],
           [_ISPRINTF("???"),16,352,0,Color.new(64,64,64),Color.new(176,176,176)],
           [_INTL("HP"),292,76,2,base,shadow],
           [_ISPRINTF("???"),462,76,1,Color.new(64,64,64),Color.new(176,176,176)],
           [_INTL("Attack"),248,120,0,base,shadow],
           [_ISPRINTF("???"),456,120,1,Color.new(64,64,64),Color.new(176,176,176)],
           [_INTL("Defense"),248,152,0,base,shadow],
           [_ISPRINTF("???"),456,152,1,Color.new(64,64,64),Color.new(176,176,176)],
           [_INTL("Sp. Atk"),248,184,0,base,shadow],
           [_ISPRINTF("???"),456,184,1,Color.new(64,64,64),Color.new(176,176,176)],
           [_INTL("Sp. Def"),248,216,0,base,shadow],
           [_ISPRINTF("???"),456,216,1,Color.new(64,64,64),Color.new(176,176,176)],
           [_INTL("Speed"),248,248,0,base,shadow],
           [_ISPRINTF("???"),456,248,1,Color.new(64,64,64),Color.new(176,176,176)],
           [_INTL("???"),248,248,0,base,shadow],
        ]
        pbDrawTextPositions(overlay,textpos)
      end
    
      def pbGoToPrevious
        if @page!=0
          newindex=@partyindex
          while newindex>0
            newindex-=1
            if @party[newindex] && !@party[newindex].egg?
              @partyindex=newindex
              break
            end
          end
        else
          newindex=@partyindex
          while newindex>0
            newindex-=1
            if @party[newindex]
              @partyindex=newindex
              break
            end
          end
        end
      end
    
      def pbGoToNext
        if @page!=0
          newindex=@partyindex
          while newindex<@party.length-1
            newindex+=1
            if @party[newindex] && !@party[newindex].egg?
              @partyindex=newindex
              break
            end
          end
        else
          newindex=@partyindex
          while newindex<@party.length-1
            newindex+=1
            if @party[newindex]
              @partyindex=newindex
              break
            end
          end
        end
      end
    
      def pbScene
        pbPlayCry(@pokemon)
        loop do
          Graphics.update
          Input.update
          pbUpdate
          if Input.trigger?(Input::B)
            break
          end
          dorefresh=false
          if Input.trigger?(Input::C)
            if @page==0
              break
            elsif @page==3
              pbMoveSelection
              dorefresh=true
              drawPageFour(@pokemon)
            end
          end
          if Input.trigger?(Input::UP) && @partyindex>0
            pbGoToPrevious
            @pokemon=@party[@partyindex]
            @sprites["pokemon"].setPokemonBitmap(@pokemon)
            @sprites["pokemon"].color=Color.new(0,0,0,0)
            pbPositionPokemonSprite(@sprites["pokemon"],40,144)
            dorefresh=true
            pbPlayCry(@pokemon)
          end
          if Input.trigger?(Input::DOWN) && @partyindex<@party.length-1
            pbGoToNext
            @pokemon=@party[@partyindex]
            @sprites["pokemon"].setPokemonBitmap(@pokemon)
            @sprites["pokemon"].color=Color.new(0,0,0,0)
            pbPositionPokemonSprite(@sprites["pokemon"],40,144)
            dorefresh=true
            pbPlayCry(@pokemon)
          end
          if dorefresh
            case @page
              when 0
                drawPageOne(@pokemon)
            end
          end
        end
        return @partyindex
      end
    end
    
    
    
    class PokemonExaminer
      def initialize(scene)
        @scene=scene
      end
    
      def pbStartScreen(party,partyindex)
        @scene.pbStartScene(party,partyindex)
        [email protected]
        @scene.pbEndScene
        return ret
      end
    end
     

    Maruno

    Lead Dev of Pokémon Essentials
    5,286
    Posts
    16
    Years
    • Seen yesterday
    2. If you're going to steal code from someone else, you could at least steal all the code you need. You forgot this line (just before your compat10= line):
    Code:
    pbDexDataOffset(dexdata,pokemon.species,31)
    Oh, and put this line after the compat11= line:
    Code:
    dexdata.close
    3. There are 5 things that a nature could boost or lower. Your code (below) doesn't result in different text for each of them. This code is also comparing the Pokémon's nature to an altered version of itself (either the nature divided by 5 or nature mod 5), which is just daft.

    Code:
        natureBoost=_INTL("")
        natureBoost=_INTL("+10%") if pokemon.nature==natup
        natureBoost=_INTL("-10%") if pokemon.nature==natdn
    Instead of this, put the following code beneath the large textpos= array:
    Code:
    if (pokemon.nature/5).floor!=(pokemon.nature%5).floor
      statupline=[0,1,4,2,3][(pokemon.nature/5).floor]
      statdownline=[0,1,4,2,3][(pokemon.nature%5).floor]
      textpos.push([_INTL("+10%"),360,146+32*statupline,1,Color.new(136,96,72),shadow])
      textpos.push([_INTL("-10%"),360,146+32*statdownline,1,Color.new(64,120,152),shadow])
    end
    4. You don't use {1:d} in an _INTL. Just use {1} there.

    5. You deleted the following code from the top of the def drawPageOne:
    Code:
    if pokemon.egg?
      drawPageOneEgg(pokemon)
      return
    end
     
    Last edited:
    302
    Posts
    13
    Years
    • Seen Aug 25, 2014
    Thanks for your help, Maruno. I still need to kind of understand just how RGSS works in general, but I can safely say this entire script works.

    Since someone asked for this script, I'm going to make a few adjustments so that it's presentable to the public, and then I'll post the final.
     
    Back
    Top