Jump to content
Galv

Keypad Input

Recommended Posts

Keypad Input - Version 1.1

Galv

 

Introduction

For those sci fi games where you enter a code at the door or something. More for that than anything, really... heh.

 

 

Features

The keypad is just a fancy version of the 'Number Input' event command.

When "OK" is pressed, it outputs the entered number to the chosen variable.

When "X" is pressed, it outputs -1 to the chosen variable (for eventing).

From then on, it's up to your eventing skills what to do with the number.

 

Set a variable for it to use and maximum numbers allowed to be input.

 

 

Screenshots

keypad-input.jpg

 

How to Use

Place script under Materials and above Main.

Read script instructions.

 

Show the keypad with script call:

keypad_input

 

If you want to check high numbers in a conditional branch, you can use 'script'

$game_variables[1] == 123456789012345

 

 

Script

Get it here

 

 

FAQ

None yet.

 

 

Credit and Thanks

- Galv

 

Author's Notes

2012-10-15 - Version 1.1 - Updated to allow for larger maximum number input to display properly.

Edited by Galv

Share this post


Link to post
Share on other sites

Whew, thanks dude!

 

This is just what I need now!^_^

 

The only problem is that when using conditional branch on the variable you can only have 9 numbers in the constant box thing.

 

Which leaves my complicated 15 digit code in the dust now, oh well that's life.

 

I'll make do just fine with 9, you've done a good job... be proud eh.

Share this post


Link to post
Share on other sites

I didn't even think anyone would want to put that many in haha

 

I have taken your complicated digit code out of the dust for you.

I just updated the script so the keypad shows larger max numbers properly. (Copy v.1.1 from the original post)

 

To use larger numbers in a conditional branch, select script and put:

$game_variables[1] == 123456789012345

 

The 1 being what number variable you are using for the keypad script.

 

Let me know if any issues

Share this post


Link to post
Share on other sites

I didn't even think anyone would want to put that many in haha

 

I have taken your complicated digit code out of the dust for you.

I just updated the script so the keypad shows larger max numbers properly. (Copy v.1.1 from the original post)

 

To use larger numbers in a conditional branch, select script and put:

$game_variables[1] == 123456789012345

 

The 1 being what number variable you are using for the keypad script.

 

Let me know if any issues

 

Yay!^_^

 

Thanks dude really!^_^

 

It works great now, this is good!^_^

Share this post


Link to post
Share on other sites

Wow, wow, wow! Thanks Galv. This is good for unlocking secret chests/rooms through story telling and such.

 

Also, lol, 0g were found.

Edited by Rockstar

Share this post


Link to post
Share on other sites

Hi,

 

This is a cool script but I would like some help if I may. I know there is a dedicated help section, but thought since my question loosely relates to this script, I would try my luck here. First of all I need to admit that as far as RGSS3 and Perl are concerned, I'm a total noob, though I understand program flow through my knowledge of VB.

 

I am trying to use the keypad in a "cheat" system on a game I am working on and also maybe a banking system. Below is the code I have when this script is called:

 

 

def addgold
    SceneManager.call(Scene_Keypad)
    p $game_variables[1]
    $game_party.gain_gold($game_variables[1])
    @myCmd.active = true
end 

 

This is called from a simple command window with a few different options. This works in that it calls the Keypad script and displays the window. However, it then continues to process this code whilst the Keypad window is open, so the first time this is run, $game_variables[1] = 0 so effectively does nothing, the second time it adds what ever number was entered on the first Keypad screen and so on.

 

Is there a way to pause the code where I currently have the "p $game_variables[1]" line until the Keypad is finished processing?

 

I have tried putting the Keypad Call in a seperate def and calling the del instead of the scene in addgold, I have also tried doing a while loop that will loop while the variable = 0 but this inevitably just freezes the program (I never expected that to work).

 

Any help would be great. Thanks

Share this post


Link to post
Share on other sites

Ahh this is an old script. Might look into why that happens one day but I recall I added wait after the scenemanager call to stop that problem. Something like:

wait(1)

should work

Share this post


Link to post
Share on other sites

Thanks for the reply. I have tried this and I get the following error:

 

Line 44: NoMethodError occurred

unidefined method 'wait' for #<Scene_Cheat:0x7962fb0>

 

I know 'wait' is defined under Game_Interpreter but I'm not sure how to get this defined in my scene. I've tried the long route by putting 'duration.times { Fiber.yield }' changing duration to be something like '30' but this way doesn't work saying 'can't yield from root fiber'

Share this post


Link to post
Share on other sites

Ahh, you're using it from another scene, sorry I assumed you were doing that from game interpreter. When I have time I'll go back to this one and try to work out why this happens. It's appears the scene takes 1 frame to open and runs script commands after it at the same time. I don't know if this is normal for scenes or if I did something wrong.

 

Could you add your gaining of gold to the number input itself?

Share this post


Link to post
Share on other sites

Hi,

 

Thanks for taking the time and looking at this. I have changed the set up and incorporated my script into the script you created so this can be done, and I have the original script seperate for use for locks/passwords in game. I hope you don't mind me editing your script and all, but it was the only way I could do this.

 

I'm sure there is a way to have a scene call another scene and the original scene being paused until completion of the new scene but I can't find it (yet) and it's getting late here. lol. Once I find it, I will get started on my Banking script.

 

Again, thanks for the help and thanks for the script :D

Share this post


Link to post
Share on other sites

I am still confused on how to make the keypad work. Like the script function well,  but I do not know how to put in a password for it to work.

 

Maybe screenshot the way you make it work, so I can understand it more easily.

Share this post


Link to post
Share on other sites

it's very easy to use this script. Not sure where your confusion is.

 

In your event use a script call command and enter

keypad_input

 

This bring up the window.

The player enters a number and selects ok or X. When the player selects ok the value entered is stored into the variable you specified in the script, default is 1.

Then you can do whatever you want.

 

Normally you would use a conditional branch to check if the number entered is equal to a specific number you have in mind.

Then do whatever commands you see fit.

That's basically it.

 

The script also allows you to limit the number input to a specific number of digits.

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

  • Recently Browsing   0 members

    No registered users viewing this page.

×