Opposite of \lastGet (Plugin Edit)

Discussion in 'Javascript/Plugin Support' started by tale, Jun 18, 2019.

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

    tale Volunteer Veteran

    Messages:
    417
    Likes Received:
    679
    Location:
    USA
    First Language:
    English
    Primarily Uses:
    N/A
    I try editing "Last Get" Text plugin for an opposite counterpart, "Loss Get"

    About "Last Get" Text plugin-
    When using \lastGet in Text, it'll display icon and item name in message.

    Features
    - Shows icon and item name in text
    - Also include text for gold increase

    Example-
    [​IMG]

    For "Loss Get"
    On event page, I subtracted a potion by 1
    Then Show Text: You lose \lossGet !
    Also subtracted gold by this amount -1234
    Follow by Show Text: You lost \lossGet !

    However \lossGet appears like this in Text Window.
    "You lose !"
    "You lost !"
    On \lossGet, the name and the icon suppose to show.

    Note: Quantity of potion is more than 1 from the start. "Last Get" isn't affected.
    "Last Get" and "Loss Get" appears to work together, there are no error popups.

    \lastGet (original) download:
    https://www.dropbox.com/s/oywgu4213fvaucf/Torigoya_TextLastGet.js?dl=1

    \lossGet (edited) download:
    https://www.dropbox.com/s/8otag963x9pd9bh/Torigoya_TextLossGet.js?dl=1

    Edits I done are cheap with changing variable phrases.
    Maybe the issue has something to do with this line?
    Code:
    if (amount < 0) {
     
    #1
    Eliaquim likes this.
  2. Magnus0808

    Magnus0808 Software Developer Veteran

    Messages:
    114
    Likes Received:
    106
    First Language:
    Danish
    Primarily Uses:
    RMMV
    Hi, you have a couple of mistakes. The largest one is you accidently called 'Window_Base.prototype.processEscapeCharacter' for Window_Base.prototype.processEscapeCode. Which means that it wouldn't even process '\lossGet'.

    The other mistake isn't as obvious. You use 'Game_Party.prototype.loseItem' instead of 'Game_Party.prototype.gainItem'. This may seem weird, but the 'Change Items' event command calls 'Game_Interpreter.prototype.command126' which calls 'Game_Party.prototype.gainItem' here you should actually use 'if (amount < 0) {' as when you lose an item the amount is negative in 'gainItem'. :)
     
    #2
    tale likes this.
  3. tale

    tale Volunteer Veteran

    Messages:
    417
    Likes Received:
    679
    Location:
    USA
    First Language:
    English
    Primarily Uses:
    N/A
    Shoot, I forgot to update dropbox link with the project js file with "Window_Base.prototype.processEscapeCharacter" change. Thanks for pointing that out.

    Ah, it's fine to use 'if (amount < 0) {' when 'Game_Party.prototype.gainItem' is called. Not much to edit other than setting \lossGet, amount > to < 0.

    Thank you for the explanation :) Able to get \lossGet showing.
     
    #3
  4. slimmmeiske2

    slimmmeiske2 Little Red Riding Hood Moderator

    Messages:
    5,529
    Likes Received:
    4,118
    Location:
    Belgium
    First Language:
    Dutch
    Primarily Uses:
    RMXP

    This thread is being closed, due to being solved. If for some reason you would like this thread re-opened, please report this post and leave a message why. Thank you.

     
    #4
Thread Status:
Not open for further replies.

Share This Page