RMMV Is it more efficient to put multiple script calls in a single command?

HankB

Veteran
Veteran
Joined
Mar 5, 2021
Messages
60
Reaction score
12
First Language
English
Primarily Uses
RMMV
For example, would this:

forumqa.png

be any more efficient or faster than this:

forumqb.png

I've been wondering about this for a while.
 

gstv87

Veteran
Veteran
Joined
Oct 20, 2015
Messages
2,420
Reaction score
1,434
First Language
Spanish
Primarily Uses
RMVXA
at structure level, it's easier to debug if you use one call per instruction.
because the debugger will point you towards "Block X, Line Y" if it finds an error, or if it can't find the line number it will simply point to the block, which is one instruction long.
also, there's the possibility of grabbing the lot of blocks themselves (they're objects, they have properties and can be worked with), and compare and operate with them... so the lighter weight they come by, the better.

me, I rather group them as much as possible so they can be skipped visually as background noise if I'm looking for something specific in the block.
and, if you happen to need to write a specific instruction that requires grabbing of other objects manually, you can't share them across blocks, they need to be used within that block.
so, *being able* to work in one single block is a plus, but not a must.... there are workarounds to that, but all depends on how much you want to complicate it.
for direct commands to plugins, in environments all well regulated and without risk of failure, use one instruction per block.
 

Restart

Veteran
Veteran
Joined
Mar 15, 2019
Messages
832
Reaction score
671
First Language
English
Primarily Uses
RMMV
In the grand scheme of thing it shouldn't make any significant difference to the computer. The real efficiency question is which one takes less devtime for you.
 

Andar

Veteran
Veteran
Joined
Mar 5, 2013
Messages
33,356
Reaction score
8,390
First Language
German
Primarily Uses
RMMV
efficiency is the wrong question, because that ignores an important fact about the script command.

The script command is encapsuled, which basically means that any data or variable that is defined inside it gets deleted as soon as the command ends.
The script calls only work because they send data to outside the script command box, which is also why they need to be predefined in the engine by either the engine itself or a full plugin.

so basically if any of your script call commands are interconnected between themselves, they have to be in the same script box.
Only completely independent commands can be handled by different script command.
 

auradev

Veteran
Veteran
Joined
Feb 11, 2021
Messages
35
Reaction score
14
First Language
German
Primarily Uses
RMMZ
For example, would this:

View attachment 191315

be any more efficient or faster than this:

View attachment 191316

I've been wondering about this for a while.
These kind of microoptimizations don't affect you in the slightest. The question I would ask is what gives better readability and is easier to modify. Personally, I prefer the second one in this case. You can add a Comment to each line explaining which event you are switching on, add new ones with a simple copy&paste and if you for some reason need to make one of them conditionally dependent you can easily integrate an if.
 

HankB

Veteran
Veteran
Joined
Mar 5, 2021
Messages
60
Reaction score
12
First Language
English
Primarily Uses
RMMV
In the grand scheme of thing it shouldn't make any significant difference to the computer. The real efficiency question is which one takes less devtime for you.

I didn't expect that it would generally make any noticeable difference performance-wise, but I'm wondering if it makes ANY difference at all. In certain specific scenarios, every frame counts, so I'm wondering if my first example gets processed faster (even if just by a single frame) than the second example.
 

Andar

Veteran
Veteran
Joined
Mar 5, 2013
Messages
33,356
Reaction score
8,390
First Language
German
Primarily Uses
RMMV
In certain specific scenarios, every frame counts, so I'm wondering if my first example gets processed faster (even if just by a single frame) than the second example.
read what I wrote above
starting and closing a script box will take some processing time exactly because of the encapsulation.

But again your problem is in another area: If you are in a way where that extremely small process does count, then you're already doing something wrong.
because anything that uses script commands AND is that time-restrictive should be transferred to a full plugin and NOT be handled by an event parallel process.
 

TheoAllen

Self-proclaimed jack of all trades
Veteran
Joined
Mar 16, 2012
Messages
6,252
Reaction score
7,649
First Language
Indonesian
Primarily Uses
RMVXA
I didn't expect that it would generally make any noticeable difference performance-wise, but I'm wondering if it makes ANY difference at all. In certain specific scenarios, every frame counts, so I'm wondering if my first example gets processed faster (even if just by a single frame) than the second example.
If you noticed ANY frame difference at all, you should look at other factors and not this one.

But to answer your question, the eval script is generally slow. You are reading a string and interpret it. Without any basis, I would say multiple eval (second example) probably slower than single eval (first example). But even with that, this should not matter such as one frame difference. Loading files, multiple processes in a loop, draw text in real-time, refresh bitmap (in real-time), and such are more demanding than just eval string.
 

Latest Threads

Latest Profile Posts

*sigh* This one turned out really well... except for the left arm pose...
fPRzKSp.jpg

Yes I purposely cutout the arm cause from the pic
A month into making my life/dating sim game and I've finally finished making all of the love interests :kaocry: I still have to make most of their emotion range and overworld sprites but aye I'm proud of myself.
would i get in trouble if i didn't take out the computer icons on my fake computer screen i had Discord, Messanger, and rpg maker up
Auto-Adjust Text Outline, Run Common Events on Transfer | RPG Maker News #111

I sweep the floor. My brother, "You didn't do a good job. There are dust bunnies everywhere." He sweeps the floor weeks later. "I just swept. Why are there dust bunnies everywhere?" Me," Guess you didn't do a good enough job."

Forum statistics

Threads
113,793
Messages
1,077,522
Members
147,837
Latest member
Fenrir_
Top