[RPG Maker XP] Variables which pop up

Started by Dyseyro, August 04, 2012, 08:04:57 am

Previous topic - Next topic

Dyseyro

I have a problem while making my own Action Battle System. The problem is i want the game to pop up the value of a variable, but i have no clue how i can do it. I don't want that the game to pause while displaying it want it to pop up parralell so not like a normal textbox. I hope theres a script or sth. that may help me.
Tanks to you

-Dyseyro

ForeverZer0

Is this for debugging purposes, or part of the battle system?

If its for debugging, and you simply want to take a look at the value of a variable for testing, I use this.

If its part of the battle system, and is incorporated into the gameplay, you need to be way more specific on how it should look, where it is, and what you want to display.
I am done scripting for RMXP. I will likely not offer support for even my own scripts anymore, but feel free to ask on the forum, there are plenty of other talented scripters that can help you.

Dyseyro

Well, that isnt what i meant. I just want that a value of a variable pops up on the screen while the game goes on. Nothing special. I just want to show the player how much DMG he dealed. And I'm sorry for my bad english I'm german so my english isn't the best. I hope you understand what I mean. Like a window with a message if you use the event command "Show Text", but if i would do it with this event command the game would pause for at least a few seconds and it would destroy the gameflow.

ForeverZer0

August 04, 2012, 09:01:30 pm #3 Last Edit: August 04, 2012, 09:02:59 pm by ForeverZer0
Spoiler: ShowHide
class Popup
 
 # Set the default size of the window. This is used when no size is defined.
 DEFAULT_SIZE = [320, 64]
 # Default number of frames the window displayes for when not defined.
 DEFAULT_DURATION = 60
 
 #-----------------------------------------------------------------------------
 #  * Display a Pop-up window
 #     text   - The text to display in the window
 #     time   - The number of frames to display window for
 #     width  - Width of the window
 #     height - Height of the window
 #-----------------------------------------------------------------------------
 def self.show(text, time = nil, width = nil, height = nil)
   width = (width == nil ? DEFAULT_SIZE[0] : width)
   height = (height == nil ? DEFAULT_SIZE[1] : height)
   x = (640 - width) / 2
   y = (480 - height) / 2
   @count = Graphics.frame_count + (time == nil ? DEFAULT_DURATION : time)
   @window = Window_Base.new(x, y, width, height)
   @window.contents = Bitmap.new(width - 32, height - 32)
   @window.contents.draw_text(0, 0, width - 32, height - 32, text, 1)
   Thread.new do
     while Graphics.frame_count < @count; end
     Popup.dispose_window
   end
 end
 #-----------------------------------------------------------------------------
 # * Dispose the window
 #-----------------------------------------------------------------------------
 def self.dispose_window
   if @window != nil && !@window.disposed?
     @window = @window.dispose
   end
 end
end


That should do it.
Use the following command:
Popup.show(TEXT, FRAME_COUNT, WIDTH, HEIGHT)


The only argument you actually need is the text. If the others are omitted, it uses the values that are defined as the defaults.
I am done scripting for RMXP. I will likely not offer support for even my own scripts anymore, but feel free to ask on the forum, there are plenty of other talented scripters that can help you.

Dyseyro

August 07, 2012, 04:27:32 am #4 Last Edit: August 07, 2012, 05:54:02 am by Dyseyro
Ok I solved my problems so far with this. the only thing thats left is to make the window invisible so you only see the message that would be all. But thanks anyway.

ForeverZer0

You said you wanted a window. Either way, after the window is created, you can just add a line to set the windowskin to nil.
I am done scripting for RMXP. I will likely not offer support for even my own scripts anymore, but feel free to ask on the forum, there are plenty of other talented scripters that can help you.