Envision, Create, Share

Welcome to HBGames, a leading amateur game development forum and Discord server. All are welcome, and amongst our ranks you will find experts in their field from all aspects of video game design and development.

A second message without the dialogue box

Hi peoples, how are your collective days?  Your favorite admin here, with yet another XP request, this time for an open game coming soon in a matter of days, just need some last minute touches - such as this request.

This may seem like a stupid request, but I'm looking for a way to, via call script, show a text (importantly a variable) on screen without the dialogue window being active at all, at an exact location with an exact font and font size (since it's used for two projects, customizable in the script would be great).

So like, this:
http://www.sixty.rhinocap.net/rm/mockup2.png[/img]
See that 99?  To be able to show that, above all other things.

The reason I say without the dialogue window, is because it would be problematic to my intent to have the dialogue window.  They should be able to be used together, is what I mean.  Have the text or variable shown at a specific x/y, while allowing the dialogue window to still be active.  Since I'm requesting this for two projects, and the other needs the dialogue window to work while this is happening.

Basically, call script to show the message at a certain spot, and a call script to end and remove said message.

There's a script that can show text, which I was looking at.  However it requires the SDK and can not show variables.

I think that's it, have a good day.
 
Try this out.

$tx = Sprite_Text.new(x, y, font_size, font_name, text)

be careful in your event that the line breaks after one of the commas.
And use double backslashes for the variables  ("\\V[1]")

$tx.dispose to erase

Code:
#==============================================================================
# ** Sprite_Text
#------------------------------------------------------------------------------
#  This sprite is used to display text on the screen.
#==============================================================================

class Sprite_Text < Sprite
  #--------------------------------------------------------------------------
  # * Object Initialization
  #--------------------------------------------------------------------------
  def initialize(x = 0, y = 0, size = 22, font = "Arial", text = "")
    super()
    self.bitmap = Bitmap.new(640, 480)
    self.bitmap.font.name = font
    self.bitmap.font.size = size
    text.gsub!(/\\[Vv]\[([0-9]+)\]/) { $game_variables[$1.to_i] }
    txt_rect = bitmap.text_size(text)
    self.src_rect.set(0, 0, txt_rect.width, txt_rect.height)
    self.x = x
    self.y = y
    self.z = 500
    self.bitmap.draw_text(txt_rect, text, 1)
  end
  #--------------------------------------------------------------------------
  # * Dispose
  #--------------------------------------------------------------------------
  def dispose
    if self.bitmap != nil
      self.bitmap.dispose
    end
    super
  end
end

Be Well
 

Thank you for viewing

HBGames is a leading amateur video game development forum and Discord server open to all ability levels. Feel free to have a nosey around!

Discord

Join our growing and active Discord server to discuss all aspects of game making in a relaxed environment. Join Us

Content

  • Our Games
  • Games in Development
  • Emoji by Twemoji.
    Top