RMMV (Yanfly's Self Switches and Variables) Turning off a range of self switches in one script call

HankB

Actual size
Veteran
Joined
Mar 5, 2021
Messages
129
Reaction score
76
First Language
English
Primarily Uses
RMMV
For this plugin, the script call for turning off a self switch is:

Code:
this.setSelfSwitchValue(mapId, eventId, switchId, false)

I was wondering if there is a way to turn off a whole range of switches (like 201-215) in a single script call, like you can with normal switches.

Thanks!
 

Arthran

Veteran
Veteran
Joined
Jun 25, 2021
Messages
343
Reaction score
288
First Language
English
Primarily Uses
RMMZ
JavaScript:
for (let x = 201; x <= 215; x++) {
    this.setSelfSwitchValue(mapId, eventId, x, false);
}
 

HankB

Actual size
Veteran
Joined
Mar 5, 2021
Messages
129
Reaction score
76
First Language
English
Primarily Uses
RMMV
@Arthran Thanks for that, but for some reason it's not working. It's behaving exactly like if there were no script call at all.

I looked up "for" and "let", and it seems like it should work. I'll mess around with it some more and see if I can figure out what the problem is.
 

Arthran

Veteran
Veteran
Joined
Jun 25, 2021
Messages
343
Reaction score
288
First Language
English
Primarily Uses
RMMZ
Hmmm... Can you show me exactly what you typed?
 

HankB

Actual size
Veteran
Joined
Mar 5, 2021
Messages
129
Reaction score
76
First Language
English
Primarily Uses
RMMV
I tried a few things, the simplest thing I tried was to turn off self switches 247 and 248 for event 199 (the event that ran the script call is on the same map as event 199):


Code:
for (let x = 247; x <= 248; x++) {
    this.setSelfSwitchValue(this._mapId, 199, x, false);
 

Andar

Veteran
Veteran
Joined
Mar 5, 2013
Messages
36,311
Reaction score
9,705
First Language
German
Primarily Uses
RMMV
@HankB
your code here is missing the }
is that also missing in your event?

generally it is better to make a screenshot of the event than to retype here what you think to have written, exactly because typos happen all times.
 

HankB

Actual size
Veteran
Joined
Mar 5, 2021
Messages
129
Reaction score
76
First Language
English
Primarily Uses
RMMV
@Andar I copy/pasted the code directly from the event, so it's the same, but I see now the missing bracket, dumb mistake on my part, it's working now. Thanks for pointing that out.
 

Latest Threads

Latest Posts

Latest Profile Posts

ScreenShot_7_1_2022_11_41_55.png
When the Panic gauge is full, Mike will turn into Omar in a state of actual panic. his move list changes and until the meter depletes completely, he'll be able make use of this alter ego.
So unbelievably excited for IGMC this year! First public game was for the original one and I'm just so pumped!!
Sometimes I am amazed at how relentless spam bots are. I would clear the que and then see 800~5k more depending on their mood.
Work on UD is already so delayed but I gotta drop everything so that I have something ready for IGMC!
Messed up the chains... :kaoback:
Sw7U8dA.jpg

Character: Jeanne D'Arc from Fate/Apocrypha.

Forum statistics

Threads
123,255
Messages
1,155,248
Members
161,636
Latest member
qixxi
Top