Letter sound Toggle (using Yan Options And Yan Message core X-1)

Discussion in 'Javascript/Plugin Support' started by Yougotsomechocolate, Jul 10, 2019.

  1. Yougotsomechocolate

    Yougotsomechocolate Random Chest Veteran

    Messages:
    133
    Likes Received:
    65
    First Language:
    English
    Primarily Uses:
    RMMV
    I've been looking for a way to do this for a while, tried to do so but I'm not sure exactly how to code turning the sound on/off as an option. So if anyone knows how please tell me.
    (I do know that someone asked before me a while back, like a year ago, but never got a response.)
     
    Last edited: Jul 11, 2019
    #1
  2. ShadowDragon

    ShadowDragon Veteran Veteran

    Messages:
    391
    Likes Received:
    114
    Location:
    Netherlands
    First Language:
    Dutch
    Primarily Uses:
    RMMV
    what exacly do you want? make a typing sound or turn off/on the typing sound in the option menu?
     
    #2
  3. Yougotsomechocolate

    Yougotsomechocolate Random Chest Veteran

    Messages:
    133
    Likes Received:
    65
    First Language:
    English
    Primarily Uses:
    RMMV
    Turn on/off the typing sound in the option menu.
     
    #3
  4. ShadowDragon

    ShadowDragon Veteran Veteran

    Messages:
    391
    Likes Received:
    114
    Location:
    Netherlands
    First Language:
    Dutch
    Primarily Uses:
    RMMV
    I dont use it but if you can make a commen event into it, it might be easier, but I cant check atm.
    but the option core is to complicated so I drop the plugin.
     
    #4
  5. caethyril

    caethyril ^_^ Veteran

    Messages:
    946
    Likes Received:
    586
    Location:
    UK
    First Language:
    English
    Primarily Uses:
    RMMV
    Plugin link: http://www.yanfly.moe/wiki/Extended_Message_Pack_1_(YEP)

    From looking at the code, I believe the script call to turn letter sounds on is:
    Code:
    $gameSystem._msgSoundEnable = true;
    Swap true for false to turn them off. Then you could use Yanfly's Options Core plugin to add the option for the player. I think the default "new option" stuff is for a simple on/off switch like this so I imagine it'd be fairly easy as these things go: just add that script call where appropriate to turn the sounds on/off. :)

    Note that this approach assumes you won't be using the on/off plugin commands or message escape codes for letter sounds. If you want something to track player preference separately from the actual game setting then you may want to request an add-on over in JS Plugin Requests.
     
    #5
  6. Yougotsomechocolate

    Yougotsomechocolate Random Chest Veteran

    Messages:
    133
    Likes Received:
    65
    First Language:
    English
    Primarily Uses:
    RMMV
    @caethyril I’ll fiddle with it and see what makes it work (also for some reason lettersound glitches on my computer). edit: it seems the code doesn't work when I put it in the option menu, maybe the plugin command works?
     
    Last edited: Jul 11, 2019
    #6
  7. caethyril

    caethyril ^_^ Veteran

    Messages:
    946
    Likes Received:
    586
    Location:
    UK
    First Language:
    English
    Primarily Uses:
    RMMV
    Oh I just realised something. While I can get it working correctly like this (on/off while in-game), the letter sound thing is part of the saved data ($gameSystem), meaning it won't necessarily align with the game options (global). You may need a different letter-sound plugin, or at least some kind of add-on to handle re-initialising the config values on new game. :kaoslp:

    I'll leave my text-format "letterSound" Options Core entry here for anyone interested, but as I said, by itself the displayed and internal system values won't necessarily match up~
    Code:
    {"Name":"Letter Sounds","---Settings---":"","HelpDesc":"\"Enable or disable typing sounds for messages.\"","Symbol":"letterSound","ShowHide":"\"show = true;\"","Enable":"\"enabled = true;\"","Ext":"\"ext = 0;\"","---Functions---":"","MakeCommandCode":"\"this.addCommand(name, symbol, enabled, ext);\"","DrawItemCode":"\"var rect = this.itemRectForText(index);\\nvar statusWidth = this.statusWidth();\\nvar titleWidth = rect.width - statusWidth;\\nthis.resetTextColor();\\nthis.changePaintOpacity(this.isCommandEnabled(index));\\nthis.drawOptionsName(index);\\nthis.drawOptionsOnOff(index);\"","ProcessOkCode":"\"var index = this.index();\\nvar symbol = this.commandSymbol(index);\\nvar value = this.getConfigValue(symbol);\\nthis.changeValue(symbol, !value);\\n$gameSystem._msgSoundEnable = !value;\"","CursorRightCode":"\"var index = this.index();\\nvar symbol = this.commandSymbol(index);\\nvar value = this.getConfigValue(symbol);\\nthis.changeValue(symbol, true);\\n$gameSystem._msgSoundEnable = true;\"","CursorLeftCode":"\"var index = this.index();\\nvar symbol = this.commandSymbol(index);\\nvar value = this.getConfigValue(symbol);\\nthis.changeValue(symbol, false);\\n$gameSystem._msgSoundEnable = false;\"","DefaultConfigCode":"\"ConfigManager[symbol] = false;\"","SaveConfigCode":"\"config[symbol] = ConfigManager[symbol];\"","LoadConfigCode":"\"if (config[symbol] !== undefined) {\\n  ConfigManager[symbol] = !!config[symbol];\\n}\\nif ($gameSystem) {\\n  $gameSystem._msgSoundEnable = !!ConfigManager[symbol];\\n}\""}
     
    #7
  8. Yougotsomechocolate

    Yougotsomechocolate Random Chest Veteran

    Messages:
    133
    Likes Received:
    65
    First Language:
    English
    Primarily Uses:
    RMMV
    Any recommendations for letter sound plugins?
     
    #8

Share This Page