Chaos Project

RPG Maker => RPG Maker Scripts => Script Requests => Topic started by: cyclope on July 05, 2010, 12:20:53 pm

Title: [RESOLVED][XP] Press a buttom(other than the deafualt ones)
Post by: cyclope on July 05, 2010, 12:20:53 pm
I am ussing Blizz abs and I need a small Add-on=
I need a script or a way to make events triggerd whene you press a buttom other than left, right, down, up, a, b, c, y, z, l, r. For example if i want to triigger an event with backspace or Ctrl-C.
Title: Re: (XP) Press a buttom (other than left, right, down, up, a, b, c, y, z, l, r)
Post by: stripe103 on July 05, 2010, 12:47:24 pm
If you use a conditional branch choose the Script and then type in
Input.trigger?(Input::Key['THEKEYYOUWANT'])

That should work.
Blizzards input module is allready in Blizz-ABS.
Title: Re: (XP) Press a buttom (other than left, right, down, up, a, b, c, y, z, l, r)
Post by: cyclope on July 05, 2010, 05:23:44 pm
But to have it activated when Ctrl and Letter C are pressed at the same time
Title: Re: (XP) Press a buttom (other than left, right, down, up, a, b, c, y, z, l, r)
Post by: AresWarrior on July 05, 2010, 06:03:59 pm
under the conditional branch (if ctrl is pressed), make another conditional branch (if C is pressed)
Title: Re: (XP) Press a buttom (other than left, right, down, up, a, b, c, y, z, l, r)
Post by: cyclope on July 05, 2010, 07:17:28 pm
Quote from: AresWarrior on July 05, 2010, 06:03:59 pm
under the conditional branch (if ctrl is pressed), make another conditional branch (if C is pressed)

It didnt work :'( :wacko:
Title: Re: (XP) Press a buttom (other than left, right, down, up, a, b, c, y, z, l, r)
Post by: stripe103 on July 06, 2010, 04:16:24 am
Try to make it like this then.

Edit: I just tried what AresWarrior suggested. It worked but I had to press them at the exact the same time not one after another. But if you want that to work you could have an event like this:
Event Commands: ShowHide
@>Conditional Branch: Script: Input.trigger?(Input::Key['Ctrl'])
  @>Control Switches: [0001: CTRL] = ON
  @>
: Branch End
@>Conditional Branch: Script: Input.trigger?(Input::Key['C'])
  @>Control Switches: [0002: C] = ON
  @>
: Branch End
@>Conditional Branch: Switch [0001: CTRL] == ON
  @>Conditional Branch: Switch [0002: C] == ON
     @>Text: You pressed the Control and the C key.
     @>Control Switches: [0001: CTRL] = OFF
     @>Control Switches: [0002: C] = OFF
     @>
   : Branch End
  @>
: Branch End
@>
Title: Re: (XP) Press a buttom (other than left, right, down, up, a, b, c, y, z, l, r)
Post by: SBR* on July 06, 2010, 07:50:11 am
Just set them to Input.press? ?
Title: Re: (XP) Press a buttom (other than left, right, down, up, a, b, c, y, z, l, r)
Post by: ForeverZer0 on July 06, 2010, 09:36:03 pm
I made a script for this a while back to make triggers for events, but never released it. I didn't think anybody would get any use from it. Let me see if I can find it/re-write it and I'll post it.  :<_<:

It would allow for any type of trigger, but without having to use parallel processes to always be checking for things. You just had to type a comment or two into the event's code.
Title: Re: (XP) Press a buttom (other than left, right, down, up, a, b, c, y, z, l, r)
Post by: G_G on July 06, 2010, 09:57:09 pm
That'll be pretty helpful FZ! You should post it for everyone to use, I've tried creating my own custom event trigger script and it didn't work out so well.
Title: Re: (XP) Press a buttom (other than left, right, down, up, a, b, c, y, z, l, r)
Post by: winkio on July 06, 2010, 10:48:00 pm
having two input.trigger? will not work, as you have to press both buttons the same frame.  Having two input.press? will not work because it will repeat the action multiple times.  You need 1 input.trigger?, and all the rest input.press?, for any given button combination.  No need to mess around with switches or other stuff.
Title: Re: (XP) Press a buttom (other than left, right, down, up, a, b, c, y, z, l, r)
Post by: SBR* on July 07, 2010, 11:56:59 am
@Winkio: For instance: You have to press the Z button and the A button. Your way, it would be this:

if Input.press?(Input::Z) && Input.trigger?(Input::A)
  $scene = Scene_Map.new #For instance
end


This would work fine if you first press the Z button, and then the A button. But if you first press the A button and then the Z button, it won't work. New code:

if (Input.press?(Input::Z) && Input.trigger?(Input::A)) || (Input.press?(Input::A) && Input.trigger?(Input::Z))
  $scene = Scene_Map.new #For instance
end


?
Title: Re: (XP) Press a buttom (other than left, right, down, up, a, b, c, y, z, l, r)
Post by: cyclope on July 07, 2010, 02:30:00 pm
Quote from: winkio on July 06, 2010, 10:48:00 pm
having two input.trigger? will not work, as you have to press both buttons the same frame.  Having two input.press? will not work because it will repeat the action multiple times.  You need 1 input.trigger?, and all the rest input.press?, for any given button combination.  No need to mess around with switches or other stuff.


It worked as i wanted it to :haha: