Status
Not open for further replies.

JacSkulls

Veteran
Veteran
Joined
May 4, 2020
Messages
137
Reaction score
34
First Language
English
Primarily Uses
RMVXA
Hello, all! Jac here!

First of all, sorry if this is in the wrong thread. I figured since I'm trying to learn JS codes and putting them into the Option Core, I thought it should be for Learning Javascript. If this is wrong, I'm sorry. And thank you for putting this in the right spot.

I am currently using a Switch to control pictures for my game. It's for controllers. You know, X, O, Triangle, Square, that kind of thing. I want to add it into the menu where the Options are. But since this is really my first time learning how to do this with VisuStella Option Core plugin, I want to know what I need to put in, where I need to put it in. I know a little bit of JS as I have a friend who teaches me but he's busy at the moment and I don't want to bother him or make him feel overworked.

EDIT: Oop. Forgot to mention, I also want to know how to set the switch true and if off, to go false. That kind of thing. If I knew how to do these, I'm sure I'd know how to do the rest on my own.

I really do appreciate any helps I can get.

JacSkulls
 
Last edited:

ramza

Lunatic Coder
Veteran
Joined
Jan 28, 2013
Messages
920
Reaction score
579
First Language
English
Primarily Uses
RMMV
Looking at the documentation is always a good place to start. ctrl+f "Listed Options" to see what I'm seeing on that page.

According to the linked page, adding an option is as simple as putting it in the plugin parameters.

Symbol, something unique for this option. Given what you said the switch was for, I'd say _controllerThing should be unique enough. change to whatever you want, I guess.

Icon - the icon to show, pick whatever you want
Text - what the option is called.
JS: Text - Only use this if you want the text to change based on what value to switch is set to, leave it for now.

Show/hide and Enable - probably just set these to return true, unless you want to lock changing the option at certain points for some reason.

JS: Ext - I actually don't know what this does. Suffice it to say that it's not likely to be useful in this specific scenario.

JS: Draw Option - whatever populates in the box by default is probably fine here.

JS: Process OK - This is where you set what happens when the ok button is pressed on the option. a script call to toggle $gameSwitches.value(x) is probably all you need here. $gameSwitches.setValue(x, !($gameSwitches.value(x))

I don't think you'd need to set cursor right or left to do anything in this case.

The data section might be tricky, since I don't have the plugin, I can't see what these actually do when you change them, and the screenshot doesn't show what the default values for these options are. You probably want the default value one to check the switch using $gameSwitchs.value(x), the others I'm not so sure about.
 

JacSkulls

Veteran
Veteran
Joined
May 4, 2020
Messages
137
Reaction score
34
First Language
English
Primarily Uses
RMVXA
@ramza
Hello! And thanks for getting to me this fast! I've actually read it already. The JS: Ext I thought might be for turning false but got confused in the process due to the JS: Process OK Especially since they were seperated by ------------ deal. Now that I know the Process OK is for setting to true, is there a way to set it to false should players not want to use a controller?
 

ramza

Lunatic Coder
Veteran
Joined
Jan 28, 2013
Messages
920
Reaction score
579
First Language
English
Primarily Uses
RMMV
If you use what I put in there, selecting Ok will toggle it, setting the value of the switch to the opposite of it's current value.
 

JacSkulls

Veteran
Veteran
Joined
May 4, 2020
Messages
137
Reaction score
34
First Language
English
Primarily Uses
RMVXA
If you use what I put in there, selecting Ok will toggle it, setting the value of the switch to the opposite of it's current value.
I actually ended up figuring it out. For some reason, it kept giving me this Syntax Error.

SyntaxError
missing ) after argument list


So I needed to do it this way.

$gameSwitches.setValue(x, !($gameSwitches.value(x)))

Instead of

$gameSwitches.setValue(x, !($gameSwitches.value(x))

It was definitely missing the ) Lol.

But either way, you put me in the right direction. Thank you so much! You have helped stop a person from going bald through hair pulling. Seriously, though. It means a lot to me that you helped out. Thank you.

This thread can now be solved and closed.
 

mlogan

Global Moderators
Global Mod
Joined
Mar 18, 2012
Messages
16,001
Reaction score
8,893
First Language
English
Primarily Uses
RMMV

This thread is being closed, due to being solved. If for some reason you would like this thread re-opened, please report this post and leave a message why. Thank you.

 
Status
Not open for further replies.

Latest Threads

Latest Profile Posts

Rest in Peace vlog gun...
vloggunsmallface.png
Another unnamed character, and probably last one for now.
She's a dragon girl inspired by fafnir dragon. as always, name suggestion is welcomed.
Dragon_Girl.jpg

Dragon_Girl_1.png
Hmm.... So I can use my quick ports of QPlugins, but QMovement breaks MZ's save system. Or I can use the Luna port of the QPlugins whose QMap breaks MZ's save system. I can't decide I want to fix one of those, or just make a new save system. The new one would look so much better.. I'm kind of tempted. :LZSexcite:
I'm very happy and I want everyone to be happy too, so I decided to share this song about the end of the world! :biggrin:
I just booked a spot for my COVID vaccine today. I am just waiting to see when they can get me in. I'll be so happy when I don't have to be paranoid about the virus anymore. I'm also thinking about moving to Atlanta, Georgia, Denver, Colorado, or Houston, Texas in the far future. Maybe once my channel gets off the ground.

Forum statistics

Threads
111,160
Messages
1,058,822
Members
144,401
Latest member
Sabiaryl
Top