iPhone App Directory
RPG Maker VX
 
Gallery Members Search Calendar Help


Welcome Guest ( Log In | Register )

Collapse

>Announcement

Keep an eye out for the upcoming 3rd Quarter Contest!
 
Reply to this topicStart new topic
> Reintroducing the Button Input Process known from RMXP
Rating 4 V
Zeriab
post Apr 13 2008, 12:07 PM
Post #1



Group Icon


Type: Coder
Alignment: Unaligned




For some queer reason the Button Input Process event command was removed from RMVX.
I have no idea why they would remove such a useful command. Anyway thanks to Despain requesting eventers now have a way of duplicating the effect :3
Note: This changes the way script calls in events work to the way they worked in RMXP. When the script evaluates to false it will wait a frame and then call the script again. It will do so until the script call returns something other than false.
This means that if you use something like $game_switches[23] = false then the event will appear to freeze.
Instructions on how to use it is in the header.
CODE
=begin
Allow the use of the Button Input Process command as known from RMXP
Put this in a call script:

  button_input_process(4)

In this case the variable with id 4 will be changed to the input number.
The event will halt until an button is triggered, just like with RMXP.
Change the 4 to another number to store the input in a different variable.

You can also retrieve a wider range of numbers:

  button_input_process(4, true)
  
It will now get F5-F9 and Shift, Ctrl and Alt long in new values.
  
Here are what the different numbers mean: (Defaults in ())
2 - down
4 - left
6 - right
8 - up
11 - A (Shift)
12 - B (Esc, Num 0, X)
13 - C (Space, Enter, Z)
14 - X (A)
15 - Y (Y)
16 - Z (Z)
17 - L (L)
18 - R (W)

If you use the extended version you also have these to consider.
21 - SHIFT
22 - CTRL
23 - ALT
25 - F5
26 - F6
27 - F7
28 - F8
29 - F9

Note: By default shift is both 11 and 21. The number has priority.
=end

class Game_Interpreter
  #--------------------------------------------------------------------------
  # * Script (Overwrites it to include the eval(script) = false => wait, RMXP)
  #--------------------------------------------------------------------------
  def command_355
    script = @list[@index].parameters[0] + "\n"
    loop do
      if @list[@index+1].code == 655        # Second line of script and after
        script += @list[@index+1].parameters[0] + "\n"
      else
        break
      end
      @index += 1
    end
    if (eval(script) == false)
      return false
    end
    return true
  end
  #--------------------------------------------------------------------------
  # * Button Input
  #--------------------------------------------------------------------------
  def button_input_process(n, all = false)
    @button_input_variable_id = n
    # Process the input button
    input_button(all)
    # If a button where pressed
    if @button_input_variable_id == 0
      # Proceed
      return true
    end
    # Wait
    return false
  end
  #--------------------------------------------------------------------------
  # * Button Input
  #--------------------------------------------------------------------------
  def input_button(all)
    # Determine pressed button
    n = 0
    range = all ? 1..29 : 1..18
    for i in range
      if Input.trigger?(i)
        n = i
      end
    end
    # If button was pressed
    if n > 0
      # Change value of variables
      $game_variables[@button_input_variable_id] = n
      $game_map.need_refresh = true
      # End button input
      @button_input_variable_id = 0
    end
  end
end


Let me know of any errors ^^

*hugs*
- Zeriab


--------------------
Go to the top of the page
 
+Quote Post
   
jedicommando
post Apr 13 2008, 07:19 PM
Post #2


Dulled Edge Games
Group Icon


Type: Writer




Very nice!


--------------------
--------------------
Games completed:
None.
Games currently in development:
Tower of Dreams: A World Forsaken
Games currently in pre-development:
A top secret project =O

--------------------
Games being developed my me personally:
Rememory (More details to come)
Go to the top of the page
 
+Quote Post
   
JustSarah
post May 1 2008, 02:38 PM
Post #3


Lead Reviewer
Group Icon


Type: Writer
Alignment: Neutral Good





What section do you put the code in?


--------------------
I'm a writer, its what I do. I don't need a reason to write short stories.
Spoiler:






Go to the top of the page
 
+Quote Post
   
velcro113
post Nov 17 2008, 03:21 PM
Post #4



Group Icon


Type: Undisclosed




thanks =]

This post has been edited by velcro113: Nov 17 2008, 03:38 PM
Go to the top of the page
 
+Quote Post
   
Zeriab
post Nov 17 2008, 04:05 PM
Post #5



Group Icon


Type: Coder
Alignment: Unaligned




You can insert the script in a new section below Game_Interpreter and above Main.
If you are still confused then just put it right above main. (Insert a new section first and copy-paste it into the new section)

I hope you all will enjoy it

*hugs*
- Zeriab

This post has been edited by Zeriab: Nov 17 2008, 04:06 PM


--------------------
Go to the top of the page
 
+Quote Post
   
Aindra
post Nov 18 2008, 12:36 AM
Post #6


• Inactive
Group Icon


Type: Undisclosed
Alignment: Unaligned




Hello Zeriab!

I always wanted to post here but I didn't know if you still check this topic and it can be considered necropost if I do.

But since you're here, so it should be all right.

Your script is really useful, and I've been using it for few weeks now. I admit, at first, I was confused with your instructions.

CODE
In this case the variable with id 4 will be changed to the input number.
The event will halt until an button is triggered, just like with RMXP.
Change the 4 to another number to store the input in a different variable.


I thought you meant each variable is used for the certain key. As like Variable #4 = Left key, while Variable #8 = Up key.
Of course, that can't be right. That would be too many variables and it's just not convenient. I had to ask another guy for help, and we had to test it in the game to figure what you really meant.

Maybe you could re-write the instructions to make it clearer? Just suggestion, in case other people thought same way I thought.

Other than that, it's marvelous script. happy.gif


--------------------



Award & To-Do List & Status
Spoiler:


To-Do List
  1. Custom List & Pages 2.0 Version
    Contains few bugs that I don't quite know how to fix. Am taking time to study and figure how to fix them, so it takes time. (I'm still a rookie scripter.)
  2. Surprise Graphic Package #1
  3. Surprise Graphic Package #2


To Do List - At Lowest Priority
New version of RPG School Maker. I originally planned to make a new version back in July 2009 but it fell apart due to teammates disappearing. Maybe I'll take it up again when my knowledge of RGSS2 improves. I had to include this in here because I've been asked often for it.

Go to the top of the page
 
+Quote Post
   
Zeriab
post Nov 18 2008, 08:51 AM
Post #7



Group Icon


Type: Coder
Alignment: Unaligned




Ah yes. I wrote the instructions for someone familiar with the Button Input Process event command in RMXP.
I can see how it can be confusing if you are not familiar with that event command.
I will update the instructions when I get the time.

Thanks for pointing it out.

*hugs*
- Zeriab


--------------------
Go to the top of the page
 
+Quote Post
   
shiyongseng
post Sep 22 2009, 11:59 AM
Post #8



Group Icon


Type: Undisclosed




When is this activated, by a switch or by putting the script directly into the event? Can it be used during battle- like a super skill event in Final Fantasy 3?
Go to the top of the page
 
+Quote Post
   
Zeriab
post Sep 24 2009, 08:50 AM
Post #9



Group Icon


Type: Coder
Alignment: Unaligned




It is activated whenever script calls using button_input_process(42) is processed by the interpreter. (42 is the number for variable 42. You can change it to any other number. Don't use negative numbers, their behavior is practically unpredictable.)

I see that I have forgot to tell that the script call must be 1 line only.
Sorry about that

*hugs*

This post has been edited by Zeriab: Sep 24 2009, 12:01 PM


--------------------
Go to the top of the page
 
+Quote Post
   

Reply to this topicStart new topic
1 User(s) are reading this topic (1 Guests and 0 Anonymous Users)
0 Members:

 

Lo-Fi Version Time is now: 29th July 2014 - 05:57 PM

RPGMakerVX.net is an Privacy Policy, Legal.