Create A "Speach" bubble above an event

Discussion in 'JS Plugin Requests' started by DarknessFalls, Oct 27, 2015.

Thread Status:
Not open for further replies.
  1. DarknessFalls

    DarknessFalls Rpg Maker Jesus - JS Dev. Veteran

    Messages:
    1,393
    Likes Received:
    209
    First Language:
    English
    This should be rather simple, unfortunately I don't have the time to create it :(

    The thing I need is simple, super simple. Essentially I need a window that fades in and fades out after x amount of "time" (think of the map title that fades in and fades out)

    Now attach this to a specific event. (above the event)

    Essentially the user does something like ClassName.method(eventId, text, time, fontSize) as a script call, this then creates the window above the eventId with the text specified and it should fade in, stick around for time and then fade out.

    the fontSize should default to 10-12 if not passed in.

    The window should be opacity = 0 and it should use the dimwindow frame (again you can see this in the Window Map Title class.

    If some one could create this I would be grateful.
     
    #1
  2. Shaz

    Shaz Veteran Veteran

    Messages:
    37,806
    Likes Received:
    11,509
    Location:
    Australia
    First Language:
    English
    Primarily Uses:
    RMMV
    Can you give an example of what values text might be?  Will it just be a single word, a couple of words?  Just one line?  Do you need to use the escape codes that are available in the Show Text command (actor names, icons, variables, etc)?

    Will you ever want more than one on the screen at a time?  Could one be fading in while the other is fading out?
     
    #2
  3. Iavra

    Iavra Veteran Veteran

    Messages:
    1,797
    Likes Received:
    856
    First Language:
    German
    I'm currently working on a popup plugin, that features popups independently fading out. It shouldn't be too hard to modify, actually it should be easier, since your request is less generic. Might take a few days, though, since i want to release my current plugins first.
     
    #3
  4. DarknessFalls

    DarknessFalls Rpg Maker Jesus - JS Dev. Veteran

    Messages:
    1,393
    Likes Received:
    209
    First Language:
    English
    ClassName.method(eventId, text, time, fontSize);// So:ClassName.method(001, 'Hello \c[9]world\c[0]', 175, 10);// For event 1 a "box" or "bubble" appears above there head. It can take short codes, not // required. It can only hold a max of 70 characters, half a twitter tweet.// The comes rom the concept of how long it takes for the map name to fade out // (map name is 150)// 10 is the font size.// It can take icon and text: '\i[9] Hello \c[9]World\c[0]'. Hope that gives you an idea Shaz

    And yes you can have multiple of these running at a time - think of balloon bubbles.

    Mine is super super simple. Im looking to essentially tie a window to a event above its head and, with the above info, fill it with text.
     
    #4
  5. Iavra

    Iavra Veteran Veteran

    Messages:
    1,797
    Likes Received:
    856
    First Language:
    German
    I would probably design the function like this:

    Classname.method(eventId, text, options)where "options" is an object that can be used to override default values, like:- fadeIn/fadeOut

    - display time

    - fontName/fontSize

    - x/y offset

    - ...

    The default values are set by plugin parameters and can be changed at runtime by calling a function like:

    Code:
    ClassName.setDefaults(options)
     
    #5
    Kyuukon likes this.
  6. DarknessFalls

    DarknessFalls Rpg Maker Jesus - JS Dev. Veteran

    Messages:
    1,393
    Likes Received:
    209
    First Language:
    English
    Regardless of design I just need something super super simple. Not a lot of fluff needs to go into this how I wish I had time for this 
     
    #6
  7. Iavra

    Iavra Veteran Veteran

    Messages:
    1,797
    Likes Received:
    856
    First Language:
    German
    I couldn't wait and did a first version:

    http://pastebin.com/86ebsSjx

    There isn't a @help yet, so the quick version:

    Create a new popup with this script call (plugin command TBD):

    IAVRA.EVENTPOPUP.popup(text, eventId, options);where "text" is the text to be displayed, "eventId" is the id of the event where the popup should be positioned and "options" is an optional object containing overrides for one or more defaults.The possible options are:

    width Width of the popup window.x Popup offset.y Popup offset.duration Display duration after the popup has faded in and before it fades out.fadeIn Fade in duration.fadeOut Fade out duration.fontName Name of the font to be used.fontSize Font size to be used.lineHeight Line Height of the popup. Should be a bit higher than fontSize.All of these can also be set via plugin parameters as default values.There is an additional script call (plugin command TBD):

    IAVRA.EVENTPOPUP.clear(eventId);This will clear all popups belonging to an event or all popups if the "eventId" parameter is omitted.Events are only referenced by id, so i won't keep the garbage collector from working. If an event can't be found when a popup is updated, the popup removes itself.

    Currently, popups persist after a transition to Scene_Menu, but get destroyed when entering a battle. I might change this or make it more configurable, though.

    The functions to create the popup background, fading in and out are created on the module, so it's easy to overwrite them, if needed.
     
    Last edited by a moderator: Oct 28, 2015
    #7
    Kyuukon likes this.
  8. DarknessFalls

    DarknessFalls Rpg Maker Jesus - JS Dev. Veteran

    Messages:
    1,393
    Likes Received:
    209
    First Language:
    English
    This doesn't seem to use a lot of RPG maker base stuff, you seem to go off and do your own thing only occasionally over ride or extending classes or methods. Can I ask what your reason for using some core pixi stuff was aside rom say creating a new window, attaching it to a specific sprite and opening it when the event with the corresponding class was called?

    Not saying it was bad, just wondering why you chose to avoid using some more base api stuff like how balloon animations were done ?? I have-not read too much into the code.

    I will deff be using this though :D
     
    Last edited by a moderator: Oct 28, 2015
    #8
  9. Iavra

    Iavra Veteran Veteran

    Messages:
    1,797
    Likes Received:
    856
    First Language:
    German
    I try to avoid overriding base functions as much as possible to keep my scripts/plugins compatible. I think it's a good habit to have clear interfaces.


    I used PIXI.DisplayObjectContainer because the WindowLayer renders everything on one bitmap, causing multiple overlapping popups to "cut out" each other. The other alternative would be directly adding the popups as children of Scene_Map, but that has multiple pitfalls:


    - I would need to directly interact with the scene more, adding complexity.


    - When entering Scene_Menu, the current Scene_Map is terminated and recreated afterwards, causing all popups to be lost. This could be circumvented, by separating popup logic and windows and storing the popups in an array and adding "observers" to the scene whenever it loads. I didn't like having all popups being their own children, though, and think it's better to have a container so we know exactly how deep (z-axis) the popups are.


    I didn't actually look how the engine does balloons...maybe i should and see if i can use something from that.
     
    #9
  10. DarknessFalls

    DarknessFalls Rpg Maker Jesus - JS Dev. Veteran

    Messages:
    1,393
    Likes Received:
    209
    First Language:
    English
    Couple issues with the script, One I cant fix, the other I can figure out if you dont have time:

    - Battles, the box needs to go away and come back. or the sprite the box is over top needs to stay instead of being erased.

    - Short codes do not work, I can try and figure that out.

    - Bonus: It doesn't seem like, even if I set it to 175 that the box ever fades out .... 

    You have 

    this.drawTextEx(text, 0, 0);But the short code in the command, "\c[9]Bla ...\c[0]" Shows up as: \c[9]Bla ...\c[0] In the window. Bug?
     
    Last edited by a moderator: Oct 30, 2015
    #10
  11. Iavra

    Iavra Veteran Veteran

    Messages:
    1,797
    Likes Received:
    856
    First Language:
    German
    I added a new plugin parameter, "Retain On Scene". It's set to "Scene_Menu, Scene_Battle" by default, so this should work for you. You'll need to remove and re-add the plugin from th list, so the new parameter gets recognized.
    Single backslashes are control characters in JavaScript, so you need to double them, unless you use \n, \f or \1xb. So you would write "\\c[9]Bla ...\\c[0]", instead. I just tested it and it works.
    Can you post your exact configuration and plugin call?
     
    #11
Thread Status:
Not open for further replies.

Share This Page