Envision, Create, Share

Welcome to HBGames, a leading amateur game development forum and Discord server. All are welcome, and amongst our ranks you will find experts in their field from all aspects of video game design and development.

Press buttons in combination.

Jason

Awesome Bro

Hi,

So first, let me show you an example what I tried with a Common event containing conditional branches;

Code:
 

Show Picture; 1 [Down]

 Conditional Branch; If DOWN is pressed

  Erase Picture; 1

  Show Picture; 2 [Left]

   Conditional Branch; if LEFT is pressed

    Erase Picture; 2

    Show Picture; 3 [Right]

     Conditional Branch; if RIGHT is pressed

      Erase Picture; 3

      Success !

     Else

     End

   Else

   End

 Else

 End

 

However, for some reason, this isn't working, when I press down to make the second picture appear, nothing happens, not even if I put wait commands in.

Now, I'm not sure how I'd get this to work in a script, cause I've kinda failed already, lol, but I'll try to explain the best I can;

I'd want to be able to set up an event with a Call Script, and do something like;
Code:
 

$Combination.new[L, L, D, D, R, R ,L, U, U]

 

And for each one in the array, it will show a picture (Already got the pictures made), and when I press the direction, it will erase the picture and move onto the next command in the array, show the picture for that command, wait till I've pressed the correct button, and move on etc., however, if I do it wrong it'll make the buzzer noise and exit the script.

If that sounds confusing, just ask me to try and elaborate more on what it is.

Also, another easy thing... I hope, would there be a way to make it so if the combination is correct, a switch it turned on, cause that will help me tons.

Since this seems to be a strange request (Even I don't know how to explain it...), I'll be offering some pixelwork in return, I mainly do Charactersets for the RTP (XP, never tried to sprite VX), I can also do untemplated pixelwork (Inotherwords, from scratch) and Userbars. If there's anything else, we'll have to see if it's in my capability.

Thanks to anyone that can understand what I'm trying to request, and anyone that can help.
~JBrist.

PS~ Can you please post here if you can do it, and PM me the finished result, as I'd like to keep it exclusive.
 

Jason

Awesome Bro

Thanks for that Zeriab, hopefully someone will be able to put it to use, I myself have no idea what I'm looking at right there, but hey, maybe one day I will :wink: :cheers:
 
If need be I might be able to do this for ya, but maybe you just need to event it different...

Code:
Conditional Branch: Script: Input.press?(Input::LEFT) && Input.press?(Input::DOWN)

  @> Show Picture 1 : ("Lower Left", x, y)

End

Conditional Branch: Script: Input.press?(Input::LEFT) && Input.press?(Input::UP)

  @> Show Picture 1 : ("Upper Left", x, y)

End

You probably don't even need multiple picture slots, I'd just use the same one if I'm showing one Picture at a time. You'll have to use Conditional Branch => Call Script and type in the Input individually like I did in the example 'code' above.

Is this for some kinda puzzle/mini-game you're making? Perhaps if you explain the actual system me or someone else will be able to script it for ya. Else, if you just need a new Input script I'd suggest AWorks (formerly Aleworks) Input/Keys modules, it allows for multiple inputs, something like...

if Input.triggers?(Input::A, Input::C)

...I believe.
 

Jason

Awesome Bro

I'm bumping this again.

I've managed to get it working with events via help from both Kain Nobel and Zeriab, however, it's way too much of a hassle everytime I want to set something up using this system.

Remember people (Taken from first thread);
"PS~ Can you please post here if you can do it, and PM me the finished result, as I'd like to keep it exclusive."
 

Zeriab

Sponsor

You can use common events to your advantage. Sharing of code is the key to decrease the amount of time and effort spent on setting up and using the system.

You haven't been very lucky with getting help on the scripting side, so it may be a more practical approach to event it out. Here is a tutorial which may help you: viewtopic.php?f=48&t=60373
 

Jason

Awesome Bro

I know how to make use of common events, thats what I've been doing, but I mean, for each combination, I have to use a new common event, and if it gets to the point where I need more than 5, it goes offpage so it gets really annoying, some of them have a combination of 12 buttons to press, and it just looks retarded on my common event page because I can't see most of the event.
 
Here, I wrote you a snippet just paste it wherever in the script editor :P

Code:
#===============================================================================

# * Interpreter

#===============================================================================

 

class Interpreter

  #-----------------------------------------------------------------------------

  # * Keys Pressed?

  #-----------------------------------------------------------------------------

  def keys_pressed?(keys = [])

    return false unless keys.is_a?(Array)

    effective = Array.new

    for i in 0...keys.size

      effective << Input.press?(keys[i])

    end

    return !effective.include?(false)

  end

end

And here's a test event...

Code:
@> Script : @inputs = Array.new

                @inputs << Input::C

                @inputs << Input::A

                @inputs << Input::CTRL

@> Conditional Branch : Script : keys_pressed?(@inputs)

  Script : p "Triggered!"

@> Branch End
 

Jason

Awesome Bro

Kain Nobel":22ana37d said:
PS; 12 buttons at a time? You're crazy dude!

Pfft, that's what they all say, then I show 'em a 28 button combination... :thumb:

Thanks for the help, I'll take a look through that and TRY to understand it and how to use it with a variable as you suggested, but it's gonna be damn hard...
 

Zeriab

Sponsor

One key at a time makes the problem significantly easier since you can get away with using Button Input Process.
I don't really get why you are so against having to scroll down. Sure it may take a little more effort to set it up, but the initial effort is lower and it doesn't seem too difficult to manage once you have created common events for the various atomic actions.
 

Jason

Awesome Bro

It's not only that, but as I've said, after so many conditional branches, the text moves to the right of the box, and my biggest combination idea (For something special), is a 28 button combination (Which I was telling Kain about), although it goes offscreen after 5/6 of them, so it's extremely hard to do.
 

Jason

Awesome Bro

Not scrolling DOWN, if you make;

A common event inside a common event inside a common event inside a common event inside a common event inside a common event inside a common event inside a common event inside a common event inside a common event inside a common event inside a common event inside a common event inside a common event inside a common event inside a common event inside a common event inside a common event inside a common event inside a common event inside a common event inside a common event inside a common event inside a common event. (How many is that ?)

It shifts to the right;

Code:
 

Common Event 1

  a common event inside

   a common event inside

    a common event inside

     a common event inside

      a common event inside

       a common event inside

        a common event inside

         a common event inside

         a common event

         end

        end

       end

      end

     end

    end

   end

  end

 end

end

 

And eventually you can't see the common events because they've shifted too much to the right and left the event box.

Just clicked on, those were meant to be conditional branches...
 

Thank you for viewing

HBGames is a leading amateur video game development forum and Discord server open to all ability levels. Feel free to have a nosey around!

Discord

Join our growing and active Discord server to discuss all aspects of game making in a relaxed environment. Join Us

Content

  • Our Games
  • Games in Development
  • Emoji by Twemoji.
    Top