Conditional "Show Choices" (hide or disable choices)

Discussion in 'JS Plugin Releases (RMMV)' started by Aloe Guvner, Jun 27, 2018.

  1. daisyfairy42

    daisyfairy42 Villager Member

    Messages:
    9
    Likes Received:
    4
    Location:
    Pennsylvannia
    First Language:
    English
    Primarily Uses:
    RMMV
    Heyo, wanted to post a thank you! This is an absolute life-saver for me! I dropped it in, set it up like you said, and it worked like a charm!
     
    #21
  2. lendokhar

    lendokhar Warper Member

    Messages:
    1
    Likes Received:
    0
    First Language:
    Spanish
    Primarily Uses:
    RMMV
    It doesn't work for me, once I run the game the choices show the <<s[1]>> and <<v[1]>> strings.
    Is the plugin broken already?
     
    #22
  3. Aloe Guvner

    Aloe Guvner Walrus Veteran

    Messages:
    1,596
    Likes Received:
    1,003
    Location:
    USA
    First Language:
    English
    Primarily Uses:
    RMMV
    @lendokhar Works fine in all the tests I've run.

    Some basic problem solving questions for you:

    1. Do you have the latest version?
    2. Does it work with all other plugins turned off?
      • If yes, it's a compatibility issue. You need to identify the incompatible plugin by turning them on one-by-one until the issue is found
      • If it's a compatibility issue, please post a screenshot of the list of plugins you use from your Plugin Manager
    3. Did you rename the plugin to something besides the original name?
    4. Did you change the plugin parameters to use something besides << and >> ?
      • Please post a screenshot of the settings of this plugin from the Plugin Manager
    5. Do any errors appear in the console? (press F8 during playtest to open it)
     
    #23
  4. Qqernometabom

    Qqernometabom Villager Member

    Messages:
    13
    Likes Received:
    6
    First Language:
    English
    Primarily Uses:
    RMMV
    Is there a way to put a sound when selecting the disabled choice?
    I don't know if i have authorization to change your plug-in.

    For example:
    Code:
            var se = {};
            se.name = 'Item3';
            se.pan = 0;
            se.pitch = 100;
            se.volume = 90;
            AudioManager.playSe(se);
    It looks awesome !

    EDITED:
    Only now occurred to me that i disabled all rmmv default audio settings, and the default "disabled choice audio" will probably play when selecting. xD

    EDITED 2:
    Yes, it does. Lol, i'm sorry.
    Don't know how to deleted this spam. D:
     
    Last edited: Jan 30, 2019
    #24
    Aloe Guvner likes this.
  5. Aloe Guvner

    Aloe Guvner Walrus Veteran

    Messages:
    1,596
    Likes Received:
    1,003
    Location:
    USA
    First Language:
    English
    Primarily Uses:
    RMMV
    I never tested for sound, so it's good to know it works :)

    People are allowed to edit my plugins, if the edit can benefit most people then I request the edit is shared and I add it to a new version of the plugin.
     
    #25
  6. jakr8911

    jakr8911 Veteran Veteran

    Messages:
    34
    Likes Received:
    1
    First Language:
    english
    Primarily Uses:
    Other
    Is there a way to change the word on the option when player confrim their selection? I want to fool the player a bit
     
    #26
  7. Aloe Guvner

    Aloe Guvner Walrus Veteran

    Messages:
    1,596
    Likes Received:
    1,003
    Location:
    USA
    First Language:
    English
    Primarily Uses:
    RMMV
    What do you mean? When the player "confirms their selection"?

    When the player selects a choice, the choice window goes away and the event moves to the next command. There would be no text to change.
     
    #27
  8. Orleron

    Orleron Warper Member

    Messages:
    1
    Likes Received:
    0
    First Language:
    English
    Primarily Uses:
    Other
    I have this same problem and I can confirm that it is because of the Yanfly Extended Messaging Pack 1 (YEP_X_ExtMesPack1). When I switch that plugin off, the problem goes away. Unfortunately, the extended messaging pack is quite valuable for my game.

    fyi, thanks.
     
    #28
  9. Kenode

    Kenode Veteran Veteran

    Messages:
    66
    Likes Received:
    24
    First Language:
    Spanish
    Primarily Uses:
    RMMV
    I don't seem to have this issue myself, and I'm running a big load of plugins, are you placing Aloe's plugin BELOW Yanfly's?
     
    #29
  10. kako05

    kako05 Veteran Veteran

    Messages:
    87
    Likes Received:
    4
    First Language:
    Australian
    Primarily Uses:
    RMMV
    OR statement doesn't work.
    <<,v[119] < 8 || ,v[119] >= 17>>
    My 119 variable is set to 15 and it's disabled.

    btw is it possible to check for an item? If party has item ID 3, show choice?
     
    Last edited: Apr 6, 2019
    #30
  11. Aloe Guvner

    Aloe Guvner Walrus Veteran

    Messages:
    1,596
    Likes Received:
    1,003
    Location:
    USA
    First Language:
    English
    Primarily Uses:
    RMMV
    I've tested "or" statements, it works fine

    There's an extra comma after the || operator that's probably causing a syntax error, if you remove the comma it should work. I log all errors to the console which can be opened in playtest by pressing F8.

    You can also do it based on if the party has an item or not. You'll want to use the game party has item function.

    Code:
    gp.hasItem($dataItems[ID])
    Replace ID with the ID# of the item. "gp" is an abbreviation for "$gameParty" only for this plugin.
     
    #31
  12. kako05

    kako05 Veteran Veteran

    Messages:
    87
    Likes Received:
    4
    First Language:
    Australian
    Primarily Uses:
    RMMV
    gp.hasItem($dataItems[ID]) works just fine, but instead of disabling I need to enable a choice.
    I tried <<,gp.hasItem($dataItems[ID]) <= 0>> which should disable a choice if party has zero items? but had no success.

    Also, you were right, it was a syntax error.
    Really good plugin, one of my favorites. It helps with quest givers and progression of the quests.
     
    Last edited: Apr 6, 2019
    #32
    Aloe Guvner likes this.
  13. Aloe Guvner

    Aloe Guvner Walrus Veteran

    Messages:
    1,596
    Likes Received:
    1,003
    Location:
    USA
    First Language:
    English
    Primarily Uses:
    RMMV
    No problem - here's a quick tip:

    In Javascript there are different types of data. The most common types are:
    • Numbers
    • Strings (letters / text)
    • Boolean (true or false)
    The "has Item" function returns a boolean, so the result is either true or false. True if the party has the item and false if the party doesn't have the item (there must be a function that tells you how many items the party has but I forget what it is!)

    To flip it so the choice is enabled when the party has an item, you do the opposite - in Javascript and many programming languages this is called a not operator and it is a "!" mark.

    Code:
    <<,!gp.hasItem($dataItems[ID])>>
    In English, this means "Disable if the party does not have item" which is exactly the same as saying "Enable if the party does have item"

    Hopefully this makes sense? :biggrin:
     
    #33
  14. kako05

    kako05 Veteran Veteran

    Messages:
    87
    Likes Received:
    4
    First Language:
    Australian
    Primarily Uses:
    RMMV
    Oh, thanks! That makes sense. Really appreciate. I made a workaround with IF command and control variables (if this item = set variable to X), but it'll be easier for the next event knowing what you told me :)
    btw I'm using it with galv's picture choices
    https://galvs-scripts.com/2016/12/09/mv-choice-pictures/
    unfortunately, if the choice has a command << anything >> it won't display a picture upon choosing the choice. Would you take a look at it and what's causing it? I would pay for a compatibility patch :)
     
    Last edited: Apr 7, 2019
    #34
  15. Aloe Guvner

    Aloe Guvner Walrus Veteran

    Messages:
    1,596
    Likes Received:
    1,003
    Location:
    USA
    First Language:
    English
    Primarily Uses:
    RMMV
    If you find you are setting variables equal to the quantity of items a lot, you might be interested in this plugin. I found myself setting variables a lot so I wrote that to make it easier.

    I'll look at the Galv plugin to see if there is a conflict.

    Edit: Try putting my plugin below Galv's. He overwrites a function, I don't overwrite it (Window_ChoiceList.prototype.makeCommandList)
     
    Last edited: Apr 7, 2019
    #35
  16. kako05

    kako05 Veteran Veteran

    Messages:
    87
    Likes Received:
    4
    First Language:
    Australian
    Primarily Uses:
    RMMV
    Good news. I did that, it still didn't work. I managed to fix it by changing
    Dog House <p:travel_dog_1,960,368> <<v[112] < 1>>
    to
    Dog House <<v[112] < 1>> <p:travel_dog_1,960,368>
    :D
    Galvs must be in front of the syntax.
     
    #36
  17. gothicvoid

    gothicvoid [GothicVoid] Veteran

    Messages:
    82
    Likes Received:
    57
    Location:
    Texas
    First Language:
    English
    Primarily Uses:
    RMMV
    was referred to this utility by another because i was having issues with another like plugin... (it kept freezing my game TT~~TT ) and it was SUPER SIMPLE!!! Thanks so much!!!
     
    #37
    Kest likes this.
  18. Almightypebble

    Almightypebble Veteran Veteran

    Messages:
    57
    Likes Received:
    1
    First Language:
    Bulgarian
    Primarily Uses:
    RMMV
    Hey!
    I seem to have a problem with this plugin when combined with Galv's Visual Novel Choices. If I put this plugin on top of his, your plugin doesn't seem to work, but if I put it below his, the pictures for his visual novel choices don't load and it cuts off the beginning and the end of my text.
    Should I edit something in the plugins?
     
    #38
  19. kako05

    kako05 Veteran Veteran

    Messages:
    87
    Likes Received:
    4
    First Language:
    Australian
    Primarily Uses:
    RMMV
    Galv's vnc is not compatible with this plugin. With this plugin, the text is pushed off the center in my project since this plugin code is invisible on gamerun, but it's treated as an additional text in dialogue menu. I add empty spaces to counter that, but it's a messy way to do it.
     
    #39

Share This Page