gjoynerjr

Villager
Member
Joined
Nov 3, 2021
Messages
9
Reaction score
8
First Language
English
Primarily Uses
RMMV
Hello everyone. I'm working on porting a VX Ace Ruby plugin to RMMV JavaScript and came across the following line:
Ruby:
$game_self_switches[[@map_id, ev.id, PearlKernel::Enemy_Sensor]]

I don't have a lot of practice with Ruby, so I'm curious as to what this is specifically doing. Is the 3-element array acting as a key, or is it one of those Ruby quirks where it's choosing the first applicable index of the 3? And if so, does anyone with RMMV JS knowledge know whether or not $gameSelfSwitches allows for this?

Thanks!
 

Trihan

Speedy Scripter
Veteran
Joined
Apr 12, 2012
Messages
4,977
Reaction score
4,592
First Language
English
Primarily Uses
RMMZ
It's using an array as a key, which MV also does. $gameSelfSwitches uses as its object key an array where the first element is the map ID, the second element is the event ID, and the third element is the letter. The only difference is that MV uses $gameSelfSwitches because the Javascript engines use camelCase instead of Ruby's underscores.
 

gjoynerjr

Villager
Member
Joined
Nov 3, 2021
Messages
9
Reaction score
8
First Language
English
Primarily Uses
RMMV
Great! I know the standard is different, but wasn't entirely sure on the functionality. Appreciate it!
 

Trihan

Speedy Scripter
Veteran
Joined
Apr 12, 2012
Messages
4,977
Reaction score
4,592
First Language
English
Primarily Uses
RMMZ
Great! I know the standard is different, but wasn't entirely sure on the functionality. Appreciate it!
Nah, a lot of the internal stuff was kept surprisingly faithful to RGSS besides the change in naming conventions. Functionally the self switches work exactly the same way as they did before. It's the best way to do it, really: those pieces of data are the minimum you need for a unique identifier of a self switch.
 

gjoynerjr

Villager
Member
Joined
Nov 3, 2021
Messages
9
Reaction score
8
First Language
English
Primarily Uses
RMMV
Good to know! Will certainly make the rest of the porting process easier since I don't have to worry about huge differences in functionality. Really do appreciate all the info. :kaoluv:
 

Trihan

Speedy Scripter
Veteran
Joined
Apr 12, 2012
Messages
4,977
Reaction score
4,592
First Language
English
Primarily Uses
RMMZ
Feel free to hit me up if you have any other queries about the porting process, it's something I'm very good at. :)
 

Latest Threads

Latest Posts

Latest Profile Posts

NUMINA Part 1 is finally out ✨ Get it now with a 10% launch discount!
Made this simple Training Dummy :D

obraz_2022-07-01_095700524.png
I'm still undecided weather or not I should add minor swearing to my game. Like I'm going for an all ages demographic... but the idea of a cartoon character saying dammit, hell, or crap in normal conversation is really funny to me.
If we assume an Elf's strong suit is Dexterity (AGI) & Intellect (MAT), I imagine Strength (ATK) & Constitution (DEF) would be among their lowest stats. But I'm having a hard deciding which should be lower, Strength or Constitution?
I'm really sorry to have to do this, but I'm going to have to start blocking those who repeatedly put up sexual content and offer absolutely nothing (that I've seen) related to what this community is supposedly created for.
Don't take it personal. I'm a rape victim with permanent injuries who can never enjoy 'it' ever again, so it's the last thing I want to have put in my face. :(

Forum statistics

Threads
123,219
Messages
1,155,007
Members
161,600
Latest member
googoogagaman
Top