Zarsla

Options Code Info

Apr 15th, 2018
137
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. //Plugins Needed:
  2. //YEP-Core Engine http://yanfly.moe/2015/10/09/yep-1-core-engine/
  3. //YEP-Options Core http://yanfly.moe/2018/04/13/yep-165-options-core-rpg-maker-mv/
  4. //YEP-Advance Switches and Variables http://yanfly.moe/2018/01/19/yep-162-advanced-switches-and-variables-rpg-maker-mv/
  5.  
  6.  
  7. //Advandce Switch/Variable Code:
  8. //Place this in the name of the id for the switch or variable you want.
  9. Eval: ConfigManager['symbol'] //where symbol = is the symbol you put in the options menu
  10.  
  11.  
  12.  
  13.  
  14. //For Switches:
  15. //In the Options Pluign:
  16. // Make Option:
  17. this.addCommand(name, symbol, enabled, ext);
  18.  
  19. //Draw Option:
  20. var rect = this.itemRectForText(index);
  21. var statusWidth = this.statusWidth();
  22. var titleWidth = rect.width - statusWidth;
  23. this.resetTextColor();
  24. this.changePaintOpacity(this.isCommandEnabled(index));
  25. this.drawOptionsName(index);
  26. this.drawOptionsOnOff(index);
  27.  
  28. //Press OK:
  29. var index = this.index();
  30. var symbol = this.commandSymbol(index);
  31. var value = this.getConfigValue(symbol);
  32. this.changeValue(symbol, !value);
  33.  
  34. //Crusor Right:
  35. var index = this.index();
  36. var symbol = this.commandSymbol(index);
  37. var value = this.getConfigValue(symbol);
  38. this.changeValue(symbol, true);
  39.  
  40.  
  41. //Crusor Left:
  42. var index = this.index();
  43. var symbol = this.commandSymbol(index);
  44. var value = this.getConfigValue(symbol);
  45. this.changeValue(symbol, false);
  46.  
  47.  
  48. //Default Config
  49. ConfigManager[symbol] = false; // Set to false if you want it off by default. Set it to true if you want it on by default
  50.  
  51.  
  52. //Save Config
  53. config[symbol] = ConfigManager[symbol];
  54.  
  55.  
  56. //Load Cofing
  57. ConfigManager[symbol] = !!config[symbol];
  58.  
  59. //For Variables:
  60. //In the Options Pluign:
  61. // Make Option:
  62. this.addCommand(name, symbol, enabled, ext);
  63.  
  64. //Draw Option:
  65. var rect = this.itemRectForText(index);
  66. var statusWidth = this.statusWidth();
  67. var titleWidth = rect.width - statusWidth;
  68. this.resetTextColor();
  69. this.changePaintOpacity(this.isCommandEnabled(index));
  70. this.drawOptionsName(index);
  71. this.drawOptionsOnOff(index);
  72.  
  73. //Press OK:
  74. var index = this.index();
  75. var symbol = this.commandSymbol(index);
  76. var value = this.getConfigValue(symbol);
  77. value += x; // set this to the increment you want your variable to move. ie plus 3
  78. if (value > y) { // set this to the highest value of your variable
  79. value = z; // set this to the lowest value of your variable
  80. }
  81. value = value.clamp(z, y); //set this to your lowest value of variable and highest value of your varaible
  82. this.changeValue(symbol, value);
  83.  
  84. //Crusor Right:
  85. var index = this.index();
  86. var symbol = this.commandSymbol(index);
  87. var value = this.getConfigValue(symbol);
  88. value += w; // this should be the increment you want the variable to go by constiently, ie plus 3.
  89. if(value > x){ // this should be your biggest value of the variable
  90. value = y; // this should be the smallest value of the variable
  91. }
  92. this.changeValue(symbol, value);
  93.  
  94.  
  95. //Crusor Left:
  96. var index = this.index();
  97. var symbol = this.commandSymbol(index);
  98. var value = this.getConfigValue(symbol);
  99. value -= w; // this should be the increment you want the variable to go bu constiently, ie minus 3.
  100. if(value < x){ // this should be your smallest value of the variable
  101. value = y; // this should be the biggest value of the variable
  102. }
  103. this.changeValue(symbol, value);
  104.  
  105.  
  106. //Default Config
  107. ConfigManager[symbol] = x; // Set to default value you want the variable to be
  108. //Save Config
  109. config[symbol] = ConfigManager[symbol];
  110.  
  111.  
  112. //Load Cofing
  113. var value = config[symbol];
  114. if (value !== undefined) {
  115. ConfigManager[symbol] = Number(value).clamp(y, z); //y should be the smallest number a variable can be while z should be the biggest.
  116. } else {
  117. ConfigManager[symbol] = x; // this is the same value as the default config value
  118. }
RAW Paste Data