Syntax Error crash with formula involving Rand! Please Help!

I am having an issue getting a formula that uses Rand in a healing spell to work. I have no issues with Rand in any other formula. Only this one
1687453038652.png


The output txt file says

Code:
(eval):1:in `eval': (eval):1: syntax error, unexpected ')', expecting $end
b.mhp / (rand(5) + 1)) * 1.5
                      ^, SyntaxError
    from (eval):1:in `eval'
    from Game_Battler:351:in `make_damage_value'
    from Game_Battler:507:in `item_apply'
    from Yanfly cooldown:796:in `item_apply'
    from Scene_Battle:605:in `apply_item_effects'
    from Scene_Battle:597:in `invoke_item'
    from Scene_Battle:586:in `block (2 levels) in use_item'
    from Scene_Battle:586:in `times'
    from Scene_Battle:586:in `block in use_item'
    from Scene_Battle:586:in `each'
    from Scene_Battle:586:in `use_item'
    from Scene_Battle:573:in `execute_action'
    from Scene_Battle:550:in `process_action'
    from Scene_Battle:48:in `update'
    from Scene_Base:14:in `main'
    from SceneManager:22:in `run'
    from Mapshot:986:in `run'
    from Screenshot Take:167:in `run'
    from Backtrace:10:in `block in <main>'

"unexpected ')', expecting $end"

but nothing could be further from the truth! I have used "(rand(5) + 1))" in MANY formulas and it never says unexpected ) in any of those formulas.

Basically I want the formula to take the target's maximum HP, divide it by a random number 1 - 5, and then multiply the result by 1.5 and the output of that formula is how much health is recovered to the target.

This formula should work but it is failing for seemingly no reason whatsoever

Does anybody know what the problem could be?
It's exactly what it says - there's an unexpected )

You have two open parentheses and three close.

Perhaps you intended to put another open parenthesis at the very beginning, to encapsulate the entire section before "* 1.5", but the error is quite correct.
b.mhp / (rand(5) + 1) * 1.5
How TF did an extra parenthesis get in there? I literally copied and pasted from another formula without the extra parenthesis and just changed numbers. I wonder why an extra parenthesis pasted that was not there or copied. Perhaps I should have cross referenced the formula from the slot machine attack.


Do I need another open parenthesis at the start to make the formula do what I want?
AGAIN, you ignored my post.
You only need the parentheses rand requires to perform its calculation plus the parentheses that encapsulates its result and the + 1 operation. End of story.
AGAIN, you ignored my post.
You only need the parentheses rand requires to perform its calculation plus the parentheses that encapsulates its result and the + 1 operation. End of story.
Based on the length of his post and the fact that your post and his were made only 1 minute apart, it's probably reasonable to assume that he was already in the process of making his post when you posted yours, and he probably didn't see it.
Based on the length of his post and the fact that your post and his were made only 1 minute apart, it's probably reasonable to assume that he was already in the process of making his post when you posted yours, and he probably didn't see it.
Normally you would be right but he's got a record of ignoring people's feedback on purpose because he doesn't like it or refuses to believe that's what's causing the issues.

Here's another reason why you @MoltresRider should revisit all of your old threads and leave a comment stating how helpful they were or weren't for any specific reason. It tells other people that they could also find the answer to their issues right there.

Original thread: https://forums.rpgmakerweb.com/threads/syntax-error-crash-with-formula-involving-rand-please-help.158587/