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,495
Reaction score
14,825
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,495
Reaction score
14,825
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,495
Reaction score
14,825
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,321
Reaction score
11,747
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

Make a Game in RMMZ Streams are going to remain in hiatus this week. Too much to do! 4 things will be announced on Monday though! Look forward to that.
Typed a long-ish reply to a post... forgot to actually HIT the post button, and moved to a different page.... finally noticed, don't remember what all I had typed and don't feel like trying to re-type it all.... smh....
Their tactics are evolving. They've learned to call for help when cornered. Never trust a mammal!
Good morning all. I still have a post up on video editing for cinematic trailers. Please make sure to check that out and give me a message as its still active in offers.
Hey everyone! I'm back :D

Snow White? More like Snowhere to be seen amiright? Hahaha I'm so sorry!! :kaocry:

Forum statistics

Threads
112,371
Messages
1,067,842
Members
146,017
Latest member
Anselmo00
Top