A Performance question:
I heard that eval can slow down the game if used unwise...
So, I have this little dilemma...
I got two ways to set up my method. One uses an eval method and it takes only 2 lines to do.
The other one takes 18 lines with a case statement but without any eval method.
The method will be called every single time the player attacks or does any battle actions and the battle system in question is an ABS, so the player will be mashing buttons left and right for sure to attack the enemies...
What should be better to use?
Another question on an entirely different subject:
So, I have this note-tag grabber method:
def cooldown_bonus ary = Array.new if @note =~ /Cooldown Bonus = <(\d+[ ].*(?:\s*,\s*\d+[ ].*)*)>/i i = 0 $1.split(", ").map.each do |info| ary
= Array.new info =~ /(\d+) (.*)/i ary.push($1.to_i) # value ary.push($2.to_s.downcase) # stat i += 1 end end return ary endWhich works fine.The actual note-tag would look like this, for example:
Cooldown Bonus = <12 AGI, 5 ATK, 2 MAT, ... >So, it is an "infinite" note-tag.After the method, I get an array like this:
ary = [[12,"agi"],[5,"atk"],[2,"mat"], ... ]And this is exactly what I need.I am pretty new in making these infinite long note-tags with mixed data (meaning number and string needed from it), so I was wondering if there is an easier/shorter method of getting the data from this kind of note-tag... So... Is it? 