Editable Fix Character Values Buttons

==Editable Fix Character Values Buttons==
by @mike_the_monk
=== Summary ===
This script expands upon the previous three, allowing you to edit the custom reward buttons once created so you can change what each of them does. Any sort of customization for Habitica should be to help you stay motivated to do your real-life tasks, and what's motivating for you might change as time goes on. 
An example use of this script is creating a Super Health Potion that costs 50 GP and heals up to 40 HP. You can edit the notes section of one of the buttons to read GP: -50; HP: +40; and then every time you click the button, it does exactly that. But maybe later on, you have much more gold and are a higher level, and want to make it more expensive. Click the button then edit the notes section to now read GP: -75; HP: +40; so it now costs 75 GP to heal 40 HP. Maybe even later you want to change it so it costs 30% of your GP (whatever it is), so you can edit the notes section to read GP: -30%; HP: +40;.
That gives you some idea of the many things you can do with these editable Fix Character Values buttons. You can create up to five buttons and name them whatever you want, and edit the notes section to change what they do. You are able to affect HP, XP, MP, and GP, you can add to or subtract from those values, and it can be a number or a percent.
Happy customizing!
----
==== Correct formatting ====
The notes section must be formatted in a certain way in order to work correctly, otherwise you will get an error message (as a private message) from the script. Review the section below to make sure it's formatted correctly. If you're still stuck after reading the section below, please contact the author of this script and he will be glad to help you out.
Here is the proper format:
* Start with the value you want to change, immediately followed by a colon (no space in between). So, the options are HP: and XP: and MP: and GP: and these must be capitalized. If they are not capitalized, the script will not recognize them and will do nothing with that stat value, so if you are expecting one of those four values to change but it does not change when you click the button, one thing to check is capitalization. This one will not result in an error message, you will have to check it manually.
* Next, if you want to increase that value, put a +. If you want to decrease that value, put a -. It doesn't matter if you put spaces before or after these, the script will know what you are talking about. Not including a + or a - will result in an error.
* Next, put the number you want to increase or decrease that value by. If you want to increase or decrease by a percent, include a % right after the number. if you enter something other than a number here, you will get an error.
**If you are decreasing by non-percent, this is treated as if those stats are a cost that needs to be paid, much like an MP cost for skill or a GP cost for a potion. If you don't have enough of the relevant stat, the code won't run and you will get an error message. For example, if your button reads HP: -25; XP: +1000; GP: -300; , you are treating this button as if there is an HP and a GP cost, and once you pay those, you gain XP. But, if you only have 24 HP and 250 GP, both of which are insufficient, you'll get a message that tells you you have insufficient HP and GP, and you won't gain any XP.
**If you are decreasing by a percent and accidentally enter a percentage beyond 100 (for example, XP: -105%;), the code will run as if you did -100% and thus bring it down to zero. Conceptually, when decreasing by 100%, you're telling the script "get rid of all of my GP (or HP, or XP, or MP)", which is different than decreasing by a non-percent.
**If you are increasing by a percent, it will increase based on the current value rather than the maximum value. For example, HP: +100%; will double your current HP, not fill you to full. If you want to fill HP to full, do HP: +50; , that will fill you to full matter what your current HP is, and the script won't let you go above 50 HP.
* Finally, end with a ;. If you don't include a semicolon, the script won't know where this section ends and will give you an error.
* You can include all four values to change (HP, XP, MP, and GP) or as few as you want, making sure to start each with the value followed by a colon (for example HP:) and ending with a ;. The order in which you include them does not matter, the script will be able to read it. If there is a value that you don't want to use (for example, you don't want to affect GP), you can delete it section entirely or you can leave it as +0.
For example, if you want a "wipeout" button that removes all of your XP and GP, and removes half of your HP and MP, you could write it as XP: -100%; GP: -100%; HP: -50%; MP: -50%;. If at a later time you decided you wanted the button to do something different, simply edit the notes section of the button.
Another example is a combined Mana and Experience potion that costs 50 GP while giving you 30 MP and 150 XP. You could write that as GP: -50; MP: +30; XP: +150;
Hopefully these examples and the bullet points above show you how to format the notes section of the custom buttons. If you are able to click the button and it does everything you think it's supposed to do (and you don't get an error message), then it's working. Otherwise, revisit this section and revise it until it works, and if you're stuck, you can always contact the author of this script.
==== Code ====
*https://raw.githubusercontent.com/mike-the-monk/Habitica-customizations/main/Automated%20FCV%20scripts/Editable%20Fix%20Character%20Values%20buttons
==== Required Customizations ====
NUMBER_OF_BUTTONS tells the script how many editable buttons to create. You can make up to 5 buttons. The default is 2.
==== Optional Customizations ====
You can name these buttons if you want, or keep the generic names "Editable Button 1", "Editable Button 2", etc.
*BUTTON_1_TEXT is the title of Button 1
*BUTTON_2_TEXT is the title of Button 2
*BUTTON_3_TEXT is the title of Button 3
*BUTTON_4_TEXT is the title of Button 4
*BUTTON_5_TEXT is the title of Button 5
----
=== Credits and Acknowledgments ===
* This wiki page, especially the section on custom rules, for giving the idea of how to use Fix Character Values to create custom skills.
* @EugeneG for giving the original idea of editing the notes section of the buttons to change what it does
Category:Extensions, Add-Ons, and Customizations
zh:可编辑的修复角色数值按钮