GameSalad

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Accepting 2 inputs in sequence

This is so odd. I have to be missing something, but have no idea how to proceed. In my latest venture, I'm trying to have my project accept two numeric inputs using the keyboard, I'm trying to use the KEY input in a Rule to populate two global game attributes, From and To (where to move FROM and where to move TO). Every time I try and test it, it accepts the first input, but then immediately makes the second input the same value (meaning To becomes From as well).

I've tried all sorts of testing before the second input, but can't get it to work. Any ideas? I also was toying around with using timers, but didn't have any luck with those, and I remember reading on here that using timers was something we didn't want to do unless we absolutely had to.

Here's my scenario:

2 integer game attributes, From and To; both set to 0 (zero).

1 actor, button, with two Rule blocks:

1st Rule Block: If game.From = 0 then Do Rule Block: Receive key press "1" (one) is Down, then Do Change Attribute game.From to "1" (one)

2nd Rule Block: If game.From > 0 AND game.To = 0 then Do Rule Block: Receive key press "2" (two) is Down, then Do Change Attribute game.To to "2" (two)

Each of these two Rule Blocks has two additional Rule blocks in the Do portion of the initial Rule Block to check for key press of 1, 2, or 3, so the person is supposed to be able to specify a 1, 2, or 3 for the From input and then a 1, 2, or 3 for the To input.

Any help would really be appreciated. Thanks ahead of time.

Dave Weeks

Comments

  • zweg25zweg25 Posts: 738Member

    Quick Demo. Hope it helps

  • dotorandotoran Posts: 8Member

    zweg25,

    Thanks for sharing the example. I notice it's using the keyboard input block to grab the values, but I don't like the way it covers the entire screen in order to grab the value.

    This is why I wanted to use the KEY Rule Block check, so it could constantly be on the lookout for an appropriate keystroke, without interrupting the look of the screen.

    Can you think of an alternative method that doesn't use the keyboard input block?

    Thanks for sharing,

    Dave

    PS: How'd you share the project in your post? I wanted to include my file for reference, but didn't know how to include it in the post.

  • tatiangtatiang Posts: 11,790Member, Sous Chef, PRO, Senior Sous-Chef

    @dotoran You have to be a Pro member to attach files. You can upload your project folder (compress it as a .zip file first) to a file-sharing site and then post the download link here.

    New to GameSalad? (FAQs)   |   Tutorials   |   Templates   |   Greenleaf Games   |   Educator & Certified GameSalad User

  • dotorandotoran Posts: 8Member

    Thanks Tatiang. Becoming a Pro is sounding much more appealing these days...

    Any takers on a solution to my initial woes though?

Sign In or Register to comment.