[RMVX] DISPLAYING A VARIABLE ON SCREEN
Posts
Pages:
1
I'm using a script Liberty gave me to display the value of a variable on the screen. I just want to know how to change the font of the number displayed.
Here is the script:
Here is the script:
#===============================================================================
# Variable Window Snippet
# By Jet10985
# Help by: Piejamas, BigEd781, Mithran
#===============================================================================
# This snippet will allow you to show 1 variable in a window at the top-right
# of the screen. Edited by Liberty. XP
#===============================================================================
module VarWindow
VAR_NAME_1 = "Score:" # The name for the 1st variable shown. You can change it
#to anything you want, but keep the name inside the quotation marks or it won't
#work.
VARIABLE_1 = 1 # Variable shown for VAR_NAME_1
ALLOW_TRIGGER = false # Let the player hide the window by pressing a button? if
#you do want for the player to be able to toggle the score on/off then set this
#to true instead.
HIDE_WINDOW_BUTTON = Input::CTRL # If true, what button? You can change what
#button you want to use to toggle the score to be hidden.
SWITCH_TO_SHOW = 5 # This is the switch that needs to be on to show the window.
#Just change the number to match the corresponding switch.
OPACITY = 0 # This is how transperant the window is. 0 is fully transperant.
#If you want it partly transparent try about 160 or so. 250 is fully opaque.
end
#===============================================================================
# DON'T EDIT FURTHER UNLESS YOU KNOW WHAT TO DO.
#===============================================================================
class Window_Variable < Window_Base
include VarWindow
#the line with the numbers are the positions. Number 1 is X (across),
#number 2 is Y (up/down). The other two mess with the box itself, the first
#beign width and the next being height.
def initialize
super(400, 0, 145, 60)
self.opacity = OPACITY
self.visible = false
refresh
end
def refresh
self.contents.clear
self.contents.draw_text(0, 0, 222, WLH, VAR_NAME_1 + " " + @var_one.to_s)
end
def update
if @var_one != $game_variables[VARIABLE_1] |
@var_one = $game_variables[VARIABLE_1]
refresh
end
end
end
class Scene_Map
include VarWindow
alias jet5830_start start unless $@
def start
jet5830_start
@var_window = Window_Variable.new
@var_1 = $game_variables[VARIABLE_1]
@first_switch = false
end
alias jet5839_update update unless $@
def update
jet5839_update
@var_window.update
variable_update
end
alias jet5299_terminate terminate unless $@
def terminate
@var_window.dispose
jet5299_terminate
end
def variable_update
if @first_switch == false and $game_switches[SWITCH_TO_SHOW]
@var_window.visible = true
@first_switch = true
end
if Input.trigger?(HIDE_WINDOW_BUTTON) && ALLOW_TRIGGER && $game_switches[SWITCH_TO_SHOW]
@var_window.visible = !@var_window.visible
end
end
end
Add self.contents.font.name = "fontname" in def refresh.
How do you old schoolers display a variable when walking?
author=Banditoauthor=ShortStarMe too, I'm so old school LOL.
I like the \v method myself.
How do you old schoolers display a variable when walking?
author=heisenmanSpecifically:
Add self.contents.font.name = "fontname" in def refresh.
def refresh
self.contents.clear
self.contents.font.name = ["Font"]
self.contents.draw_text(0, 0, 222, WLH, VAR_NAME_1 + " " + @var_one.to_s)
end
As a side note, you can set multiple fonts in font.name, like so:
self.contents.font.name = ["Verdana", "Arial", "Courier New"]
author=heisenmanPictures in Parallel Events (usually Common Event ones).author=BanditoHow do you old schoolers display a variable when walking?author=ShortStarMe too, I'm so old school LOL.
I like the \v method myself.
Pages:
1


















