• There is an important update regarding account security and 2FA. Please click here for more information.
  • 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.
  • Imgur has blocked certain regions from viewing any images uploaded to their site. If you use Imgur, please consider replacing any image links/embeds you may have on PokéCommunity so everyone can see your images. Click here to learn more.

Window Module, create your own simple windows!

Blizzy

me = Scripter.new("Noob")
  • 492
    Posts
    21
    Years
    i made this script so people can easy create windows
    and don't need to create any script.
    all you need is the call script function to create a simple window.

    functions that are done:
    - create window
    - draw text
    - draw variable
    - draw actor name
    * if anybody has other ideas, please post them,
    so i can add it in the module.

    first of all.
    insert a new script above all,
    and put the following script in it:
    Code:
    # ============================================================
    # ● Module Win - for creating your own windows in rgss
    # ------------------------------------------------------------------------------------------------------------
    # ● Credits: Virtual (creator) + Peekimon (thinker)
    # ============================================================
    module Win
    
      #initialize the window
      def self.initialize(x, y, w, h, opacity, back_opacity)
        @window = Window_Base.new(x,y,w,h)
        @window.contents = Bitmap.new(@window.width - 32, @window.height - 32)
        @window.opacity = opacity
        @window.back_opacity = back_opacity
      end #method
      
      #draw text
      def self.text(x, y, w, h, text, i)
        @window.contents.font.name = "Arial"
        @window.contents.font.size = 24
        @window.contents.draw_text(x, y, w, h, text, 0)
      end #method
    
      #draw a single variable
      def self.variable(x,y,w,h,i)
        @window.contents.draw_text(x, y, w, h, "Variable " + i.to_s + " = " + $game_variables[i].to_s, 0)
      end #method
      
      #draw the name of the actor
      def self.actorname(x,y,w,h,i)
        if $game_party.actors[i] != nil
          @window.contents.draw_text(x, y, w, h, $game_party.actors[i].name, 0)
        else
          print "actor "  + i.to_s +  " doesn't excist"
        end #if statement
      end #method
      
      #close the window
      def self.close
        @window.dispose
      end #method
    
    end #module
    if you have this done,
    open the call script function in the events commands.

    1. to create the window, use the following:
    Code:
    Win.initialize(x, y, width, height, opacity, back_opacity)
    for example:
    Code:
    Win.initialize(80, 80, 200, 180, 220, 200)
    this sets the x at 80, the y at 80, width at 200, and the height at 180.
    opacity is set to 220 and the back opacity is 200.

    to draw text, use:
    Code:
    Win.text(x, y, width, height, Text, i)
    example:
    Code:
    Win.text(4, 0, 120, 32, "Text", 1)
    the x = 4, y = 0, width = 120, height = 32, text must be between " "
    and the i = 1. i is the number of the message.
    if you use:
    Code:
    Win.text(4, 0, 120, 32, "Text", 1)
    Win.text(4, 20, 120, 32, "Text2", 1)
    "text2" will show up, because it overwrite the first one.
    to do this, use numbers, like the following:
    Code:
    Win.text(4, 0, 120, 32, "Text1", 1)
    Win.text(4, 20, 120, 32, "Text2", 2)
    Win.text(4, 40, 120, 32, "Text3", 3)
    etc.

    to draw a variable, use:
    Code:
    Win.variable(x, y, width, height, variable_id)
    example:
    Code:
    Win.variable(4, 20, 200, 32, 1)
    this will draw:
    Variable 1 = value

    to draw the name of the hero:
    Code:
    Win.actorname(x, y, width, height, actor_id)
    example:
    Code:
    Win.actorname(4, 0, 120, 32, 0)
    this will draw the name of the actor with the id 0
    which is the first actor.
    hero 1 = actor 0
    hero 2 = actor 1
    hero 3 = actor 2
    etc.

    screenshot is in the attachement

    this is it for now.
    i hope this helps a lot of people
     
    Last edited:

    I think it will help a lot of people, and it helped me a bit! When I looked at the code and discovered the def named self.actorname etc.. I never knew about it.
    Pokemaster_shiny ;)
     

    Pokemaster_shiny said:
    I think it will help a lot of people, and it helped me a bit! When I looked at the code and discovered the def named self.actorname etc.. I never knew about it.
    Pokemaster_shiny ;)
    i got the self.keyword from peekimon,
    so that's why he is in the credits.
     

    Back
    Top