Storing Formulas in unicode/non-latin characters

I was wondering if, in order to streamline formulas for damage and custom objects, if its ok to store the value of a formula in a unicode character (like Japanese kanji or Greek letters). For example say i want to add a formula modifier that is exclusive to fire element skills, I want to know if its possible to store the modifier like so:

火 = (v[3]%v[1])+(2*a.mat)that way when I have a fire element skill instead of having to write all of that every single time, i could just plug it in as part of the formula (this is just an example though)

I wasn't sure if this went here or in RGSS3 so if its in the wrong place its ok to move it.
I think not.

Although Ruby was made in Japan, I think it does not support naming variables after japanese characters, because it would be very questionable what would happen on the lower level of the computer...

How would the larger formula look like?

Why don't you simply use q, p or even zhnj.

(I know, I would also very like that I could name my variables šerpa and turšija, but it's not how things work...)
It would be the basic damage formula plus a situational modifier. I wanted to see if i could simply narrow it down to one character. Though trying to test it out, i came up with a new problem, how do i bind a formula to a character in the first place? Its not working for me
If I understood correctly, 'binding a formula to the character' can be done like :

class Game_Character < Game_CharacterBase
# A simple formula that returns character's HP divided by 100.


def your_formula_method


return @hp / 100


end


end
so would that work (with my example) like

Code:
class Game_Character < Game_CharacterBase  def Mf   return (v[3]%v[1])+(2*a.mat)   endend
Not really.

First, you need to have you v[] array defined.

What is v[]?

Next, you don't use a.mat, you use @mat.

Next, this is just a one-character formula, so you might want to define your formula as "myformula" in Game_Character, but in the damage formula you should put "a.myformula - b.myformula" or something like that.
I tried to plug this in

245fb2435e8d33e4c6ad8d3a7902a481.png


but no matter what, the enemy still takes no damage, what am i doing wrong?

Edit, also here it is in context

0532ed5c38489f7d186f0e1fe4666a27.png
Of course it takes no damage, because internal error happened, that means your Mf formula is wrong. What is your damage formula and try replacing v with $game_variables.
I wonder what is the problem. I plug the formula directly into the damage formula and it works (though i had ot replace modulus with multiply), but trying to call it from script and it fails.

If i can't make it work, i think i'll just save the formula tidbit in a file and just copy paste it.
Read my answer above...

Could it be simpler than that?

What's the point of asking when you don't read other answers?!?!?
I read the answer, but it still gives me the same result of no damage, no matter how many times and ways i move numbers around.
I tried to plug this in


245fb2435e8d33e4c6ad8d3a7902a481.png



but no matter what, the enemy still takes no damage, what am i doing wrong?


Edit, also here it is in context


0532ed5c38489f7d186f0e1fe4666a27.png
If that is your exact code, it's not going to work, because you don't have the change to game variables happening within a class or method. It will run that as soon as you launch the game - in fact I'm surprised it doesn't crash because those variables are undefined.


Also, v is not an attribute of Game_Character. It is used only in the damage formula.


a is a Game_Battler, not a Game_Character.


You need to spend more time looking at what classes are used during a battle, or rather what classes use the damage formula. And make sure your changes are made within class methods, and within the correct ones.
Oops, I forgot...

I wasn't testing this code so, you may want something like this :

Code:
class Game_Battler < Game_BattlerBase  def Mf    return ($game_variables[3] % $game_variables[1]) + (2 * @mat)  endend
I still can't get it to work. I don't get it...
If you do a script call (do not edit it in a script!) to this :

Code:
puts $game_actors[1].Mf
Look carefully at the console, and tell us what you see. If you encounter an error, tell us the error, but if you don't and damage is still 0, then something in your formula is wrong...
Nothing is showing up in the console. I think i may have to look into the scripting tutorials again before i come back to this
I think not.

Although Ruby was made in Japan, I think it does not support naming variables after japanese characters, because it would be very questionable what would happen on the lower level of the computer...
Nah, Ruby is fine with it.

Also:

Code:
​='hello world'puts ​
Just saying, there is no such thing as '@mat' in Game_Battler, nor in it's superclass, nor in Game_Actor/Game_Enemy.


You use 'mat' for that if you must, or 'param(4)'. 'mat' is a method defined in Game_Battler, not an instance variable.


Another thing to mention...


If your $game_variable[1] is 0, you will get a nice 'DividedByZero' error, so make sure to add a zero check for that part in your custom method as well.
Oh, yeah... I didn't check any of this code, again, so I *think* this will work :

Code:
class Game_Battler < Game_BattlerBase  def Mf    return ($game_variables[3] % $game_variables[1]) + (2 * mat)  endend

Original thread: https://forums.rpgmakerweb.com/threads/storing-formulas-in-unicode-non-latin-characters.45691/