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

Creating your own window in rgss.

Blizzy

me = Scripter.new("Noob")
  • 492
    Posts
    19
    Years
    Creating your own Window.

    to create a simple window, you need to have this:
    Code:
    class My_Window < Window_Base
      def initialize
        super(80,80,480,320)
      end
    end
    this is a standart window.
    now for explaining the lines

    Code:
    class My_Window < Window_Base
    make the window to be come a part of Window_Base.

    Code:
    def initialize
    initializes the window.

    Code:
    super(80,80,480,320)
    this creates the window
    x, 80
    y, 80
    width, 480
    height, 320.

    this is a empty window.
    let's put some text in it.
    Code:
    class My_Window < Window_Base
      def initialize
        super(80,80,480,320)
        self.contents = Bitmap.new(width - 32, height - 32)
        self.contents.font.name = $fontface
        self.contents.font.size = $fontsize
        self.contents.font.color = normal_color
        refresh
      end #method
      def refresh
        self.contents.draw_text(4,4,120,32,"Look! Text")
      end #method
    end #class
    now for explaining the new lines:

    Code:
    self.contents = bitmap.new(width - 32, height - 32)
    this needs to be in every def initialize.
    without this, text wouldn't appear.

    Code:
    self.contents.font.name = $fontface
    this "grabs" the font.

    Code:
    self.contents.font.size = $fontsize
    this is the size of the font.

    Code:
    self.contents.font.color = normal_color
    this is the color of the text that will be displayed

    Code:
    refresh
    this means it goes to the method "refresh".

    Code:
    def refresh
    this is a method, which is called by "refresh"

    Code:
    self.contents.draw_text(4,4,120,32,"Look! Text")
    this draws the text on screen. at (4,4,120,32)

    This is a small window, with text.
    which is boring
    so, let's display the hero graphic.
    Code:
    class My_Window < Window_Base
      def initialize
        super(80,80,480,320)
        self.contents = Bitmap.new(width - 32, height - 32)
        self.contents.font.name = $fontface
        self.contents.font.size = $fontsize
        self.contents.font.color = normal_color
        refresh
      end #method
      def refresh
        self.contents.draw_text(4,4,120,32,"Look! Text")
        
        for i in 0...$game_party.actors.size
          x = i * 32 + 4
          y = 32
          actor = $game_party.actors[i]
          draw_actor_graphic(actor,x)
        end #for
      end #method
    end #class

    Code:
    for i in 0...$game_party.actors.size
    this puts the number of hero's in the letter "i"

    Code:
    x = i * 32 + 16
    this is the x coordinate.
    i is the number of hero's that will multiply with 32, and then + 16.
    the higher the 32, the more space between the actors.

    Code:
    y = 96
    this is the y coordinate of the actor.

    Code:
    actor = $game_party.actors[i]
    this sets actor equal to $game_party.actors
    which are the "heros" in the game.

    to call this Window, put the following in a call script:
    Code:
    My_Window.new
    this is it.
    now you guys can start working on your own trainercard.
    which is basicly the way.
     

    Peekimon

    Me = cat-aholic, Meowr
  • 1,671
    Posts
    19
    Years
    Although, I know most of it, it is a perfect tutorial for beginners. You make life easier for beginners... Good Job!
     
  • 565
    Posts
    19
    Years
    • Seen Sep 15, 2022
    -virtual- said:
    Creating your own Window.

    to create a simple window, you need to have this:
    Code:
    class My_Window < Window_Base
      def initialize
        super(80,80,480,320)
      end
    end
    this is a standart window.
    now for explaining the lines

    Code:
    class My_Window < Window_Base
    make the window to be come a part of Window_Base.

    Code:
    def initialize
    initializes the window.

    Code:
    super(80,80,480,320)
    this creates the window
    x, 80
    y, 80
    width, 480
    height, 320.

    this is a empty window.
    let's put some text in it.
    Code:
    class My_Window < Window_Base
      def initialize
        super(80,80,480,320)
        self.contents = Bitmap.new(width - 32, height - 32)
        self.contents.font.name = $fontface
        self.contents.font.size = $fontsize
        self.contents.font.color = normal_color
        refresh
      end #method
      def refresh
        self.contents.draw_text(4,4,120,32,"Look! Text")
      end #method
    end #class
    now for explaining the new lines:

    Code:
    self.contents = bitmap.new(width - 32, height - 32)
    this needs to be in every def initialize.
    without this, text wouldn't appear.

    Code:
    self.contents.font.name = $fontface
    this "grabs" the font.

    Code:
    self.contents.font.size = $fontsize
    this is the size of the font.

    Code:
    self.contents.font.color = normal_color
    this is the color of the text that will be displayed

    Code:
    refresh
    this means it goes to the method "refresh".

    Code:
    def refresh
    this is a method, which is called by "refresh"

    Code:
    self.contents.draw_text(4,4,120,32,"Look! Text")
    this draws the text on screen. at (4,4,120,32)

    This is a small window, with text.
    which is boring
    so, let's display the hero graphic.
    Code:
    class My_Window < Window_Base
      def initialize
        super(80,80,480,320)
        self.contents = Bitmap.new(width - 32, height - 32)
        self.contents.font.name = $fontface
        self.contents.font.size = $fontsize
        self.contents.font.color = normal_color
        refresh
      end #method
      def refresh
        self.contents.draw_text(4,4,120,32,"Look! Text")
        
        for i in 0...$game_party.actors.size
          x = i * 32 + 4
          y = 32
          actor = $game_party.actors[i]
          draw_actor_graphic(actor,x)
        end #for
      end #method
    end #class

    Code:
    for i in 0...$game_party.actors.size
    this puts the number of hero's in the letter "i"

    Code:
    x = i * 32 + 16
    this is the x coordinate.
    i is the number of hero's that will multiply with 32, and then + 16.
    the higher the 32, the more space between the actors.

    Code:
    y = 96
    this is the y coordinate of the actor.

    Code:
    actor = $game_party.actors[i]
    this sets actor equal to $game_party.actors
    which are the "heros" in the game.

    to call this Window, put the following in a call script:
    Code:
    My_Window.new
    this is it.
    now you guys can start working on your own trainercard.
    which is basicly the way.



    Where do you type the code?
     

    Esai

    &#9829;&#9829;&#9829; With Bubbleicious &#9829;&#9
  • 1,434
    Posts
    19
    Years
    yes, all this RGSS will be used in the RGSS Editor
     

    Blizzy

    me = Scripter.new("Noob")
  • 492
    Posts
    19
    Years
    BlackCharizard said:
    Actually, virtual said to place it in window_base.
    not really.
    i said something similiar to this:
    your window is a sub-class of window_base.
    you need to paste the code in a new script:
    right-click on main and insert
     

    BlackCharizard

    Black Charizard
  • 148
    Posts
    19
    Years
    OoOh. Sorry. I re=read it and you said to make the window to become part of window_base. Okay. I understand this now.
     

    Blizzy

    me = Scripter.new("Noob")
  • 492
    Posts
    19
    Years
    Hack_Slash_Scizor said:
    lol, so uh, how do i get this window to come up? :oops:
    in a call script do:
    @window = My_Window.new

    to change the x & y
    @window.x = 20
    @window.y = 20

    to erase it:
    @window.dispose

    to update it:
    @window.update
     

    Hack_Slash_Scizor

    Muhahahahahahahahahaha!
  • 51
    Posts
    19
    Years
    • Seen Oct 27, 2006
    oh man i am sch a n00b, i still dont get it... i just wanna make it so in my menu, when i go to POK?NAV, it brings up this window?
     
    Back
    Top