Status
Not open for further replies.

Philsco

Flipped Out RPG2Knet.com vet
Veteran
Joined
Apr 5, 2015
Messages
41
Reaction score
9
First Language
English
Primarily Uses
Okay, so in VX Ace, you could use
Code:
$game_self_switches[[map, event, 'self_switch']] = value
to manipulate an event's self switch. For example:
Code:
$game_self_switches[[@map_id, 7, 'C']] = true
would change event 7 on the current map's self switch "C" to "On," since in that code @map_id referenced the current map.

So, my question is, I suppose, two-fold.

1) What is the value identifier for the parameter that references the current running map? (such as @map_id in VX Ace)
2) What is the script call for the command to manipulate (or at least read) an event's self switch boolean?

Thanks for your time, and I hope someone here can help me out! I searched through the .js files, but the self switch functions there within provide VERY little insight on how to manipulate or read them (either that or it's just so nested that I can't quite make heads or tails of it :p )
 

Shaz

Global Moderators
Global Mod
Joined
Mar 2, 2012
Messages
42,485
Reaction score
14,818
First Language
English
Primarily Uses
RMMV

Philsco

Flipped Out RPG2Knet.com vet
Veteran
Joined
Apr 5, 2015
Messages
41
Reaction score
9
First Language
English
Primarily Uses
Nevermind, found the answers! Just had my syntax wrong and was looking for the wrong info in the .js files :p
But the answers are

1) $gameMap._mapId (or $gameMap.mapId() )
2) $gameSelfSwitches.Value([$gameMap._mapId, EventID, 'A/B/C/D']); to read
$gameSelfSwitches.setValue([$gameMap._mapId, EventID, 'A/B/C/D'], true/false); to write

ex: $gameSelfSwitches.setValue([$gameMap._mapId, 6, 'B'], true); would set event 6 on the current map's B self switch to "True."
 

Philsco

Flipped Out RPG2Knet.com vet
Veteran
Joined
Apr 5, 2015
Messages
41
Reaction score
9
First Language
English
Primarily Uses
If you are running this through a Script command in an event (and not a Script command in a move route), I think it will be something like this:

Code:
$gameSelfSwitches.setValue([this._mapId, 7, 'C'], true);

I don't have my laptop with me so I can't test that out.

This might be of interest to you:
https://forums.rpgmakerweb.com/index.php?threads/rpg-maker-mv-script-call-list.46456/

Yup thanks! I hadn't refreshed this before I wrote my prior reply, but you're pretty close! The call was dead-on, and the map ID was close (it uses $gameMap._mapId, but maybe this. works as well, just haven't tried it).

Thanks for your response! Wish I'd refreshed this page half an hour ago haha.
 

Shaz

Global Moderators
Global Mod
Joined
Mar 2, 2012
Messages
42,485
Reaction score
14,818
First Language
English
Primarily Uses
RMMV
this._mapId will also work if you're calling it in a Script call.

Script calls are run by Game_Interpreter, which has a _mapId variable.
 

SlingB

Villager
Member
Joined
Jan 16, 2018
Messages
9
Reaction score
1
First Language
English
Primarily Uses
RMMV
I'm not sure if I should ask here or start a new thread. i have the same question but I can't get your answers to work.

Map Id: 014,
Event Id: 038,
Self-Switch 'A' : check is it on?

I'm using MV and trying to read if a self-switch is TRUE and then do something in a conditional if-then.
I'm using an autorun event that runs this code in a script call. This autorun then deletes, so not running forever. The MV event window looks like:

If : Script : $gameSelfSwitches.Value([014, 038, 'A']);
Text : None, Window, Bottom
: : Sample Text
: End

I get Type Error. undefined is not a function

I also tried: $gameSelfSwitches.Value([$gameMap._mapId, 038, 'A']); = undefined is not a function
I also tried: $gameSelfSwitches.Value([$gameMap.014, 038, 'A']); = unexpected number
I also tried: $gameSelfSwitches.Value([$this._mapId, 038, 'A']); = $this not defined
I also tried: $gameSelfSwitches.Value([this._mapId, 038, 'A']); = undefined is not a function

Obviously, I dont understand what the code is doing. Is there some way to provide an ACTUAL example so I can just switch out the numbers to match my game?
 

Aloe Guvner

Walrus
Veteran
Joined
Sep 28, 2017
Messages
1,628
Reaction score
1,134
First Language
English
Primarily Uses
RMMV
This is right around the 90 day limit for necroposting, but it is on-topic so hopefully it is OK.

Javascript is case-sensitive and so try "value" instead of "Value". Also, try without the leading zeros.

If : Script : $gameSelfSwitches.value([14,38,'A'])
Text : None, Window, Bottom
: : Sample Text
: End
 

SlingB

Villager
Member
Joined
Jan 16, 2018
Messages
9
Reaction score
1
First Language
English
Primarily Uses
RMMV
Sorry for the necro-post and Thank-you Aloe Guvner! You were correct.

$gameSelfSwitches.value([14,38,'A']) works = small v for value AND no leading '0's
$gameSelfSwitches.value([this._mapId,38,'A']) also works!

$gameSelfSwitches.value([this._mapId,038,'A']) //both of these DON'T work. weird. so, the 038 is a 'string' not a integer? that was surprising.
$gameSelfSwitches.value([014,038,'A'])

Thanks again! It works!
 

Shaz

Global Moderators
Global Mod
Joined
Mar 2, 2012
Messages
42,485
Reaction score
14,818
First Language
English
Primarily Uses
RMMV
Do not put leading zeros before numbers. It converts them to hexadecimal (or something weird like that). Long-standing rule.

Also, the necropost limit is 30 days, not 90.
 

Kes

Veteran
Veteran
Joined
Aug 3, 2012
Messages
22,317
Reaction score
11,738
First Language
English
Primarily Uses
RMVXA
@Aloe Guvner Just to confirm Shaz's post, the necropost limit is indeed 30 days, not 90.
@SlingB Could you note the correct length so you know for the future.

[mod]Closing[/mod]
 
Status
Not open for further replies.

Latest Threads

Latest Posts

Latest Profile Posts

Gotta love when RM just decides it's done with existence and closes when you're in an event.
Good grief am I ever so dusty on music creation. Never move, gentleman and ladies!
After waiting for several months to observe the results of vaccines, I finally decided to go for Comirnaty, because now my job needs me to either be vaccinated or take a regular testing every 2 weeks(240 HKD per test), and it seems to me that Comirnaty is safe enough in my case :)
So, to create multiple faces one needs to first export, then import, over and over... who came up with this weird mechanism...
Away from home now since it reduce COVID spread

Forum statistics

Threads
112,315
Messages
1,067,283
Members
145,939
Latest member
fooples
Top