playMaker

Author Topic: User-entered Text (for highscore)? [SOLVED]  (Read 8804 times)

4ppleseed

  • Full Member
  • ***
  • Posts: 226
User-entered Text (for highscore)? [SOLVED]
« on: May 19, 2013, 04:52:51 PM »
Hi chaps,
I'm making a highscore table. How do I let the player enter their name which is then stored to a variable? I've looked at some of the GUILayout stuff but can't work it out - any tips?
« Last Edit: May 28, 2013, 02:31:27 PM by dlmrky »

jeanfabre

  • Administrator
  • Hero Member
  • *****
  • Posts: 15500
  • Official Playmaker Support
Re: User-entered Text (for highscore)?
« Reply #1 on: May 20, 2013, 01:28:27 AM »
Hi,

 There is a "GuiLayout Text Field" action for this. Do you struggle with this or with GUI layout in general?

bye,

 Jean

4ppleseed

  • Full Member
  • ***
  • Posts: 226
Re: User-entered Text (for highscore)?
« Reply #2 on: May 20, 2013, 11:34:38 AM »
I suppose I'm struggling with the implimentation. Do I just add a Text Field to an empty object & when the game is running it picks up all key input from the player? I tried previously & it would just be an empty box on the screen. Are there any tutorials on how to set it up fully?

doppelmonster

  • Full Member
  • ***
  • Posts: 157
    • Grinder Games
Re: User-entered Text (for highscore)?
« Reply #3 on: May 20, 2013, 06:57:18 PM »
You just attach a variable to the textfield in the action. If the gui layout action is fired the user can click on the textfield and can then input text, which is stored in the attached string var. Thats it.

jeanfabre

  • Administrator
  • Hero Member
  • *****
  • Posts: 15500
  • Official Playmaker Support
Re: User-entered Text (for highscore)?
« Reply #4 on: May 21, 2013, 02:02:22 AM »
Hi,

 Ok, please find a working sample of a GUILayout text field, one state lets you input, then you click done, and you move to another state showing the text you just input, and you can go back from there to edit the text again.

 Tell me if that helps you understand how to set things up. Else, can you describe what you want to achieve more in details, thanks :)

bye,

 Jean

4ppleseed

  • Full Member
  • ***
  • Posts: 226
Re: User-entered Text (for highscore)?
« Reply #5 on: May 21, 2013, 07:19:43 PM »
Hi Jean, thanks for your example - I wouldn't have got it working today without it!  8)

4ppleseed

  • Full Member
  • ***
  • Posts: 226
Re: User-entered Text (for highscore)?
« Reply #6 on: May 22, 2013, 02:51:19 PM »
ONe last thing if you don't mind:

I want to be able to enter a name of up to 6 characters. I've set the character limit to 6 and when you fill out the text box like this 'dddddd' it works fine.


But if you press a character and then press return you can make the text box drop down to a new line and then if you press Done - it no longer lines up on the high score table.



Any way I can stop players being able to press return or have the textbox just on one line?

jeanfabre

  • Administrator
  • Hero Member
  • *****
  • Posts: 15500
  • Official Playmaker Support
Re: User-entered Text (for highscore)?
« Reply #7 on: May 23, 2013, 01:10:31 AM »
Hi,

 yes, you have to catch for the return key ( with the action "get key down" I would say) in the fsm and process the text at this point.

bye,

 Jean

Gevarre

  • Playmaker Newbie
  • *
  • Posts: 49
Re: User-entered Text (for highscore)?
« Reply #8 on: May 24, 2013, 02:20:52 PM »
To make setting this action up a bit easier, would it be possible to add a check box labeled something like "Return Stores Input", or "Disable Carriage Return" to handle this automatically? There would then also be the usual field in the action to select what event to send when return is hit.

I ask only because most people by default expect to be able to just hit the enter key when they are done typing, regardless of whether or not there is an additionional "done" button. Also, this would be the default behaviour most of the time, with the additional lines usually only being used for things like word processing, not something commonly found in games. Even in chat, text should just wrap around on long messages with the Return key only being used to send the message.

Just a thought :)
« Last Edit: May 24, 2013, 02:32:51 PM by Gevarre »

4ppleseed

  • Full Member
  • ***
  • Posts: 226
Re: User-entered Text (for highscore)?
« Reply #9 on: May 27, 2013, 10:51:12 AM »
Hi,

 yes, you have to catch for the return key ( with the action "get key down" I would say) in the fsm and process the text at this point.

bye,

 Jean

I've tested this and I don't think it's possible. When you click on the Text Field and it's in edit mode, you can't seem to execute any other FSM.

4ppleseed

  • Full Member
  • ***
  • Posts: 226
Re: User-entered Text (for highscore)?
« Reply #10 on: May 27, 2013, 10:52:17 AM »
To make setting this action up a bit easier, would it be possible to add a check box labeled something like "Return Stores Input", or "Disable Carriage Return" to handle this automatically? There would then also be the usual field in the action to select what event to send when return is hit.

I ask only because most people by default expect to be able to just hit the enter key when they are done typing, regardless of whether or not there is an additionional "done" button. Also, this would be the default behaviour most of the time, with the additional lines usually only being used for things like word processing, not something commonly found in games. Even in chat, text should just wrap around on long messages with the Return key only being used to send the message.

Just a thought :)

Yes please. Something like this  8)

jeanfabre

  • Administrator
  • Hero Member
  • *****
  • Posts: 15500
  • Official Playmaker Support
Re: User-entered Text (for highscore)?
« Reply #11 on: May 28, 2013, 07:36:27 AM »
Hi,

 here we go:

http://hutonggames.com/playmakerforum/index.php?topic=4010.0

 it's better than modified actions, it's actually a new action that you just put before the textfield action.

bye,

 Jean

4ppleseed

  • Full Member
  • ***
  • Posts: 226
Re: User-entered Text (for highscore)?
« Reply #12 on: May 28, 2013, 02:31:04 PM »
That's very kind of you Jean, it works perfectly. Thank you.

cb

  • Junior Playmaker
  • **
  • Posts: 66
Re: User-entered Text (for highscore)? [SOLVED]
« Reply #13 on: August 06, 2013, 05:09:23 PM »
This action seemed to be the answer I was looking for, however while it works on my Mac while testing my app, I can't get it to work while running on my Blackberry Z10. On inputting a name to the text field, pressing Enter simply hides the onscreen keyboard and the app just sits there.

How can I get the app to recognise a Return press and fire off an event on my device?

jeanfabre

  • Administrator
  • Hero Member
  • *****
  • Posts: 15500
  • Official Playmaker Support
Re: User-entered Text (for highscore)? [SOLVED]
« Reply #14 on: August 08, 2013, 03:29:01 AM »
Hi,

 Have you tried actually "KeypadEnter" instead of "Return".

Bye,

Jean