Variable Display

Hey guys! I'm looking for a script to display variables onscreen during certain times. Right now I'm using Angelo HUD v2.5 to display the main character's name and HP bar, but I'd like to display 3-4 more variables in addition to that.

Some background: I'm working on a game to teach my Japanese students English. Aside from exploration, I'm making a battle system manually through events, which plays more like quiz where you have to choose the right answer. Correct answers recover HP and incorrect answers take away HP. Throughout the story, the battle system gets harder (you only have a certain amount of time to answer) while the rewards increase (getting a high combo, for instance, gives much more EXP).

Right now, the character name and HP are displayed. With the acquisition of certain items (most notably, the "Scanner") however, more information will be displayed, specifically:

-turn number

-combo (how many correct answers the player's gotten in a row)

-how much damage a wrong answer will do

-how much time remains before you lose HP automatically

Out of all those, Combo is the most important thing to display.

It looks like this:

Battle Screen.png

...but I want it to look more like this:

Ideal Battle Screen.png

 

Of course, not exactly like that. I'm really open to suggestions. In any case, I'd like that information to be displayed in some way that it will be visible no matter the background, similar to the Angelo HUD. I'm not necessarily asking for specific placement (being able to move it at will would be good). 

 

All of these would ideally have the name of the variable before it, and the possibility for another variable behind it. 

Combo: 3/15, for instance. 

Combo, the word, followed by one variable / another variable.

 

Thanks in advance, and of course, let me know if you need anything. 

Battle Screen.png

Ideal Battle Screen.png
class Scene_Map < Scene_Base#===============================================================================#Text / Position Configuration#-------------------------------------------------------------------------------#HOW TO DRAW TEXT ON BITMAP - Useless if it doesn't interest you just skip this part#-------------------------------------------------------------------------------#No need to read that if you already know how to draw_text on a bitmap or#if it doesn't interest you#How to draw custom text on screen with the script it very easy #All you need is a text combined to a variable and a position on screen#Inside the "def create_text" you have the draw_text fonction that can be use#like this : draw_text(x, y, width, height, text) , x and y is position on screen#for width and heigh we use max width size of the HUD (192), for the height#we use 24 (if default font size is used), to draw text and variable we do that :#draw_text(0,0,192,24,"My Variable 5 = " + $game_variables[5].to_s)#we use .to_s on a variable to transform it in a text#-------------------------------------------------------------------------------#POSITION AND VARIABLES CONFIGURATION NEED TO BE CONFIGURED#-------------------------------------------------------------------------------#Creation of the text on the screen you can set your position here#just change the value inside bracket [] of $game_variables[] at the bottom#to set your own corect variables#-------------------------------------------------------------------------------SwitchID_Hud_Visible = 1 #Switch id of the hud visibilitySwitchID_Damage_Visible = 2SwitchID_Turn_Visible = 3SwitchID_Combo_Visible = 4def create_textfontSize = 16 # Font Size@scanner_bmp.font.name = ["Arial"] # Font Name (add # in front of the line back to default font)@scanner_bmp.font.size = fontSize@scanner_bmp.draw_text(0, 0, 192,fontSize, "Scanner",1) #1 at the end to center textif ($game_switches[SwitchID_Damage_Visible])@scanner_bmp.draw_text(16, 20, 192, fontSize, "Damage : " + $game_variables[1].to_s)endif ($game_switches[SwitchID_Turn_Visible])@scanner_bmp.draw_text(16, 40, 192, fontSize, "Turn : " + $game_variables[2].to_s + " / "+ $game_variables[3].to_s)endif ($game_switches[SwitchID_Combo_Visible])@scanner_bmp.draw_text(16, 60, 192, fontSize, "Combo : " + $game_variables[4].to_s + " / "+ $game_variables[5].to_s)end#Position of the HUD on screen@scanner_spr.x = 544-192@scanner_spr.y = 0end#-------------------------------------------------------------------------------#OPTIONAL you can turn it completely off by setting back = false inside create_background#-------------------------------------------------------------------------------def create_background  back = true  #Set the color here "Color.new(Red Value, Green Value, Blue Value, Opacity)  color = Color.new(20,0,0,45)  if (back == true)    @scanner_bmp.fill_rect(@scanner_bmp.rect,color)  endend#===============================================================================  alias :new_start :start  def start    super    new_start    @scanner_bmp = Bitmap.new(192,96)#THE SIZE OF THE BACKGROUND    @scanner_spr = Sprite.new()    @scanner_spr.visible = false    create_background()    create_text()    @scanner_spr.bitmap = @scanner_bmp  end  alias :new_update :update  def update    new_update    @scanner_bmp.clear()    create_background()    create_text()    @scanner_spr.bitmap = @scanner_bmp    if ($game_switches[SwitchID_Hud_Visible])      @scanner_spr.visible = true    else      @scanner_spr.visible = false    end  end endI hope it what you wanted 🙂 my english is far from perfect then sorry if some text are not readable 🙂 anyway the script is plug n play just need to configure which variable ID you need i've writed some info about the "draw_text" on bitmap directly you can skip it to go directly in configuration just at the bottom of the 1st large text good luck in your project, don't hesitate to ask me some change or anything if it was not what you asked for.

here a little screen http://postimg.org/image/xc598zlkd/
Zarby, this is great! And so quick too!

Is there a way to turn the display on and off? Maybe with a switch? And to turn the individual parts on and off? (the player unlocks each part individually)

Additionally, is there a way to make the text smaller? Or write in a different font?

Thank you for your hard work! 🙂
Sorry i totally forgot the switch visible/invisible, there is option for Font too, you can change the Size and Font, just coment the line @scanner_bmp.font.name = ["Arial"] if you want to use default 🙂 , (the edited script is in the previous post)
Zarby, this is perfect! Thank you so much! 😀
Hey Zarby.

If you'd be up for one last task, I'd like the combo display to either change color or get bigger when the two variables are equal. So, when it reads 10/10, for instance, it will be larger and/or a different color. Don't have to worry about when the two numbers are 0/0 because it won't display. 

tldr: combo line changes color / gets bigger when both numbers are the same

Is this possible? 

Thank you again for all your hard work! 🙂

Original thread: https://forums.rpgmakerweb.com/threads/variable-display.34812/