Jump to content
Sign in to follow this  
  • entries
    8
  • comments
    59
  • views
    7,117

Eventing 'vs.' Scripting

Tarq

1,460 views

Hey RMers,

 

I was motivated to write this post and drudge up this old argument after viewing some script requests on the forum that ask, starry-eyed, for something to be done better via scripting than it could be done via eventing.

And, in some regards, this is not inaccurate view; scripting can be infinitely more flexible. However, something made via scripting is not inherently better than an evented counterpart and the reason is because scripting and eventing are the same thing; events are not a separate entity, they are predefined methods that have been given a user interface. One way that may help to express the relationship between events and scripting is to think of a big box (scripting) with a smaller box inside (eventing); both boxes have an identical purpose however one is able to carry a heavier load than the other.

 

There's an impressive history of complex systems being evented; menus, battle systems, minigames. Whether such systems would have been better off being scripted is its own question but the end result is what matters. The only time you need to use scripting, the only time scripting is objectively 'better', is when some aspect of the system simply cannot be done via eventing. And these situations do arise due to eventing's limited functionality and their methods can carry associated baggage (like a text box's system interruption) but quite a few posts that 'need' scripts to accomplish something, well, don't; all that is necessary is to comb through the existing methods of the editor and how they interact with one another.

 

So far this may sound like a very pro-eventing post and, in some regards, it is; in that I would like to elevate the attitude towards events and dissolve the sheen of scripting. Being overly dedicated to eventing has its own problems though. Ignoring its objective limitations (and again, they irrefutably are limited) even the UI of eventing is tedious. Viewing a series of nested conditionals is unpleasant, editing one can be a nightmare. Simple tasks like creating a variable or setting a co-ordinate can feel like they take a lifetime. Bugfixes are tedious because the engine won't crash and give an error message (that's kind of a point in its favour as well though). Eventing is the introduction, its something you are intended to progress from, no other engine I've used doesn't just drop you in front of a script editor. However, that doesn't make the logic that events are capable of carrying out any lesser.

 

 

What I'm trying to convey is scripting is great but events are just scripting in disguise and are also great. The next time you can't figure something out with events and you aren't comfortable with scripting yet then try approaching it a different way with events. Then try another way with events. Then maybe re-evaluating what exactly you want out of the system. Then, before asking for helpy, try eventing one more time. You'll be surprised what you can accomplish without ever opening the script editor (and you may be devastated at the reality if you continue to treat scripting as some magical shortcut to complex systems).

  • Like 4


7 Comments


Recommended Comments

 

 

 they are predefined methods that have been given a user interface

Macros, ftw! =D I have no talent whatsoever when it comes to scripting so I always try to find a way to do something with events before posting a request. A surprising amount of stuff can be done via just events. The one exception is the battle system. It's very limited in what you can do, and has a couple bugs on top of it. A decent chunk of the scripts I have are to create a better system. 

 

Anti-lag, too. No event to alleviate that. Only cause more. =)

Share this comment


Link to comment

Yeah, macros is a good way to describe them. Its a little embarrassing I hadn't made the connection given the amount of time I spend in Excel at work.

I don't think asking for help is a bad thing (particularly for the external reason that the forum benefits from the activity). The problem is that too often people can fail to event something and exclaim 'oh, must need scripting!' (sure, I'm strawmanning but I'm not aiming to hurt anyone's feelings here). And part of the reason that such a person could jump to this conclusion is from making an erroneous distinction between the two (or an erroneous understanding of the distinction at least).

 

A lot of things do need scripts, or can be beneficially augmented with scripts, and I'm not saying people should only use events; I'd be a hypocrite to say that. A lot of functionality that doesn't exist in the eventing editor does exist in the script editor and some areas are substantially easier to access and adjust through the script editor (then ofc, the user has the freedom to create things like methods and classes in the script editor).

What I'm trying, and failing, to communicate is that systems are created with nothing except logic, and which version of the editor that is used to execute that logic can (often!) be a secondary consideration for systems that are not overtly complex or use existing classes; to give a very basic example, functionally there's almost no difference between me using a global variable that I've defined in the script editor or clicking through the events tabs for 'Control Variables'.

Share this comment


Link to comment

I fully agree, eventing has more power than people think, especially when it comes to new developers. My entire town building system, which is done in real time and without lag, uses only eventing. To fully understand both its potential and limits, open up the variable section and see for yourself how many different things eventing can keep track of.

 

Can it do everything? No. But can it do more than most people believe? Yes.

Share this comment


Link to comment

If I had any skill at scripting, I'd probably have made a few or edited existing ones instead of requesting. Probably too lazy to make a whole battle system though so I'm glad there's a bunch of those out there. 

 

 

 

 to give a very basic example, functionally there's almost no difference between me using a global variable that I've defined in the script editor or clicking through the events tabs for 'Control Variables'.

Events are a better, more efficient way to do simple things like this. Who wants to type out the code to transfer the player to another map when you can just click a few buttons (and see the map you're transferring to)?

Share this comment


Link to comment

Events are a better, more efficient way to do simple things like this.

 

Well, idk about better. I think that comes down to personal taste (I often do still script the simplest of things but I'm one of those guys who prefers to use the keyboard over the mouse for just about everything).But you can use both and when you do anything you're basically doing both anyways; to follow on from the previous example, when you use the 'Control Variables' button anything you do is literally translated as '$game_variables[x] = ......' (or multiplying or whatever). You're still scripting even when you're eventing, dig? ;)

And this is why its super weird for me to see people say they can't script or that something will magically be better if done via scripting. The greater flexibility is undeniably available with 'real' scripting, however, RM's choice of events (co-ordinates, variables, conditionals) provides the breathing room to accomplish a great deal. And even with all the fancy syntax at a 'real' scripters disposal I'll eat my own hat if you show me a script without a humble if statement (conditional branch).

Share this comment


Link to comment

While I agree that eventing can be pretty flexible, I don't necessarily agree with the idea that scripting and eventing are both two different approaches to the same problem. It's like saying that two computer languages are equivalent because they are both Turing complete. But there is still a world of difference between, say, C/C++ and Brainfuck even if an interpreter for the later can be written in C/C++ pretty easily.

 

Eventing has it's place to be sure. I am not saying using the event system is something that must be avoided at all costs or anything. I am just saying there are numerous tasks, many of them very simple ones, that you just can't do in any sane way using pure events. For many basic calculations and interactions sure, but if you are making complex menus, battle systems, or minigames you are probably going to smack right into a brick wall before you get that far. Sure you can write a lot of them using only events, the question is if you should.

 

The corollary to this though is that since you can embed little scripts in events (and with some fiddling call events with scripts), it makes mixing them together enormously more useful then simply using one or the other. Need to do some kind of complex calculation for some event? Use the events script command or a script style conditional. Need to have a event do something unusual while moving around? Put a script in it's move route. Need a script to trigger some special cutscene or event, such as some sort of death animation or other interaction? Add a page that never gets used to an event or make a common event and then have the script make a Game_Interpreter object run it.

 

Let it never be said that I don't find eventing incredibly useful, but it's more useful I feel if you are also using scripting. In the unfinished 'Samhain' game I started a few years ago for example, I heavily heavily used events in very weird ways. I had skills used in battle that mostly end up calling event pages, shared NPC events, and lots of events called special methods to do things. Events are very useful even to people who know scripting in and out like me. I just think they are a tool that has their place.

  • Like 2

Share this comment


Link to comment
×
Top ArrowTop Arrow Highlighted