Iavra Event Popup

Iavra

Veteran
Veteran
Joined
Apr 9, 2015
Messages
1,797
Reaction score
859
First Language
German
Primarily Uses
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.
 
Last edited by a moderator:

thespartanshow

Villager
Member
Joined
Oct 31, 2015
Messages
13
Reaction score
3
Could you give me an example of how to use the options? 

IAVRA.EVENTPOPUP.popup(001, "...", width=400);This didn't seem to work.
 

Shaz

Veteran
Veteran
Joined
Mar 2, 2012
Messages
39,134
Reaction score
12,406
First Language
English
Primarily Uses
RMMV
Try "width=400" in quotes.
 

Iavra

Veteran
Veteran
Joined
Apr 9, 2015
Messages
1,797
Reaction score
859
First Language
German
Primarily Uses
Not quotes, you need to put it in curly brackets, like this:

Code:
IAVRA.EVENTPOPUP.popup(1, "...", {width: 400});
I also removed the leading zeroes from the event id, since some browsers would treat this like an octal number.
 

thespartanshow

Villager
Member
Joined
Oct 31, 2015
Messages
13
Reaction score
3
Thanks! I really appreciate it!

Any chance there is a way to center align the text?
 
Last edited by a moderator:

Iavra

Veteran
Veteran
Joined
Apr 9, 2015
Messages
1,797
Reaction score
859
First Language
German
Primarily Uses
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.
 
Last edited by a moderator:

thespartanshow

Villager
Member
Joined
Oct 31, 2015
Messages
13
Reaction score
3
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!
 

robroyman

Villager
Member
Joined
Nov 3, 2015
Messages
23
Reaction score
5
First Language
English
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 :)
 

Iavra

Veteran
Veteran
Joined
Apr 9, 2015
Messages
1,797
Reaction score
859
First Language
German
Primarily Uses
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.
 

robroyman

Villager
Member
Joined
Nov 3, 2015
Messages
23
Reaction score
5
First Language
English
Ok, thanks very much for getting back to me :) I will await a speech bubble plugin then :) Cheers, Rob
 

Nelderson

Coding *****
Veteran
Joined
Mar 17, 2012
Messages
164
Reaction score
166
First Language
English
Primarily Uses
RMMV
Why must I see this plugin AFTER making my own....

Now I'm just butthurt  :p
 

VectorPixel

Warper
Member
Joined
Mar 2, 2020
Messages
2
Reaction score
0
First Language
Russian
Primarily Uses
RMMV
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!
 

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

Latest Threads

Latest Posts

Latest Profile Posts

Stream will be live shortly! Going to do another art stream tonight so that I can finish my Fauna Focus piece~ Feel free to drop by!
Humans are fallible creatures, we all know that. It's when we're forced to look at ourselves that we start to disagree. :p
Expectation: Working on boss battle.
Reality: "Look at how awful are these code and database organization. Let me clean this mess", *yet, casually adding more modules that I have no idea if I would use it later*
Trying to learn to read Japanese so I read my manga. I like to buy them without all the edits made during translation.
The only thing getting me through today so far is coffee. And lots of it.

Forum statistics

Threads
97,852
Messages
947,384
Members
129,079
Latest member
DerLaPux
Top