Problems with script in event

Waltzer

Warper
Member
Joined
Aug 14, 2016
Messages
1
Reaction score
0
Primarily Uses
N/A
Hey there,


Im pretty new to RPG Maker and new to this forum as I only made an account to get help with this problem that i can't find a solution for anywhere. (PS sorry if this is posted in the wrong place)


So basically whenever I am adding a script to an event and I write into a new line it makes the script unusable. Pictures of whats happening may help:


When I write the script and it goes onto a new line:

cap1.PNGcap2.PNG



When I write a script and it doesn't go onto a new line:

cap3.PNGcap4.PNG



The scripts only ever work when i write it over one line because for some reason it adds extra characters where I do not when its goes over multiple. I dont know if im missing something obvious here but I i have no idea what to do. Any help would be appreciated :)
 

Andar

Veteran
Veteran
Joined
Mar 5, 2013
Messages
31,434
Reaction score
7,713
First Language
German
Primarily Uses
RMMV
1) the event command script is controlled by the Game Interpreter class, and it can only use commands that are available inside that class. you cannot call script commands unless they were given to the game interpreter. And that requires extra line in the script itself in the script editor, which is why usually all scripts list the commands they enabled for use in the events.


2) a new line usually breaks the script command, unless it is made in a way that the interpreter understands that something will follow on the next line.


This means you either have to use temporary variables to store halfway results for the next line, or be very careful where to insert manual linebreaks in a way that the interpreter understands the command continues (the automatic linebreak positions almost never work here)
 

Sixth

Veteran
Veteran
Joined
Jul 4, 2014
Messages
2,162
Reaction score
823
First Language
Hungarian
Primarily Uses
RMVXA
If you use a constant for an argument, that is really doing nothing productive as an argument at least.


The point of arguments is that they can be changed to whatever and based on them, the method returns different values.


Now, if you pass a constant as an argument, it loses it's point, so you can simply move that constant to the method itself and get rid of that argument.


That can shorten the script call you make in events as a bonus.


In any case, like Andar wrote, you must break the line in a way that the engine knows that there will be something coming on the next line.


In your example, it would look like this:


Kernel.pbReceiveItem(
PBItems::pokeBall,5)


But removing that constant from there and including it directly in the method would make that look like:


Kernel.pbReceiveItem(5)


Which is much shorter, and there is no need to needlessly copy/paste the same argument over and over again.


To make a little correction for what Andar wrote in point 1, you can use module methods from anywhere in any class/module, so you can use what you wrote from the interpreter without any issues. Methods called on global variables can also be used freely.
 

Users Who Are Viewing This Thread (Users: 0, Guests: 1)

Latest Threads

Latest Profile Posts

Don't forget, aspiring writers: Personality isn't what your characters do, it is WHY they do it.
Hello! I would like to know if there are any pluggings or any way to customize how battles look?
I was thinking that when you start the battle for it to appear the eyes of your characters and opponents sorta like Ace Attorney.
Sadly I don't know how that would be possible so I would be needing help! If you can help me in any way I would really apreciate it!
The biggest debate we need to complete on which is better, Waffles or Pancakes?
rux
How is it going? :D
Day 9 of giveaways! 8 prizes today :D

Forum statistics

Threads
106,049
Messages
1,018,547
Members
137,835
Latest member
yetisteven
Top