KToggleButtons VX

KToggleButtons VX

by Kyonides Arkanthes
​


Introduction

Are you bored of using the same old text buttons?
Now you can replace them with some good looking Toggle Buttons! 😮

Version 1.1.1

ktogglebuttonsvx02.jpg


It's also available for XP & VX ACE!​

Instructions

Define a New Style

Ruby:
STYLES[:basic] = { :name => "Basica", :cursor => "cursor1", :cursor_off => ""cursor2,
    :on => "toggle1", :off => "toggle2", :button => "toggle3" }

Change Current Toggle Button Style - Use any of the keys you enter in the STYLES Hash.
Ruby:
$game_system.toggle_button_style = :basic

How to Define a Toggle Button Manager
Ruby:
@manager = KToggle::Manager.new(FontSize, LineHeight, "Name", LabelsArray)
@manager.setup_buttons(X, Y, LabelWidth, LabelHeight)
@manager.setup_cursor(true) # Create an Active Cursor

How to Set a State - Repeat as many times as deemed necessary!
Ruby:
@manager.set_state(index, some_variable)

How to Get a State - Here 1 stands for the first position in the Array.
Ruby:
@manager.state?(1)

Since the demos include a TestScene script, you can take a :detective: look at it to learn a bit more on how to create your custom scene script. 😉


Terms & Conditions

Free for non commercial games.
Contact me if you needed for commercial games.
Mention me in your game credits.
Interesting Update​

My script has now reached the 1.0.0 milestone!

The full version brings you the possibility to setup two different kinds of toggle buttons: the multiple choices (by default) and single choice (by adding a single line of code).

It also allows you to easily setup what I called subheadings to identify your button sets.
Maintenance Update!

All RGSS-based versions
have been upgraded recently! 😀​

To be honest with you, this version doesn't include any eye-catching feature at all. 😅:

It just allows you to call a couple of new methods for the KToggle::Manager and the KToggle::Cursor classes.

One of them is the new @manager.reset_cursor call, and yes, you can also manually set a specific position for the cursor to start at while launching or at any other moment.

I felt like it was a must to change the @manager.set_state method by adding an additional parameter so it should be called now just like this:

Ruby:
@manager.set_state(1, your_variable_here)
@manager.set_state(2, your_variable_here)

As you could see above, it begins with position 1 for convenience sake. 😉
This also lets you alter that value via a script call at any given time.

Original thread: https://forums.rpgmakerweb.com/threads/ktogglebuttons-vx.152451/