Damage calculation in ability descriptions

The script is very simple and does not support multiple evals, nested evals, or anything beyond a single statement.

It also doesn't support multiple convert codes within the same message.

I have no solution for that.

EDIT:

actually I just updated the script with something that might work.

The syntax is now

\eval{< YOUR FORMULA HERE >}Note the special delimiters.Still does not allow you to say something like

\eval{< \eval{< something }> }>But at least you can say

Code:
\eval{< first formula >} - \eval{< second formula }>
Obviously this is just a big hack to get things to work, but regular expressions are too limited to support bracket matching. These codes were never to meant to be anything complicated, with nested variables like

Code:
\n[\v[\v[3]]]
being the most complex kind of code nesting that you'd probably use (and even that doesn't work properly)The thing is evaluated recursively though, which is kind of interesting.
Works great! I put in:

Deals \eval{<(($game_actors[1].mat*1.8+17)*0.8).to_i>} to \eval{<(($game_actors[1].mat*1.8+17)*1.2).to_i>} holy damage to a single enemy.
Deals additional 2% max HP over 2 turns.

And this is the result:

M8mnDvG.png


Thank you very much Tsukihime and Engr. Adiktuzmiko, this is exactly what I was hoping for. You've been a big help.
Seems to be working for me.

The script is just

class Window_Base < Window alias :th_convert_code_eval_convert_escape_characters :convert_escape_characters def convert_escape_characters(text) result = th_convert_code_eval_convert_escape_characters(text) result.gsub!(/\eEVAL{<(.*?)>}/i) { eval_convert_code($1) } result end def eval_convert_code(formula, p=$game_party, t=$game_troop, s=$game_switches, v=$game_variables) eval(formula) endendThe reason why the thing is on separate lines is because the engine doesn't automatically re-calculate the position of the text after replacement.You need a word-wrapping script to go and re-structure your message.
Yeah, when I originally deleted the old script and put in the new one, it wasn't working right - but I deleted it again and put in the new one again, and it seemed to work just fine. I edited my post to show everything's working great.

I tried a word-wrapping script once, but I found it tended to mess with certain things I wanted my message windows to do. I just manually check all the line edges with everything. You can see in the screenshot that it displays perfectly now.
This thread is being closed, due to being solved. If for some reason you would like this thread re-opened, please report this post and leave a message why. Thank you.

Original thread: https://forums.rpgmakerweb.com/threads/damage-calculation-in-ability-descriptions.25736/