Roger Ramjet
New member
According to the function description for restore_mp() at http://wiki.kolmafia.us/index.php?title=Restore_mp
The following code, which was part of a larger script, was run.
- Return_Value is a boolean.
- Restore_To is an int indicating the MP level to be restored. It had a value of 980.
- Bale’s Universal_recovery script is used for KoLMafia’s MP restoration.
The reported result was:
Using KoLMafia's restore function.
Restoring MP! Currently at 1071 of 1174 HP, 321 of 1088 MP, current meat: 0 ... Target MP = 980.
Did not fully restore MP for some reason.
Return_Value = true.
At the time the script was run most MP restorative items were selected in KoLMafia, auto-restore was off in KoLMafia, there were no restoratives in inventory, no Meat in inventory, and no adventures available. The restore was expected to fail (the effect of that is what was being tested).
MP was not restored to the requested level (as expected), but restore_mp appears to have returned an incorrect value since MP was not at or above the specified target value when the routine finished. Based on its description, it should have returned “false”.
So, this raises some questions:
1) Did I misunderstand something?
2) Did KoLMafia return the wrong value?
3) Did Universal_recovery have something to do with the apparently incorrect return value?
4) Is the documentation incorrect?
boolean restore_mp( int target )
…
This function will do nothing and return false if you have not checked any restore items. Otherwise, this function returns true if your MP is at or equal to target when finished. If target is set above your current max MP, this function will attempt to restore to that amount and report its success based on that goal, not the number used for target.
The following code, which was part of a larger script, was run.
- Return_Value is a boolean.
- Restore_To is an int indicating the MP level to be restored. It had a value of 980.
- Bale’s Universal_recovery script is used for KoLMafia’s MP restoration.
Code:
print(“Using KoLMafia’s restore function.”, “green”);
Return_Value = restore_mp(Restore_To);
print("Return_Value = " + Return_Value + ".");
The reported result was:
Using KoLMafia's restore function.
Restoring MP! Currently at 1071 of 1174 HP, 321 of 1088 MP, current meat: 0 ... Target MP = 980.
Did not fully restore MP for some reason.
Return_Value = true.
At the time the script was run most MP restorative items were selected in KoLMafia, auto-restore was off in KoLMafia, there were no restoratives in inventory, no Meat in inventory, and no adventures available. The restore was expected to fail (the effect of that is what was being tested).
MP was not restored to the requested level (as expected), but restore_mp appears to have returned an incorrect value since MP was not at or above the specified target value when the routine finished. Based on its description, it should have returned “false”.
So, this raises some questions:
1) Did I misunderstand something?
2) Did KoLMafia return the wrong value?
3) Did Universal_recovery have something to do with the apparently incorrect return value?
4) Is the documentation incorrect?