show variables on screen rpg maker xp
#3
Yes let's write an 80 line long event and use up a bunch of our 50 picture slots just so we can show the player they have 30,000 GP.

...That was just me being grumpy! The real reason you shouldn't do these sorts of things in events is because of the overhead of the Interpreter. Doing one or three things with parallel process events won't matter, you'll start lagging if you do very many more than that. Best leave the event system for actual game control stuff. Also you can reuse scripts easily! For example, here I turned the first script I ever wrote (a script that shows HP and MP in a cute little window) into one that can show variables. It took me longer to write this post than it did to edit this script.

Code:
#==============================================================================
# **
#------------------------------------------------------------------------------
#
#==============================================================================

class Window_Variable < Window_Base
  WHICH_VARIABLE = 1 #change this to your variable number.
  #--------------------------------------------------------------------------
  # * Object Initialization
  #--------------------------------------------------------------------------
  def initialize
    super(0, 420, 640, 60) #the sets the X, Y, Width, and Height.
    self.contents = Bitmap.new(width - 32, height - 32)
    self.opacity = 200 #text (kinda transparent)
    self.back_opacity = 175 #backgrond (pretty transparent)
    #old value for checking if refresh needed
      @old_value = 0
    refresh
  end
  #--------------------------------------------------------------------------
  # * Refresh
  #--------------------------------------------------------------------------
  def refresh
    self.contents.clear
    draw_variable(0, 0)
  end
  #--------------------------------------------------------------------------
  # * Update
  #--------------------------------------------------------------------------
  def update
    #do we need to update?
    if $game_variables[WHICH_VARIABLE] != @old_value
      refresh
    end
  end
  #--------------------------------------------------------------------------
  # *  Draw Variable
  #--------------------------------------------------------------------------
  def draw_variable(x, y)
    self.contents.draw_text(x, y-16, self.width, self.height,
                            $game_variables[WHICH_VARIABLE].to_s)
  end
    
end

and now all you have to do is get Scene_Map to draw your window! Just do it like how the @message_window is done. in Scene_Map:

Find:
Code:
    # Make message window
    @message_window = Window_Message.new

Change to:
Code:
    # Make message window
    @message_window = Window_Message.new
    #Our new Variable Window!
    @variable_window = Window_Variable.new


Find:
Code:
    # Dispose of message window
    @message_window.dispose

Change to:
Code:
    # Dispose of message window
    @message_window.dispose
    #We need to free our window from memory.
    @variable_window.dispose


Find:
Code:
    # Update message window
    @message_window.update
Change to:
Code:
    # Update message window
    @message_window.update
    #This is called every frame so don't do anything crazy in updates
    @variable_window.update

You should study this script (and others, and the default ones) and learn how it works. And eventually you'll be able to code as well as me! Or at least make your own windows.
Reply }


Messages In This Thread
RE: show variables on screen rpg maker xp - by MechanicalPen - 10-09-2014, 11:30 PM

Possibly Related Threads…
Thread Author Replies Views Last Post
   Scan skill should show states Tumen 5 9,211 05-02-2017, 03:33 AM
Last Post: DerVVulfman
   Display State Ranks in Status Screen Mel 3 7,412 04-02-2017, 12:46 AM
Last Post: marketing small business ideas
   RMXP SKill animations too bright (overlaying the battle screen) Starmage 4 10,152 06-13-2016, 03:41 AM
Last Post: Starmage
   Custom Save/Load screen Raou 2 7,557 04-01-2015, 08:18 PM
Last Post: Raou
   Game Variables List for Copy/Paste JayRay 4 7,000 01-15-2015, 06:18 AM
Last Post: JayRay
   in FPLE touching events after battle causes rpg maker to crash ThePrinceofMars 1 5,503 11-27-2014, 09:11 PM
Last Post: MechanicalPen
   Script Request - Variables Specific Save File JayRay 2 5,109 04-28-2014, 05:15 AM
Last Post: JayRay
   Help with Shop Menu [RPG Maker XP] JackMonty 6 12,970 05-23-2013, 10:14 AM
Last Post: JackMonty
   Analyse show HP Bars Ace 12 16,850 12-28-2010, 04:39 PM
Last Post: Ace
   Showing the evade stat in the status screen corpsegirl 2 6,281 10-25-2010, 11:40 PM
Last Post: corpsegirl



Users browsing this thread: 4 Guest(s)