Convert element_rate(element_id) [RMXP] [solved]

In Game_Enemy you can find the method to define element_rate:

Code:
def element_rate(element_id)
    # Get a numerical value corresponding to element effectiveness
    table = [0,200,150,100,50,0,-100]
    result = table[$data_enemies[@enemy_id].element_ranks[element_id]]
    # If protected by state, this element is reduced by half
    for i in @states
      if $data_states[i].guard_element_set.include?(element_id)
        result /= 2
      end
    end
    # End Method
    return result
  end

What I am trying to do is to change the Numbers in the Table to either

  1. Letters corresponding to the Editor (A, B, C, etc.)
  2. Text that spells "Very Effective, Effective, Neutral, etc.)

Now I am calling this via script to show the element efficiency:

Code:
$game_variables[x] = $game_troop.enemies[y].element_rate(z)

Where as "X" is a variable, "Y" is the enemy in the troop and "Z" the ID of the Element.

This get's a text output a la "\v[X]%" at the moment which for example outputs "100%"

Where do I start to change tables into text? the table is needed for the calculation in general if I read everything right
What I am trying to do is to change the Numbers in the Table to either
you can't - the numbers are needed for the calculations.

what you would have to do is define a string array with the texts you want, and then use eithger the number array or the text array depending on what you want to do, with the numbers for the calculations and the texts for the display.
you can't - the numbers are needed for the calculations.

what you would have to do is define a string array with the texts you want, and then use eithger the number array or the text array depending on what you want to do, with the numbers for the calculations and the texts for the display.

That makes sense and that helped me a lot.

I made basically a copy and renamed it to element_rate_text, swapped the numbers for text and removed the "for i in @states" and called the script

Code:
$game_variables[x] = $game_troop.enemies[y].element_rate_text(z)

Works like a charm. Thank you for the spark.

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/convert-element_rate-element_id-rmxp-solved.168416/