Lihinel

Veteran
Veteran
Joined
Nov 9, 2013
Messages
271
Reaction score
339
First Language
German
Primarily Uses
I am in the middle of reimplementing a battle system for the 4th time and I am thinking about using some eval() magic.
I know this is a big no-no when it comes to developing for the web, but since the rpgmaker itselft uses tons of eval in the objects js (and the plugins aren't encrypted anyway so anyone could just put in any malicious code anyway), it doesn't seem to be a problem.

So... any objections?

Background:
Many of the skills use have multiple conditions and side effects. I could use a lot of if/else/submethods/recursion and other ways to implement it, but it seems to be easier to use eval for some of the conditions, damage, status effect duration, and other computations. (I'd read the strings in from a json and use them in a method/scope that has variables for str, def etc. to manipulate)
 

Andar

Veteran
Veteran
Joined
Mar 5, 2013
Messages
33,909
Reaction score
8,602
First Language
German
Primarily Uses
RMMV
The problem is not eval itself, the problem is the source of the string that is eval'ed.

If you develop inside the web, there is a really high chance that someone else can send a string to be eval'ed, and construct that string in a way that it breaks your websites security structure.

However, the RM is a closed system where you are the only one entering strings to be eval'ed. So unless you're using a plugin that let's the player choose their damage formula or anything similiarly insane, there is no way that someone else can enter malcode by eval into your game.
 

Lihinel

Veteran
Veteran
Joined
Nov 9, 2013
Messages
271
Reaction score
339
First Language
German
Primarily Uses
Thanks, thats what I wanted confirmed.

I use eval on strings from a json.
If someone wants to mess with your game they could just alter the plugins or even the engines js so there doesn't seem to be any special additional danger to using eval.
 

Latest Threads

Latest Posts

Latest Profile Posts

To be released 2021/10/21
Now that I made this "What the MZ RTP is missing" spreadsheet it's itching me to fill some the gaps D:
Aaaaand I completely forgot about the RMMV Chicken Rave my brother decided to implement in a parody of my VERY FIRST UNFINISHED project. We could not escape the chicken rave... The chickens would block the ladder...
I love how I can look up a problem I'm having with my game, find a post from like six years ago that addresses the issue, and the solution provided still works in RPG Maker.
It's times like those that my life feels really easy XD
Change costumes with equipment!

Forum statistics

Threads
115,946
Messages
1,094,254
Members
151,204
Latest member
Renagade4lyfe
Top