Pages: [1]
  Print  
Author Topic: How do I get user input  (Read 200 times)
Online  (Male) hpg678
Posted on: May 23, 2017, 01:21:54 AM

Member
Location: Barbados
Joined: Mar 2017
Posts: 83

View Profile Email
I know that one can use 'get string' but it doesn't work even though the WIKI says it should. I have also highlighted GUI and gamemaker 5 compatibility, still doesn't work. I want to create a highscore table with the player's name + his score as the no1 highscore.

Any help will be appreciated
Logged
Hugar
Offline (Male) time-killer-games
Reply #1 Posted on: May 23, 2017, 05:14:45 AM

Member
Location: Virginia Beach
Joined: Jan 2013
Posts: 1051

View Profile WWW Email
I believe what you are looking for is keyboard_string

https://docs.yoyogames.com/source/dadiospice/002_reference/mouse,%20keyboard%20and%20other%20controls/keyboard%20input/keyboard_string.html

I could be wrong, but last time I checked this worked in enigma.

Code: [Select]
//Create Event - clear keystrokes for highscore table input
keyboard_string=""

//Draw Event - draw keyboard input
draw_text(x,y,keyboard_string) // I can't remember if these arguments are in the right order

//Enter Key Pressed Event - submit text entry
your_name=keyboard_string // use your_name as your resulting high score name to be recorded
keyboard_string="" // clear keyboard entry again
Logged
Online  (Male) hpg678
Reply #2 Posted on: May 24, 2017, 11:10:51 AM

Member
Location: Barbados
Joined: Mar 2017
Posts: 83

View Profile Email
thanks TKG .... I'm going to use it and create a dialog box for the user to input their name and record their score which will be displayed on a custom highscore table.


Logged
Hugar
Online  (Unknown gender) faissaloo
Reply #3 Posted on: June 26, 2017, 08:01:17 AM

Member
Joined: Jan 2013
Posts: 68

View Profile Email
I know that one can use 'get string' but it doesn't work even though the WIKI says it should. I have also highlighted GUI and gamemaker 5 compatibility, still doesn't work. I want to create a highscore table with the player's name + his score as the no1 highscore.

Any help will be appreciated
None of the GUI stuff works on Linux atm because the GTK devs are idiots. If you're on Windows however, go to Game Settings->WinAPI (or something to that effect like 'Windows', I forget the exact name) and get_string should work fine.
Logged
Online  (Male) hpg678
Reply #4 Posted on: June 26, 2017, 03:43:38 PM

Member
Location: Barbados
Joined: Mar 2017
Posts: 83

View Profile Email
thanks faissaloo  for the tip. I am attempting to create my own dialog functions but am having some difficulty  in parsing it to EML. For my project I have opt to create a sprite, use the keyboard string function and save it as a variable. however, I have realized that any characters typed on the keyboard during game play, end up as part of the string. Another problem stems from pressing "Enter" to save the string. It creates a line break which is kinda frustrating.



Logged
Hugar
Pages: [1]
  Print