Iavra Event Popup

Discussion in 'JS Plugin Releases (RMMV)' started by Iavra, Oct 29, 2015.

  1. Iavra

    Iavra Veteran Veteran

    Messages:
    1,797
    Likes Received:
    856
    First Language:
    German
    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: Feb 1, 2016
    #1
  2. thespartanshow

    thespartanshow Villager Member

    Messages:
    13
    Likes Received:
    3
    Location:
    Spokane, WA
    Could you give me an example of how to use the options? 

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

    Shaz Veteran Veteran

    Messages:
    37,805
    Likes Received:
    11,509
    Location:
    Australia
    First Language:
    English
    Primarily Uses:
    RMMV
    Try "width=400" in quotes.
     
    #3
  4. Iavra

    Iavra Veteran Veteran

    Messages:
    1,797
    Likes Received:
    856
    First Language:
    German
    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.
     
    #4
    thespartanshow likes this.
  5. thespartanshow

    thespartanshow Villager Member

    Messages:
    13
    Likes Received:
    3
    Location:
    Spokane, WA
    Thanks! I really appreciate it!

    Any chance there is a way to center align the text?
     
    Last edited by a moderator: Oct 31, 2015
    #5
  6. Iavra

    Iavra Veteran Veteran

    Messages:
    1,797
    Likes Received:
    856
    First Language:
    German
    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: Oct 31, 2015
    #6
  7. thespartanshow

    thespartanshow Villager Member

    Messages:
    13
    Likes Received:
    3
    Location:
    Spokane, WA
    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!
     
    #7
  8. Chaos17

    Chaos17 Dreamer Veteran

    Messages:
    1,253
    Likes Received:
    420
    Location:
    France
    First Language:
    French
    Please show a screenshot.
     
    #8
    RachelTheSeeker likes this.
  9. robroyman

    robroyman Villager Member

    Messages:
    23
    Likes Received:
    5
    Location:
    Ireland
    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 :)
     
    #9
  10. Iavra

    Iavra Veteran Veteran

    Messages:
    1,797
    Likes Received:
    856
    First Language:
    German
    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.
     
    #10
  11. robroyman

    robroyman Villager Member

    Messages:
    23
    Likes Received:
    5
    Location:
    Ireland
    First Language:
    English
    Ok, thanks very much for getting back to me :) I will await a speech bubble plugin then :) Cheers, Rob
     
    #11
  12. Nelderson

    Nelderson Coding Bitch Veteran

    Messages:
    164
    Likes Received:
    163
    Location:
    Rhode Island
    First Language:
    English
    Primarily Uses:
    RMMV
    Why must I see this plugin AFTER making my own....

    Now I'm just butthurt  :p
     
    #12

Share This Page