Script won't work when I start a test game :(

● ARCHIVED · READ-ONLY
Started by zon3y 6 posts View original ↗
  1. Hey there,

    for hours I try to make my first own, useless script. 

    For this I used the example script out of the forum and tried to modify this for different functions. 

    Now I am at an angry point because my script won't load - It's same how I change the values and it's same what I wrote in, the only thing the works is "alert("text)".. 

     

    /* * @plugindesc Plugindesc * @author Autor * * @param Keine Parameter * @desc Kurzer Parameter * @default Default Value */ // Erste Funktion zur Deklarierung des Scripts (function() { var parameters = PluginManager.parameters('test'); var Scene_Title_Skipfade = Scene_Title.prototype.commandNewGame; Scene_Title.prototype.commandNewGame = function() { DataManager.setupNewGame(); this._commandWindow.close(); SceneManager.goto(Scene_Map); } })In the tutorial document I've readed that I can use any function or class and can change it how I want. 
    Also I tried to skip the fading effect right after starting a new game. 

    In the rpg_scenes.js I saw these:

     

    Scene_Title.prototype.commandNewGame = function() { DataManager.setupNewGame(); this._commandWindow.close(); this.fadeOutAll(); SceneManager.goto(Scene_Map);};When I delete the "this.fadeOutAll();" in the rpg_scenes.js it will skipping the fading but when I activate my own script it will do nothing.. really NOTHING. 


    After hours I tried to copy the original tutorial script word for word (no copy paste) to my own JS-File and the same thing happens again: NOTHING happens. -.-
    I noticed that the description of my JS is missing too, in the tutorial script it works fine. :(



    Can someone explain what I do wrong?


    Here's the link to the tutorial script: LINK


     
  2. I wonder if, you, missing the immediate invocation could cause the problem.

    So RMMV help asks us to wrap all our plugins in immediately invoked functions:

    (function() { ...code... })();

    The code you posted doesn't have that (); at the end...  which is important in automatically introducing your code to the global scope.

    it's a CALL, which calls your function right away after it's declared.
  3. Oh my god... thank you very, very much. I haven't see this because their is a }) at the end of the code and I tought this is the right one :D
    Now it work's fine :)


    But what is when I want to draw text after a game started. For example I will show "Hello World" on screen when I can interact for my player, 
    do I have to use the (); too or how can I start the script then?
  4. Hi, could you please edit your post (use full editor) and give it a meaningful title?  That'll help us keep the forum more organized and reduce confusion.  Thanks :)
  5. Shaz said:
    Hi, could you please edit your post (use full editor) and give it a meaningful title?  That'll help us keep the forum more organized and reduce confusion.  Thanks :)
    Better? :)
  6. zon3y said:
    Oh my god... thank you very, very much. I haven't see this because their is a }) at the end of the code and I tought this is the right one :D

    Now it work's fine :)

    But what is when I want to draw text after a game started. For example I will show "Hello World" on screen when I can interact for my player, 

    do I have to use the (); too or how can I start the script then?
    What's important is that you understand how it works. The (); is a function call, do not forget that.

    zon3yFunction()  <---- this is you calling/starting your function
    Code:
    (function() { zon3yFunction() })()    <---- this is you introducing (again, calling) your plugin to RMMV, which is calling your function
    You REALLY have to keep going and learn Javascript man, you'll have fun.

    Ahhh, what you want to do was actually my first go at testing how the scripting works in RMMV.

    First I went into the RMMV Master Script Call list. This is where the usual "snippets" and examples of how variables and methods are used.

    Then I tried using this:

    $gameMessage.setFaceImage('Actor1',0)$gameMessage.setBackground(1)$gameMessage.setPositionType(1)$gameMessage.add("Show Text Script Call")And viola, it shows a message popup with the main hero's face (setFaceImage function).

    Anyway, for your plugin it would be like this:

    Code:
     (function() {  	var parameters = PluginManager.parameters('test'); 	var Scene_Title_Skipfade = Scene_Title.prototype.commandNewGame;		Scene_Title.prototype.commandNewGame = function() {		DataManager.setupNewGame();		this._commandWindow.close();		SceneManager.goto(Scene_Map);                $gameMessage.setFaceImage('Actor1',0);                $gameMessage.setBackground(1);                $gameMessage.setPositionType(1);                                // this is where you add your text. Note that this approach isn't really a good idea.                $gameMessage.add("HELLO WORLD!");	}	})();