I'm having a SyntaxError when using scripts.

I apologise if this thread is in the wrong place. I just joined the forums.

So my issue is that I'm putting a script into an event but every time I do, the game gives me a SyntaxError when I load it.

The script is:
class Window_Message alias dsf_update_show_fast update_show_fast def update_show_fast dsf_update_show_fast if !$game_switches[11] endend

And the error is:


Sorry if the answer is painfully obvious. I just started making games.
"syntax error" simply means that you wrote a command inside the event that does not exist or that you made a typo when writing the command.

and the reason is obvious - what you wrote is not a script to be executed, it is a definition for use in a plugin or in the engine itself, it cannot be used inside a script box at all. Whereever you got it, you completely misunderstood its purpose.

I suggest you tell us what you want to do (in ingame terms), and then we tell you how to do this.

Moved to: Learning Javascript
That's Ruby, @Andar, I think this needs to be in Learning RGSS mate.
@Trihan both the "primary uses" and the screenshot point to MV however, which means that the OP didn't even get the script language correct and needs the javascript equivalent...
The script is Ruby but the error is JavaScript. My guess they found a a Ruby snippet and put it into they script command box of an event.

Edit: ninja'd 😛

Probably a misunderstanding of the script command box and the fact that Ruby files are normally called scripts.

The following is the JavaScript equivalent put it text editor save as all files with .js extension to your plugin folder. Then enable the plugin in your MV editor.
Code:
(function ($) {
var updateShowFastAlias = $.updateShowFast;
$.prototype.updateShowFast = function() {
    updateShowFastAlias.call(this, arguments);
    if ($gameSwitches.value(11) !== true){
        this._showFast = true;
    }
};
})(Window_Message);
My mistake, I missed that the error was from MV.
Ok, thanks for the help. I got the code from a friend so I'll ask him.

And I'm sorry for posting in the wrong place.
I imagine something out there could compile Ruby into Javascript, and then it's only a matter of changing the rpg var names.

KayThnxBye

Original thread: https://forums.rpgmakerweb.com/threads/im-having-a-syntaxerror-when-using-scripts.76498/