ENIGMA Forums

Outsourcing saves money => Programming Help => Topic started by: hpg678 on May 23, 2017, 01:21:54 AM

Title: How do I get user input
Post by: hpg678 on May 23, 2017, 01:21:54 AM
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
Title: Re: How do I get user input
Post by: time-killer-games on May 23, 2017, 05:14:45 AM
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
Title: Re: How do I get user input
Post by: hpg678 on May 24, 2017, 11:10:51 AM
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.


Title: Re: How do I get user input
Post by: faissaloo on June 26, 2017, 08:01:17 AM
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.
Title: Re: How do I get user input
Post by: hpg678 on June 26, 2017, 03:43:38 PM
thanks faissaloo (http://enigma-dev.org/forums/index.php?action=profile;u=520)  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.



Title: Re: How do I get user input
Post by: The_Watcher on August 05, 2018, 12:39:05 PM
You have a myriad of professionally designed tools in the marketplace on the other side of the pond, why reinvent the wheel here when you have everything there.