When NOT to Use a Script
#1
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.
"For God has not destined us for wrath, but for obtaining salvation through our Lord Jesus Christ," 1 Thessalonians 5:9

Maranatha!

The Internet might be either your friend or enemy. It just depends on whether or not she has a bad hair day.

[Image: SP1-Scripter.png]
[Image: SP1-Writer.png]
[Image: SP1-Poet.png]
[Image: SP1-PixelArtist.png]
[Image: SP1-Reporter.png]

My Original Stories (available in English and Spanish)

List of Compiled Binary Executables I have published...
HiddenChest & Roole

Give me a free copy of your completed game if you include at least 3 of my scripts! Laughing + Tongue sticking out

Just some scripts I've already published on the board...
KyoGemBoost XP VX & ACE, RandomEnkounters XP, KSkillShop XP, Kolloseum States XP, KEvents XP, KScenario XP & Gosu, KyoPrizeShop XP Mangostan, Kuests XP, KyoDiscounts XP VX, ACE & MV, KChest XP VX & ACE 2016, KTelePort XP, KSkillMax XP & VX & ACE, Gem Roulette XP VX & VX Ace, KRespawnPoint XP, VX & VX Ace, GiveAway XP VX & ACE, Klearance XP VX & ACE, KUnits XP VX, ACE & Gosu 2017, KLevel XP, KRumors XP & ACE, KMonsterPals XP VX & ACE, KStatsRefill XP VX & ACE, KLotto XP VX & ACE, KItemDesc XP & VX, KPocket XP & VX, OpenChest XP VX & ACE
Reply }


Possibly Related Threads…
Thread Author Replies Views Last Post
   RPG Developer Bakin: Material Albedo (with C# script) JayRay 0 1,461 01-19-2023, 04:59 AM
Last Post: JayRay
   Script Writing and Usage: A canine perspective DerVVulfman 0 4,134 09-27-2019, 05:03 AM
Last Post: DerVVulfman
   Proper Script Placement and Usage for RGSS 1 through 3 kyonides 1 3,964 08-25-2019, 08:36 AM
Last Post: kyonides
   RMVX Ace Script Call Eventing Procedures. JayRay 0 7,550 10-26-2013, 08:25 PM
Last Post: JayRay



Users browsing this thread: 2 Guest(s)