Description
Allows to display popups messages above events, which can be used for speech bubbles or on chests.
Author
Iavra
Parameters
@param Popup Width
@desc Default width for the popup window. Overflowing text will be cut away. Default: 200
@default 200
@param Offset X
@desc By default, popups are centered on event.screenX(). This is the X offset. Default: 0
@default 0
@param Offset Y
@desc By default, popups are centered on event.screenY(). This is the Y offset. Default: 0
@default 0
@param Display Duration
@desc How long the popup will be displayed after fading in and before fading out. Default: 200
@default 200
@param Fade In Duration
@desc How long it takes for the popup to fade in. Default: 10
@default 10
@param Fade Out Duration
@desc How long it takes for the popup to fade out. Default: 60
@default 60
@param Font Name
@desc Name of the font to be used. If left empty, default is used instead. Default: (empty)
@default
@param Font Size
@desc Font size to be used. Default: 12
@default 12
@param Line Height
@desc Line height to be used. Should be a bit higher than font size. Default: 18
@default 18
@param Retain On Scene
@desc When one of these scenes becomes active, popups will be hidden, instead of destroyed. Default: Scene_Menu, Scene_Battle
@default Scene_Menu, Scene_Battle
How to Use
To create a popup, call the following function in a "Script" event command:
IAVRA.EVENTPOPUP.popup(eventId, text, options);
Where "eventId" is the id of the event you want to show the popup on, "text" is the message you want to show and "options" is an optional object, that can be used to override the default values set via plugin parameters.
The following list shows all possible options:
width
The width of the popup window. By default, popups will be horizontally centered on the event.
x
An offset on the x axis. By default, popups are centered on the event.
y
An offset on the y axis. By default, popups are centered on the event.
duration
How long the popup should stay visible after it has faded in and before it starts to fade out.
fadeIn
How long it takes for the popup to fade in.
fadeOut
How long it takes for the popup to fade out.
fontName
The font to be used.
fontSize
The font size to be used.
lineHeight
Height of a single text line. This should be slightly higher than fontSize.
The "text" parameter can contain any special characters. Beware that icons have a fixed size and might look strange depending on the fontSize. Also remember that you need to double backslashes on certain escape codes. To display the value of variable 10, you would use \\V[10], for example.
If you want to remove popups, before they have faded out, you can do so by calling this function:
IAVRA.EVENTPOPUP.clear(eventId);
This will remove all popups shown for a specific event or all popups if the "eventId" parameter is left out.
If you don't want to use script calls, you can use the following plugin commands, instead, but note that it's not possible to specify options for the "popup" command:
EventPopup popup eventId textEventPopup clean eventId
Inside plugin commands, you can use the keyword "this" (without quotes) to show or clear popups on the current event.
Terms of Use
Free to use for both commercial and non-commercial games. Please give credit.
Download
http://pastebin.com/86ebsSjx
FAQ
Q: I don't like the black background, can i change it?
A: Currently, there a no parameters or options to change the background, but you can override "IAVRA.EVENTPOPUP._callbacks.drawBackground" to provide your own function. The same goes for "fadeIn" and "fadeOut", which are both callbacks controlling how a popup fades in and out, respectively.
Iavra Event Popup
● ARCHIVED · READ-ONLY
-
-
Could you give me an example of how to use the options?
IAVRA.EVENTPOPUP.popup(001, "...", width=400);This didn't seem to work. -
Try "width=400" in quotes.
-
Not quotes, you need to put it in curly brackets, like this:
Code:I also removed the leading zeroes from the event id, since some browsers would treat this like an octal number.IAVRA.EVENTPOPUP.popup(1, "...", {width: 400}); -
Thanks! I really appreciate it!
Any chance there is a way to center align the text? -
Not an easy one. The function i'm using to draw the text (and that's used by the normal message window, too) draws each character for its own, so it doesn't know how long a textline is before printing it and thus can't center it.
It's possible, but i would need to script that behaviour. -
Well, it would be wonderful to see! maybe even ensure a horizontal and vertical alignment to be centered.. would save trouble for late if people want larger boxes. Anyway, again thanks for the wonderful script!
-
Please show a screenshot.
-
Hi lavra, many thanks for this plugin. I had a query re. if I wanted to have a chat with this plugin, would it be possible to have the player press a button between speech bubble popups, the way it works in the default speech method? Thanks, Rob :)
-
No, that would be a different plugin that hooks into the "Show Text..." event command. This one is more for conversations or other stuff happening around you, without the need to stand still. Basically like the cutscenes in games like Half-Life 2, where you can still move while everything happens.
-
Ok, thanks very much for getting back to me :) I will await a speech bubble plugin then :) Cheers, Rob
-
Why must I see this plugin AFTER making my own....
Now I'm just butthurt :p -
Hi! I really like this plugin, but I'm really newbie in scripting.
I tried some tweaks, but I can't manage to disable the background without disabling the text popup with it.
Does someone know an easy way just to make the background completely transparent?
PS And hello everybody =) This is my first message on this forum! -
Bump? I guess...
-
I was trying Chau_Simple Popups, but it seems to work only by Plugin Command. So, I want to thank you for this plugin that works off script command (so I can use it in a Route Movement script command).
In case anyone else is curious about making the background color completely transparent:
On line 194 of the script, find the following function and delete or comment out everything execpt "popup.opacity = 0;" so it looks like this:
JavaScript:_callbacks: { drawBackground: function(popup) { // var color1 = popup.dimColor1(); // var color2 = popup.dimColor2(); // var width = popup.contentsWidth(); // var height = popup.contentsHeight(); popup.opacity = 0; //popup.contents.gradientFillRect(0, 0, width / 2, height, color2, color1); //popup.contents.gradientFillRect(width / 2, 0, width / 2, height, color1, color2); },