Self Switch Value not changing in map

Ozenky

Villager
Member
Joined
Sep 21, 2018
Messages
22
Reaction score
1
First Language
Spanish
Primarily Uses
RMMV
Hello (again). I want to use a self switch to open a window when it is activated, specifically a Number Input Window.

I only see the window appearing when I move out of the map and spawn in another map. I want it to happen inside the actual map.

¿Suggestions?
 

izyees

My Secret Santa
Veteran
Joined
Oct 24, 2015
Messages
247
Reaction score
67
First Language
english
Did you set it to autorun?

What are you doing actually? can you give some screenshot of your events on why did it only opens on another map? Did you use common events? When did you activate the self switch?

Theoretically, self switch cannot be activate from another events. So when you spawn on another map, it means it is a different event.
 

Ozenky

Villager
Member
Joined
Sep 21, 2018
Messages
22
Reaction score
1
First Language
Spanish
Primarily Uses
RMMV
Did you set it to autorun?

What are you doing actually? can you give some screenshot of your events on why did it only opens on another map? Did you use common events? When did you activate the self switch?

Theoretically, self switch cannot be activate from another events. So when you spawn on another map, it means it is a different event.
My event turns its self switch ON if it OFF, and OFF if its ON. I declared the $gameSelfSwitch.value([4,1,'A']) so it is readable from other maps. No common events. It activates with the action button, and I can't recall if it was or not in autorun (not in front of the computer right now).

To check if the self switch value actually changed, I assigned to a text in a Window on a plugin, and it shows FALSE. If I touch the event, still shows FALSE but If I leave, the value updates on the Window as soon as I change map anf it stays that way unless I touch the event again AND leave the map.

Don't know if all that description helps. It is like the value of the self switch does not takes place unless I change scene.
 

Shaz

Veteran
Veteran
Joined
Mar 2, 2012
Messages
39,385
Reaction score
12,889
First Language
English
Primarily Uses
RMMV
screenshots would help, of the full event window.

An event on map 1 will not run when you're in map 2.
 

Ozenky

Villager
Member
Joined
Sep 21, 2018
Messages
22
Reaction score
1
First Language
Spanish
Primarily Uses
RMMV
Here is a picture. That is a conditional statment. If the selfswitch is ON, turn it OFF, else, turn it ON.
 

Attachments

Andar

Veteran
Veteran
Joined
Mar 5, 2013
Messages
30,262
Reaction score
7,138
First Language
German
Primarily Uses
RMMV
nothing in that event can show if its self-switches are on or off, so how do you even test if it is working?
It should work when you trigger with your party that event as there is nothing to stop it from working, but you'll never see it working no matter what you do.

And that won't change if you use scripts to change the selfswitch - it still has nothing to show that it is working.

As with Shaz I strongly suspect that you simply didn't understand the limitations of the engine. Please tell us what you're trying to do as a result, not how you're trying to do it. Then we can tell you how it is done correctly.
 

Ozenky

Villager
Member
Joined
Sep 21, 2018
Messages
22
Reaction score
1
First Language
Spanish
Primarily Uses
RMMV
nothing in that event can show if its self-switches are on or off, so how do you even test if it is working?
It should work when you trigger with your party that event as there is nothing to stop it from working, but you'll never see it working no matter what you do.

And that won't change if you use scripts to change the selfswitch - it still has nothing to show that it is working.

As with Shaz I strongly suspect that you simply didn't understand the limitations of the engine. Please tell us what you're trying to do as a result, not how you're trying to do it. Then we can tell you how it is done correctly.
I want to pop up a window with a plugin, when that selfswitch is ON, and disappear it when the selfswitch is off.

And now, how do I know it works? because I touch the event and created a window that showed me the result in a plugin, for practicing purposes, using the code shown below:

Window_MyWindow2.prototype.refrescar = function() {
this.drawTextEx('' + $gameSelfSwitches.value([4,1,'A']), 0,125 );
}

(Ignore the face) And it works. When I go in, it show false at the beginning (like in 1). If I go out without touching it, it still says false. If I go in and touch it to change it to true, it show false UNLESS I go out of the map, then it show true, and it remains true even If I move to other maps UNTIL I touch the event again, in which case it changes to false again. So by logic, I know the event works, BUT the message info (the variable) doesn't seem to change it value until I leave the map. My question is why it happens and how to change that fact.
 

Attachments

Andar

Veteran
Veteran
Joined
Mar 5, 2013
Messages
30,262
Reaction score
7,138
First Language
German
Primarily Uses
RMMV
So by logic, I know the event works, BUT the message info (the variable) doesn't seem to change it value until I leave the map.
That is something other than the topic title asked, and yes that is better understandable - because it shows the problem is in the refresh, NOT in the switch.

Unless you somehow broke the engine code itself, the switch will change values as soon as you trigger the event. That is guaranteed because that is how the event code works.

You can test that by changing your switch event a little bit:
make it two pages, the first page only containing a single command "self-switch A = ON".
The second page should get a different sprite and set condition to self-switch A, and give it a single command self-switch A=OFF.
This will have the event switch the self-Switch A on and off, exactly like your event, just with the added effect that it will change the sprite between the pages, showing the effect immediatly.

Then test again. If the event changes sprites as soon as you trigger it but the plugin window still shows the old value, then you know that the problem lies in the refresh of the data in the plugin itself.
If the event doesn't change the sprite and only changes it when you leave the map, then something you did with your plugins broke the default refresh of the engine itself.

In both cases you need to troubleshoot what you did with your plugins, it's just in different forms depending on what you did and where exactly you broke the behaviour.
 

Ozenky

Villager
Member
Joined
Sep 21, 2018
Messages
22
Reaction score
1
First Language
Spanish
Primarily Uses
RMMV
Well, my code is the one that follows:

(function() {

function Window_MyWindow2() {
this.initialize.apply(this, arguments);
}

Window_MyWindow2.prototype = Object.create(Window_Selectable.prototype);
Window_MyWindow2.prototype.constructor = Window_MyWindow2;

Window_MyWindow2.prototype.initialize = function(x,y,height,width) {
Window_Selectable.prototype.initialize.call(this,x,y,height,width);
this.refrescar();
};

Window_MyWindow2.prototype.refrescar = function() {
this.drawTextEx('' + $gameSelfSwitches.value([4,1,'A']), 0,125 );
}

var _Scene_Map_createAllWindows2 = Scene_Map.prototype.createAllWindows;
Scene_Map.prototype.createAllWindows = function() {
_Scene_Map_createAllWindows2.call(this);
this.crearMiniMapa2();
};

Scene_Map.prototype.crearMiniMapa2 = function() {
this._minimapWindow2 = new Window_MyWindow2(120,130,300,270);
this.addChild(this._minimapWindow2);
this.update();

};
})();

Don't know if I need to add something to refresh the variables appropiately. I did the sprite things and it works, so the code works in the game but it does not refresh in the window yet until I leave. ¿Any clue? (and thanks for the page things, I know I will be using that later a lot). If this works, and you give me the solution, I can tinker for what I need next anyway. This is not the only variable written as $gameSOMETHING for which this happens to me, so fixing this refresh issue might help me with all my other issues in this regard.
 
Last edited:

Andar

Veteran
Veteran
Joined
Mar 5, 2013
Messages
30,262
Reaction score
7,138
First Language
German
Primarily Uses
RMMV
sorry, I don't know enough of the engine to tell you where you did something wrong - especially since you didn't even tell the result of the test I desccribed.
(I'm very good in computer theory and general debugging steps due to havng a master's degree in computer engineering, but I haven't had the time to work with MV and its javascript functions at all.)
 

Ozenky

Villager
Member
Joined
Sep 21, 2018
Messages
22
Reaction score
1
First Language
Spanish
Primarily Uses
RMMV
Don't know if I need to add something to refresh the variables appropiately. I did the sprite things and it works, so the code works in the game but it does not refresh in the window yet until I leave. ¿Any clue? (and thanks for the page things, I know I will be using that later a lot). If this works, and you give me the solution, I can tinker for what I need next anyway. This is not the only variable written as $gameSOMETHING for which this happens to me, so fixing this refresh issue might help me with all my other issues in this regard.
Your sprite experiment was succesful, but I still have my doubt in why the code does not refreshes the value as soon as it changes. Thanks anyway, pretty useful information. Still hope someone can help me.
 

Ozenky

Villager
Member
Joined
Sep 21, 2018
Messages
22
Reaction score
1
First Language
Spanish
Primarily Uses
RMMV
¿Not a clue yet? ¿Is there any way to see why the window is not refreshing he information?
 

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

Latest Threads

Latest Profile Posts

Yo Ho Ho... Time flies when you are having rum...

I'm rewatching Glee, just watched grilled cheesus.
Now I'm not sure if I'm hungry or I want to cry.
I just completed Ara Fell - completing the game unlocks an Epilogue. An interesting thing to possibly consider for my games.
I decided to try to make a mucha-styled artwork, and by now I've sunk more time in studies and sketches than I usually do in the whole thing. Fingers crossed it's worth it!

Forum statistics

Threads
99,452
Messages
965,437
Members
131,067
Latest member
LeoWolf
Top