Variable Hud version 1.0a, Script help.

Christaylor81

Villager
Member
Joined
Oct 6, 2015
Messages
22
Reaction score
4
First Language
English
Primarily Uses
Hi all, I'm hoping I can get some help in getting a script to work. Variable Hud version 1.0a.
 
From what I can tell this should be pretty straight forward, but I'm very new to this so even some of the more basic elements are tripping me up. Basically I just want to get the standard hud to show up in game and I'm confused about what I need to do to get this script to work. Any help is greatly appreciated.

Script:

#==============================================================================
# XS - Variable Hud
# Author: Nicke
# Created: 02/04/2012
# Edited: 09/04/2012
# Version: 1.0a
#==============================================================================
# Instructions
# -----------------------------------------------------------------------------
# To install this script, open up your script editor and copy/paste this script
# to an open slot below ? Materials but above ? Main. Remember to save.
#
# A small hud to display variables on the map.
#
# *** Only for RPG Maker VX Ace. ***
#==============================================================================
($imported ||= {})["XAIL-VAR-WIN-HUD"] = true

module XAIL
module VAR_HUD
#--------------------------------------------------------------------------#
# * Settings
#--------------------------------------------------------------------------#
# FONT = [name, size, color, bold, shadow]
FONT = [["Verdana"], 14, Color.new(255,255,255), true, true]

# HUD = [width, x, y, z, opacity, skin]
HUD = [270, 295, -5, 200, 0, nil]

# VAR_HUD_SWITCH = switch_id
VAR_HUD_SWITCH = 1

# VAR_LIST = [variable_id, vocab (nil), icon_index (nil), x, y]
VAR_LIST = [] # Don't remove!
VAR_LIST[0] = [1, nil, nil]
VAR_LIST[1] = [2, nil, 358]
VAR_LIST[2] = [3, nil, 359]
VAR_LIST[3] = [4, nil, 366]

# Set the symbol for the amount.
# Can be set to "" to disable.
# SYMBOL = string
SYMBOL = ""

# The space beetween the variables.
# SPACING = number
SPACING = 24

end
end
# *** Don't edit below unless you know what you are doing. ***
#==============================================================================#
# ** Window_Var_Hud
#------------------------------------------------------------------------------
# Class for drawing the variable hud.
#==============================================================================#
class Window_Var_Hud < Window_Base

def initialize
# // Method to initialize the var hud window.
super(0, 0, window_width, fitting_height(XAIL::VAR_HUD::VAR_LIST.size))
refresh
end

def window_width
# // Method to return the width.
return XAIL::VAR_HUD::HUD[0]
end

def draw_var(var, unit, x, y, width)
# // Method to draw a variable with the content.
value = "#{$game_variables[var]}#{XAIL::VAR_HUD::SYMBOL}"
contents.font = Font.new(XAIL::VAR_HUD::FONT[0], XAIL::VAR_HUD::FONT[1])
contents.font.color = XAIL::VAR_HUD::FONT[2]
contents.font.bold = XAIL::VAR_HUD::FONT[3]
contents.font.shadow = XAIL::VAR_HUD::FONT[4]
draw_text(x, y, width - 60, line_height, value, 2)
draw_text(x, y, width - 18, line_height, unit, 2) unless unit.nil?
reset_font_settings
end

def refresh
# // Method to refresh the variable hud.
contents.clear
draw_var_hud
end

def draw_var_hud
# // Method to draw the var hud.
y = 0
@vars = {}
for i in XAIL::VAR_HUD::VAR_LIST
x = i[1].nil? ? 32 : -10
draw_var(i[0], i[1], x, y, contents.width - 8)
draw_icon(i[2], 210, y - 2) unless i[2].nil?
y += XAIL::VAR_HUD::SPACING
@vars[i[0]] = $game_variables[i[0]]
end
end

def update
# // Method to update the variable hud if a value has been changed.
super
for i in XAIL::VAR_HUD::VAR_LIST
refresh if($game_variables[i[0]] != @vars[i[0]])
end
end

end
#==============================================================================
# ** Scene_Map
#------------------------------------------------------------------------------
# Show variable hud on the map.
#==============================================================================
class Scene_Map < Scene_Base

alias xail_var_hud_window_start start
def start(*args, &block)
# // Method to start the var hud window on the map.
xail_var_hud_window_start(*args, &block)
create_var_hud_window
@var_hud_window.visible = $game_switches[XAIL::VAR_HUD::VAR_HUD_SWITCH]
end

alias xail_var_hud_window_terminate terminate
def terminate(*args, &block)
# // Method to terminate the var hud window on the map.
xail_var_hud_window_terminate(*args, &block)
end

def create_var_hud_window
# // Method to create the variable window.
@var_hud_window = Window_Var_Hud.new
@var_hud_window.x = XAIL::VAR_HUD::HUD[1]
@var_hud_window.y = XAIL::VAR_HUD::HUD[2]
@var_hud_window.z = XAIL::VAR_HUD::HUD[3]
@var_hud_window.opacity = XAIL::VAR_HUD::HUD[4]
@var_hud_window.windowskin = Cache.system(XAIL::VAR_HUD::HUD[5]) unless XAIL::VAR_HUD::HUD[5].nil?
end

alias xail_var_hud_window_update update
def update(*args, &block)
# // Method to update the var hud window on the map.
xail_var_hud_window_update(*args, &block)
@var_hud_window.visible = $game_switches[XAIL::VAR_HUD::VAR_HUD_SWITCH]
end

end # END OF FILE

#=*==========================================================================*=#
# ** END OF FILE
#=*==========================================================================*=#
Specifically this part:

# Set the symbol for the amount. (I have no idea what amount it's [SIZE=11pt]referring [/SIZE]to?)
# Can be set to "" to disable.
# SYMBOL = string
SYMBOL = ""

What should I put as the string? And is that all I need to add to get it to work?

I know I'm simple, [SIZE=11pt]hopefully [/SIZE]I'll look back on this post red faced lol.

Thanks again for any help.
 

MeowFace

Meow
Veteran
Joined
Feb 22, 2015
Messages
1,034
Reaction score
184
First Language
Meowish
Primarily Uses
Maybe this tutorial will help if you only want to display a variable on screen.
 

Shaz

Veteran
Veteran
Joined
Mar 2, 2012
Messages
40,098
Reaction score
13,704
First Language
English
Primarily Uses
RMMV
I've moved this thread to RGSSx Script Support. Please be sure to post your threads in the correct forum next time. Thank you.


Please don't post the same question in multiple places. If you post in the wrong place, just report it and the mods will move it for you.


Also, we prefer people NOT to copy/paste other people's scripts into their post, for a number of reasons. Just providing a link is a much better way. And when you DO have to copy/paste (because it's your own script that you're making, or you've made significant changes to it), put it into code tags in addition to spoiler tags if it's large. Code tags maintains the formatting, making it easier to read and preventing certain character sequences being converted to smilies by the forum software.


In fact, linking to where you originally got the script would be MUCH more helpful than just the script on its own, as we could possibly see some examples and Q&A with the author. So please provide a link.
 

Shaz

Veteran
Veteran
Joined
Mar 2, 2012
Messages
40,098
Reaction score
13,704
First Language
English
Primarily Uses
RMMV
Well, nobody asked about it there (or one person did, but the response was that it was a different script, so no answer was provided), but just the screenshot was helpful.


You could just put something into it to see what it does. It puts it immediately after the quantity, so I imagine it's some kind of unit of measurement. However, it looks like it's used for ALL of them, so the assumption is if you're going to have 3 variables showing there, they are all the same type of measurement.


Something like 'g' for grams, 'l' for litres, etc.


And, of course, it says to leave blank to disable, so if you don't know what it's for or how to use it, just leaving it as-is is always an option.
 

MeowFace

Meow
Veteran
Joined
Feb 22, 2015
Messages
1,034
Reaction score
184
First Language
Meowish
Primarily Uses
The tutorial should work the same but require you do a bit of eventing.

So yes, the script might proves to be easier if you get it to work.

And what Shaz said is true. That string is placed right after the Variable value in the script.

But after that you get to set another "text string" after each variable in the setting part above.

eg.

VAR_LIST[0] = [1, "Apple", 56]

So i am assuming that "symbol" is something like

eg.
"=" or "x" or ":"

Display Result:

NUMBER x TEXT (ICON)

NUMBER = TEXT (ICON)

NUMBER : TEXT (ICON)
 

Christaylor81

Villager
Member
Joined
Oct 6, 2015
Messages
22
Reaction score
4
First Language
English
Primarily Uses
Thanks for taking the time to help guys. Still haven't managed to get it working but I'll update the post when I crack it.
 

Christaylor81

Villager
Member
Joined
Oct 6, 2015
Messages
22
Reaction score
4
First Language
English
Primarily Uses

Sinweaver

Veteran
Veteran
Joined
Aug 11, 2015
Messages
598
Reaction score
418
First Language
English
Primarily Uses
So what exactly is your problem? Just problem with understanding the section on SYMBOL or are you having problem getting the HUD to show up?
 

Christaylor81

Villager
Member
Joined
Oct 6, 2015
Messages
22
Reaction score
4
First Language
English
Primarily Uses
I can't get the HUD to show up at all?!
 

Sinweaver

Veteran
Veteran
Joined
Aug 11, 2015
Messages
598
Reaction score
418
First Language
English
Primarily Uses
# VAR_HUD_SWITCH = switch_idVAR_HUD_SWITCH = 1The default switch to show the HUD is switch 001. Did you turn that switch on?

Edit:

 

I can't get the HUD to show up at all?!
Are you asking me or are you telling me that you cant display the HUD? o_O
 
Last edited by a moderator:

Christaylor81

Villager
Member
Joined
Oct 6, 2015
Messages
22
Reaction score
4
First Language
English
Primarily Uses
This is how the switch looks: VAR_HUD_SWITCH = 1

I've tinkered around with a few things but not had any luck. Obviously I'm very new to scripting so I'm just having trouble identifying the specific problem.

# VAR_HUD_SWITCH = switch_idVAR_HUD_SWITCH = 1The default switch to show the HUD is switch 001. Did you turn that switch on?

Edit:

 

 

Are you asking me or are you telling me that you cant display the HUD? o_O
An exclamation mark after a question mark is colloquially used to express puzzlement or confusion. If grammar ever trips you up try using common sense, why would I ask you information that pertains to me? -.-

Cheers, your help is appreciated.
 

Sinweaver

Veteran
Veteran
Joined
Aug 11, 2015
Messages
598
Reaction score
418
First Language
English
Primarily Uses
This is how the switch looks: VAR_HUD_SWITCH = 1

I've tinkered around with a few things but not had any luck. Obviously I'm very new to scripting so I'm just having trouble identifying the specific problem.

An exclamation mark after a question mark is colloquially used to express puzzlement or confusion. If grammar ever trips you up try using common sense, why would I ask you information that pertains to me? -.-

Cheers, your help is appreciated.
How would I know what kind of problem you have if all you said was "I can't get it to work"? (except the SYMBOL question)

Maybe you are having some other problem that I did not think of, which is why I ask. I find it rather insulting that you tried to play the common sense card on me. 

Well, whatever. I don't have the time to lecture others.

Be sure to turn switch 1 ON somewhere at the start of the game. 

Best way is to do this is probably through the use of a parallel process, turn the switch ON, then erase the event. Screenshot coming up shortly in case you are puzzled

Edit:

 
Last edited by a moderator:

Christaylor81

Villager
Member
Joined
Oct 6, 2015
Messages
22
Reaction score
4
First Language
English
Primarily Uses
How would I know what kind of problem you have if all you said was "I can't get it to work"? (except the SYMBOL question)

Maybe you are having some other problem that I did not think of, which is why I ask. I find it rather insulting that you tried to play the common sense card on me. 

Well, whatever. I don't have the time to lecture others.

Be sure to turn switch 1 ON somewhere at the start of the game. 

Best way is to do this is probably through the use of a parallel process, turn the switch ON, then erase the event. Screenshot coming up shortly in case you are puzzled
I didn't mean to upset you. You seemed confused and asked me a question on a semantic irrelevancy. I just obliged with a straight answer. The reason my post is vague is because I don't know what I should be asking, hence why I need pointing in the right direction. I honestly appreciate you taking the time to help with this, your help is genuinely appreciated.
 

Sinweaver

Veteran
Veteran
Joined
Aug 11, 2015
Messages
598
Reaction score
418
First Language
English
Primarily Uses
All good.

Since you are pretty new, I guess I should remind to set aside variables to store data on the items you want to display in the HUD

change the "nil" to the name of the item you want to include in the HUD.

Based on the code that comes with the script, you will need to set aside variable 1 - 4.

VAR_LIST[0] actually means variable 1

VAR_LIST[1] actually means variable 2

...etc.

# VAR_LIST = [variable_id, vocab (nil), icon_index (nil), x, y] VAR_LIST = [] # Don't remove! VAR_LIST[0] = [1, nil, nil] VAR_LIST[1] = [2, "Apple", 297] VAR_LIST[2] = [3, nil, 359] VAR_LIST[3] = [4, nil, 366]The code above will look like this in game (assuming that you turned switch 1 ON)



Whenever your character receive another apple, make sure you increase the value stored in variable 2 by 1. 

Why variable 2? because, as I mentioned before, VAR_LIST[1] means variable 2.

If you don't increase the value stored in variable 2, then the amount of apple will sit at 0 forever.

 

Christaylor81

Villager
Member
Joined
Oct 6, 2015
Messages
22
Reaction score
4
First Language
English
Primarily Uses
Huge thanks, finally managed to get it working. You've been really helpful.
 

Users Who Are Viewing This Thread (Users: 0, Guests: 1)

Latest Threads

Latest Posts

Latest Profile Posts

Couple hours of work. Might use in my game as a secret find or something. Not sure. Fancy though no? :D
Holy stink, where have I been? Well, I started my temporary job this week. So less time to spend on game design... :(
Cartoonier cloud cover that better fits the art style, as well as (slightly) improved blending/fading... fading clouds when there are larger patterns is still somewhat abrupt for some reason.
Do you Find Tilesetting or Looking for Tilesets/Plugins more fun? Personally I like making my tileset for my Game (Cretaceous Park TM) xD
How many parameters is 'too many'??

Forum statistics

Threads
105,865
Messages
1,017,059
Members
137,574
Latest member
nikisknight
Top