Save-Point
When NOT to Use a Script - Printable Version

+- Save-Point (https://www.save-point.org)
+-- Forum: Games Development (https://www.save-point.org/forum-4.html)
+--- Forum: Tutorials (https://www.save-point.org/forum-19.html)
+--- Thread: When NOT to Use a Script (/thread-8418.html)



When NOT to Use a Script - kyonides - 12-10-2021

When NOT to Use a Script

There are times when scripters have to admit there is no actual reason to rely upon a script to do the hard work for you or the game developer. I will now teach you how to realize it is better to use existing stuff instead of innovating by crafting some script or editing a given method.

For instance there was a guy on another forum asking for a way to display a custom text message on screen via script call. He practically wanted to get the fastest method out there to achieve his goal.

In RMXP it would look like the following:

Code:
$game_temp.message_text = "Some text"

Good, now he knows how to set messages programmatically. Grinning

Police Not so fast!

Even if that line might work out of the box, it doesn't mean it'd always be the most highly convenient manner to display it.

In his case we learned after some time that he intended to do it whenever a specific hero class was afflicted by some specific state. He had altered the state_plus method in the process by editing the original method, something we scripters consider it's a terrible practice indeed.

What I am going to explain in a moment is valid not just for states but also in many other use cases. Detective 

The Issues That Will Arise Sooner or Later PC 

First of all, you need to alter a method that isn't very modular at all. This means that future scripts or even existing scripts could overwrite it at any given time, preventing you from either setting the text message or getting any other additional effects the other scripts had to offer.

Second you can actually achieve the same goal via a Common Event by setting the one to be called by a skill or item at any given time during gameplay.

Third on the Common Events tab you can simply pick a common event and open a Show Text command and edit it at will and press F2 and see how it would look like ingame. It's impossible to view it while editing the method.

My Advice Mad Scientist 

So my serious recommendation is to leave the original method unaltered and go set a common event either at the Skill or Item database. Then you can edit the common event's Show Text command as many times as needed and you will be always able to fix anything that is wrong there.