SRD Plugin Command Eval Bug

RespectWomen

Acoustic Child
Veteran
Joined
Apr 24, 2018
Messages
57
Reaction score
14
First Language
English
Primarily Uses
RMMV
For some reason this script doesn't work when the commands are run from a common event or any parallel event, only the one player activated, It will still run the command but not update the code so you get the same result every time. Does anyone have any idea how to fix?


Script: http://sumrndm.site/plugin-command-eval/
 

Shaz

Veteran
Veteran
Joined
Mar 2, 2012
Messages
40,070
Reaction score
13,690
First Language
English
Primarily Uses
RMMV
I don't see anything in the plugin that would make that happen.

What is the command you're trying to run?

Where is this plugin in the list of plugins? Can you give a screenshot of your plugin manager, showing the position of this plugin at least in relation to the one that runs the command you're trying to run?
 
Last edited:

Poryg

Dark Lord of the Castle of Javascreeps
Veteran
Joined
Mar 23, 2017
Messages
4,125
Reaction score
10,639
First Language
Czech
Primarily Uses
RMMV
And what is the code you're testing trying to achieve?
 

Andar

Veteran
Veteran
Joined
Mar 5, 2013
Messages
31,279
Reaction score
7,635
First Language
German
Primarily Uses
RMMV
one warning though:
SMD has not been active for some time, and a few of his plugins have been confirmed as incompatible to 1.6.1 core.
some of his plugins work fine with the latest version but not all - so it is important that you give us the core version of your project as well. (not the editor version - that is something different. Open the project's rpg_core.js file with a text editor to check the core version at the end of its title line)
 

RespectWomen

Acoustic Child
Veteran
Joined
Apr 24, 2018
Messages
57
Reaction score
14
First Language
English
Primarily Uses
RMMV
These are the plugins in play and how they are ordered:

I've tried it in all sorts of orders and get the same result and someone else has had the error on an empty project.

This is the command I ran:


What I'm doing is storing the event.id in variable 20 and then running that command through a common event. The first event will do it correctly and the 2nd event will run the command again without changing the variable while the variable is actually still changing. ( I had both events read the variable before running the command.)

Then I tested the same command done on two events from the actual event page and both could run the command without the error.
I thought it was a problem with common events but I tested the command from a parallel event and got the same effect. Seems it only correctly updates if ran from the target event.

My version is 1.5.1
 

Poryg

Dark Lord of the Castle of Javascreeps
Veteran
Joined
Mar 23, 2017
Messages
4,125
Reaction score
10,639
First Language
Czech
Primarily Uses
RMMV
No wonder it happens. Parallel means parallel. You need to issue wait commands if you want to have correct timing.
 

RespectWomen

Acoustic Child
Veteran
Joined
Apr 24, 2018
Messages
57
Reaction score
14
First Language
English
Primarily Uses
RMMV
Theres a 60 frame wait for the parallel one, and still doesn't explain the common events doing it.
 

Andar

Veteran
Veteran
Joined
Mar 5, 2013
Messages
31,279
Reaction score
7,635
First Language
German
Primarily Uses
RMMV
give a screenshot of the common event, and tell us how that event is started.
 

RespectWomen

Acoustic Child
Veteran
Joined
Apr 24, 2018
Messages
57
Reaction score
14
First Language
English
Primarily Uses
RMMV
Heres our common event:



I created 2 events with only that common event.

Event 1: works as intended




Event 2: Plugin command effects event 1 again because the variable doesnt update for the script:
 

Andar

Veteran
Veteran
Joined
Mar 5, 2013
Messages
31,279
Reaction score
7,635
First Language
German
Primarily Uses
RMMV
you haven't answered my questions
How is that common event called or triggered?
And nothing in that common event even contains the line with the command that has the problem.

Screenshots of map or game are absolutely useless, we need to see the commands you're using.
 

RespectWomen

Acoustic Child
Veteran
Joined
Apr 24, 2018
Messages
57
Reaction score
14
First Language
English
Primarily Uses
RMMV
The specific command is unimportant, all commands are working. the eval part is where it stops working, The common event is triggered by the action button from an event page.

No matter what the rest of the command is, the eval will only work correctly once from a common event, which is what I was showing.

 

Andar

Veteran
Veteran
Joined
Mar 5, 2013
Messages
31,279
Reaction score
7,635
First Language
German
Primarily Uses
RMMV
OK, for the last time - if you still refuse to answer our question after that then I'll be out of here and you can see how you solve your problem alone.

HOW IS THAT EVENT CALLED OR TRIGGERED???

An event is more than just its command, it's properties and especially how it is triggered are as important as anything else.
And for several times you've now been asked to show us exactly that, but you always cut away or refuse to show that part of your events.
You have not shown us how the common event "interact" is triggered - nothing in the command sequence you placed above does that. And the command sequence above is useless as well because you cut away anything that shows us its properties or how you call or trigger it as well.

EDIT:
Just in a hope to make you understand why this info is extremely important no matter how often you pretend it doesn't:
"this", especially in combination with an event, has different results depending on how the event is called. Using it inside a common event that is called by a map event it takes the ID of the map event. If the common event is triggered by another way, that is NOT guaranteed to happen but depends on what other way things are programmed to do, especially if the trigger goes through other plugins.
And we need to find out if your command fails because "this._eventID" is not even defined in the trigger sequence you're using.
 
Last edited:

RespectWomen

Acoustic Child
Veteran
Joined
Apr 24, 2018
Messages
57
Reaction score
14
First Language
English
Primarily Uses
RMMV
Am I missing something or have I not already posted that??








 

Andar

Veteran
Veteran
Joined
Mar 5, 2013
Messages
31,279
Reaction score
7,635
First Language
German
Primarily Uses
RMMV
Trigger = none means that this common event will never happen unless the common event is called by something else - and that can happen in different ways, either a skill or a map event or a script command or a plugin.
And you never posted the final screenshot that tells us that the common event is indeed called by a map event and not by something else - and that the map event has the trigger action button, which makes the action button the trigger for the common event.

I assume that both events use the same structure with exactly the same call and one works while the other doesn't? Or is there a difference? Because with a direct call the ID should have been transferred correctly as far as I know.

Two other questions:
1) have you tried placing the eval plugin at the top of the plugin lists and then try again with a new game? It is important to start a new game after changing anything in the plugin manager because part of that data gets stored into savefiles, making saved games problematic after plugin changes.
2) is there a reason why you're using full javascript for the variables when even SRD in his example used the textcode abbreviation? have you tried both options?
 

RespectWomen

Acoustic Child
Veteran
Joined
Apr 24, 2018
Messages
57
Reaction score
14
First Language
English
Primarily Uses
RMMV
Just tried it again at the top of the list and got the same error, every playtest is a new game.
I also tried the shortened version of the variable javascript from his tutorial and got the same result.

And yes both events are exactly the same, the variable has actually changed which I can see in the debug menu, All commands in the common event play out normally except the plugin command which doesn't update and effects the first event another time.

If I copy all of the commands from the common event directly into two map events and trigger them they both work correctly.
 

Andar

Veteran
Veteran
Joined
Mar 5, 2013
Messages
31,279
Reaction score
7,635
First Language
German
Primarily Uses
RMMV
what are the IDs of the two events?
Edit: and how long is the time between the two triggers, does the same happen when you walk around between the two checks?
There are two possibilities that I can think of that could explain what happens - neither has a solution yet but finding the true cause would be at least one step ahead.
 

RespectWomen

Acoustic Child
Veteran
Joined
Apr 24, 2018
Messages
57
Reaction score
14
First Language
English
Primarily Uses
RMMV
EV27 and EV28, No matter the time between its always the same, even if I wait for a few minutes, change maps or switch scenes before triggering the 2nd it stays the same.

The non common events are EV29 EV30 if you need those.
 

Andar

Veteran
Veteran
Joined
Mar 5, 2013
Messages
31,279
Reaction score
7,635
First Language
German
Primarily Uses
RMMV
no, the question was targeted at something else.
if you reverse the order in which you trigger the events, is it still the same that works or it is always the first event triggered that works?

and it's too late here, can't really thinks about this problem anymore. I need to go to bed, I'll look again through the answers when I have time again, perhaps I'll see something when I'm more awake again...
 

Aloe Guvner

Walrus
Veteran
Joined
Sep 28, 2017
Messages
1,628
Reaction score
1,115
First Language
English
Primarily Uses
RMMV
To be honest, it would be easier for you to look up the corresponding script call to the plugin command and just use that, because you can pass arguments as normal.

The behavior you are seeing is caused by a fairly sneaky bug in the SRD plugin.

In Javascript, primitive variables (such as strings and integers) are passed by value to functions, meaning that a function from the "inside" cannot change the value on the "outside". However, object variables (such as objects and arrays) are passed by reference to the function, meaning that a function from the "inside" can change the value on the "outside".

You can see this by stepping through the code line-by-line. I didn't test this on the MOG plugin because you didn't give a link to it and I didn't feel like looking it up.

Here's an example.

In my example, the plugin command is:
Code:
SomeCommand ${$gameVariables.value(2)}
The first event on my map sets variable #2 to a value of 4, and then executes that "plugin command".
upload_2019-1-3_18-32-30.png

The second event on my map sets variables #2 to a value of 99999999. As you can see, the parameters that the event is executing is in fact:
Code:
SomeCommand 4
instead of
Code:
SomeCommand ${$gameVariables.value(2)}
This is because the actual Game_Interpreter parameters have been changed by the SRD plugin (because the parameters are an array and are being passed by reference).
upload_2019-1-3_18-39-17.png
 

RespectWomen

Acoustic Child
Veteran
Joined
Apr 24, 2018
Messages
57
Reaction score
14
First Language
English
Primarily Uses
RMMV
So script calls can be done from all plugins? I'm not very knowledgeable in js so I usually go by what's in the help docs, the reason I was using the plugin is that some plugins don't include script call guides.
 

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

Latest Threads

Latest Posts

Latest Profile Posts

Working on a Patch to integrate AlphaABS into random generated Dungeons. Was a bit tricky, but the outcome is a real Life Changer!!

Will release it the next days!
Been pretty busy... but I got a better headset for recording and listening today. Dad says that he'll consider taking me to Great Wolf Lodge for the first time once I finish summer classes (my final semester!) I'll be taking my plushie friends with me: Bendy, Lolbit, and Helen Henny. (I WUV PLUSHIES!)
SF_Monster3,4 added!


My only regret is the portal mirror effect is too subtle to show up in these GIFs. It probably just needs more sparkles. :LZSwink:
Microsoft: Hey, let's waste money advertising the Xbox Series X when nobody has any in stock, we don't seem to be making more, we aren't taking preorders and you can't get on a waiting list. BEST. IDEA. EVER.

Forum statistics

Threads
105,646
Messages
1,015,250
Members
137,317
Latest member
xexelx
Top