• 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.

[Scripting Question] I'm getting this weird error...

TatsuR1SE

Red Dragon
4
Posts
5
Years
  • Age 24
  • Seen Nov 7, 2018
---------------------------
PKMN Aspiration
---------------------------
Script 'Scene_Intro' line 18: TypeError occurred.

cannot convert Fixnum into String
---------------------------
OK
---------------------------

For some weird reason I keep getting this error whenever entering the game. I know its something wrong with the intro because I can play the game if I don't include the intro. This only just started happening when I messed with the graphics (credits, title etc) and the pokemon cry that happens in the intro.

Please help. Thanks!


Code:
class IntroEventScene < EventScene
  def initialize(pics,splash,viewport=nil)
    super(nil)
    @pics=pics
    @splash=splash
    @pic=addImage(0,0,"")
    @pic.moveOpacity(0,0,0) # fade to opacity 0 in 0 frames after waiting 0 frames
    @pic2=addImage(0,322,"") # flashing "Press Enter" picture
    @pic2.moveOpacity(0,0,0)
    @index=0
    data_system = pbLoadRxData("Data/System")
    pbBGMPlay(data_system.title_bgm)
    openPic(self,nil)
  end

  def openPic(scene,args)
    onCTrigger.clear
    @pic.name="Graphics/Titles/"+@pics[@index]
    @pic.moveOpacity(15,0,255) # fade to opacity 255 in 15 frames after waiting 0 frames
    pictureWait
    @timer=0 # reset the timer
    onUpdate.set(method(:timer)) # call timer every frame
    onCTrigger.set(method(:closePic)) # call closePic when C key is pressed
  end

  def timer(scene,args)
    @timer+=1
    if @timer>80
      @timer=0
      closePic(scene,args) # Close the picture
    end
  end

  def closePic(scene,args)
    onCTrigger.clear
    onUpdate.clear
    @pic.moveOpacity(15,0,0)
    pictureWait
    @index+=1 # Move to the next picture
    if @index>[email protected]
      openSplash(scene,args)
    else
      openPic(scene,args)
    end
  end

  def openSplash(scene,args)
    onCTrigger.clear
    onUpdate.clear
    @pic.name="Graphics/Titles/"+@splash
    @pic.moveOpacity(15,0,255)
    @pic2.name="Graphics/Titles/start"
    @pic2.moveOpacity(15,0,255)
    pictureWait
    onUpdate.set(method(:splashUpdate))  # call splashUpdate every frame
    onCTrigger.set(method(:closeSplash)) # call closeSplash when C key is pressed
  end

  def splashUpdate(scene,args)
    @timer+=1
    @timer=0 if @timer>=80
    if @timer>=32
      @pic2.moveOpacity(0,0,8*(@timer-32))
    else
      @pic2.moveOpacity(0,0,255-(8*@timer))
    end
    if Input.press?(Input::DOWN) &&
       Input.press?(Input::B) &&
       Input.press?(Input::CTRL)
      closeSplashDelete(scene,args)
    end
  end

  def closeSplash(scene,args)
    onCTrigger.clear
    onUpdate.clear
    # Play random cry
    cry=pbCryFile(005)
    pbSEPlay(cry,80,100) if cry
    # Fade out
    @pic.moveOpacity(15,0,0)
    @pic2.moveOpacity(15,0,0)
    pbBGMStop(1.0)
    pictureWait
    scene.dispose # Close the scene
    sscene=PokemonLoad_Scene.new
    sscreen=PokemonLoadScreen.new(sscene)
    sscreen.pbStartLoadScreen
  end

  def closeSplashDelete(scene,args)
    onCTrigger.clear
    onUpdate.clear
    # Play random cry
    cry=pbCryFile(005)
    pbSEPlay(cry,80,100) if cry
    # Fade out
    @pic.moveOpacity(15,0,0)
    @pic2.moveOpacity(15,0,0)
    pbBGMStop(1.0)
    pictureWait
    scene.dispose # Close the scene
    sscene=PokemonLoad_Scene.new
    sscreen=PokemonLoadScreen.new(sscene)
    sscreen.pbStartDeleteScreen
  end
end



class Scene_Intro
  def initialize(pics, splash = nil)
    @pics=pics
    @splash=splash
  end

  def main
    Graphics.transition(0)
    @eventscene=IntroEventScene.new(@pics,@splash)
    @eventscene.main
    Graphics.freeze
  end
end


That is my scene_intro script.
 
Last edited by a moderator:
1,403
Posts
10
Years
  • Seen Apr 18, 2024
You have a number somewhere you need some text. A string is "text with quotes around it like this". This is probably a filename.

It's hard to tell what line 18 is from what you've posted. If you have a number in a variable that you want to convert into a string you can use to_s. e.g.
Code:
myVar = 11
myVar.to_s # == "11"
 
Back
Top