5:54 I think the textbox should not be selected at start. If you set "selected = false;" then the textbox will be selected once you click on it and now we need a script to deselect it. What do you think?
my God, this is just what i'm trying to find for hours, really great, easy to follow, and very awesome tutorial :D thank you so much, you really saved my day :D
last video some one complained about something bothering them.... i couldn't post on that video not sure why (crappy chat system) but ignore that asshat your TuTs are awesome keep making them!
I've uploaded a smart memory example too. Link in the description. It has the ability to remember up to 10 previous inputs for each text box. Pressing the "Enter" key after typing in a box saves the input to a string array. Use the up and down arrow keys to scroll through previous inputs. I've also added a HUD on the right hand side so you can see what is stored in each text box's array. Let me know what you think.
A little tweak you guys might want, when you click the box the display of name disappears and the blink starts right away before typing to let the user know where they are typing. Very simple in your textbox's create event change the selected to false. Then in your textbox's drawevent, where you have if (text == " ") add to that if statement && (selected == false). So you will end up with something like this.. if (text == " ") && (selected == false) { draw_text(x, y, "NAME"); } What that will do is make the initial display of name disappear and start drawing the blink the moment you click on the textbox.
Now you can also expand on that a little if you add on to the code.. if (text == " ") && (selected == false) { draw_text(x, y, "NAME"); }else if (text == " ") && (selected == true) { draw_text(x, y, "NAME"); if (blink == true) { draw_text(x, y, "| "); } }else what this will do is give you a bar similar to youtube's search bar where it shows your blink with the display of name still there until you type.. Hehe sorry i like messing with codes and building sometimes hope this helps someone even though i'm late :) came here from your networking videos
Now it should be mentioned that at least newest GM:S version allows you to do draw_self(); instead of drawing sprite... EDIT: also in alarm0 event you can just do this: blink = !blink, basically it will toggle between true and false too, just less code. blink is true, so !blink (NOT true, is false), then when it's false, !blink is not false, but true.
i'm probably a few years to late on this, but, how could i have it so when i "left click" it selects the whole of the word, ready to be replaced by whatever i type next, instead of having to delete them letter by letter. thanks.
I guess it was going to control the alpha and some formatting of the text but the textboxes do that themselves so I should have deleted obj_text. You can ignore it.
thanks for this. I'm trying to change from one textbox to the other using the Tab key, and it isn't working. The tab gets hit and prints out my debug message but the 'selection' doesn't switch from one textbox to the other. My 'Any Key' for my textbox code is now below - do you have any idea why? I'm using Gamemaker 2. I know this video is old but I found it very helpful as I'm just learning GM2, thanks! if (selected == true) { if keyboard_check_pressed(vk_tab) { selected = false; obj_textbox_password.selected = true;
Hey I was curious to know how you would make it so if the user puts in text past a set width that the program would send the additional text to the line under. Example being if I wanted my user to be able to input a paragraph of information to be accessed later, how would I make it so the paragraph of words don't trail off the screen.
Great tutorial, helped me alot! Thanks! Is there any way to clear the text in the textboxes when you press done-button? So you don't have to erase the text manually if you want to enter new words in the boxes?
SlasherXGAMES I have a question I am modifying this to change the way it works like that it uses lstchar in place of keyboard string but i have a question how i can make it that if i place the cursor somewhere in the middle it will go there and i can add there
Now i have not checked if you already have made a tutorial of this..but can you make a tutorial of 2 different things, if you are able to. 1# how can i stop my player from moving/ running while i attack..it works fine with just standing and hitting in different directions, my character is told to if keyboard_check_pressed(ord("K")) &&facing_right==true || moving switch(sprite_index) case :spr_rightidle case: spr_runright case:hspeed hspeed=0; sprite_index=spr_attack_right; image_speed=1.2; audio_sound_play(snd_attack1,1,false); break; } } then back to idle when animation has ended.. But when i run and attack i only get GM to play the sound..while im running. I know this requires conditions..but all my conditions will not help, due to all of this is made in the step event..so i guess my character is trying to make the animation and stop but somehow the running animation is taking over due to "keyboard_check(ord"D")" and the attack is in the Event when key pressed K. I tried to have it in the step event also but no cigarr there either. Im doing something wrong..maybe i have to redirect the action to alarms and set a timer when to return to idle state?.. Okay that was a long one, but ive been struggling for about 1½ week with it in and out. Secondly, a video of a topdown rpg jumping. Like Alundra. If thats managable i reeeally want this in my game, due to my puzzle ideas for my game. Hope this wasnt to much, ;) Im thankful for answers! BR Bithium.
Hey I want to make this for android mobile (so i'm using gm studio), but if I click the text box, I dont get a keyboard. How can I make it so I get the keyboard popup?
jippie1912 The android virtual keyboard only works with get_string, get_string_async, get_int and get_int_async unfortunately. All of which are for debug input and aren't very nice to look at. I'll be making a tutorial on a custom virtual keyboard soon :)
SlasherXGAMES ™ Thankyou and fast reply :) But I am new to gamemaker and im noob in coding. So where do I need to typ get_string_async and get_int? I see a lot keyboard_string but I dont know where to place the other code.
Yeah, as the text from each textbox is stored in its variable txt, one can write this value to an ini file after it is captured. Check out my tutorial on using ini files here: Game Maker Tutorial - Working with ini files
Hey! You're video helped me out a lot, but I have a quick question: How would I go about displaying the text that is input into the different boxes, in another textbox in a different room? For example if a player put their name as "Billy" How would i get another textbox in another room to display their name? The draw_text() function always gives me a push execution error
+LegitBrowniesGaming Well, the text variable of each input box only lasts as long as the object is in existence. How about you save this variable to a global variable before changing rooms and then set the new text box's text variable to that of the global variable when it is created in the new room? :)
+SlasherXGAMES ™ Thanks for the tutorial, it was great. Is there a way to stop the player from entering more the a particular amount of characters. Like, I don't want the player to make his name 100 characters long.
I am releasing my first game next year and this was insanely helpful. Thank you so much for all of your videos. I have one question that I hope I can find a work around. I know that using "#" will created a line break, and I don't want the system to glitch if a player uses that character. Is there an easy way to include that character or remove it from being used altogether? Thank you for your help.
+Andres Reyes I actually got it working. txt = string_lettersdigits(keyboard_string); This will remove all characters except for Numbers and Letters, making this an easy solution.
hi, i got a problem with the textbox. can u help me please? even though you don't select the textbox you can already input texts. i only have one textbox. thank you.
I can't get this to work in GM: Studio Pro 1.2.1135. I'm using a single text box setup. The code is good with no errors, the text box does not seem to be clickable, and you can not type anything.
Try import the .gmk of this tutorial into Studio and run it. If it runs and all works as in the video then there is something wrong with your code. Compare the code in the tutorial with the way you have done it and look for differences that may cause your problems. Make sure that when you click the box that it sets selected = true for the textbox. The variable "selected" determines if text appears when one types.
This is irrelevant since this tut was 4 years ago but I just wanted to let anyone else with this problem know is that it is because your text is drawing BEHIND the text box. It worked when I made the text box clear
Shouldn't you initialize the "selected" variable of obj_textbox as false? If not, then you can write in both name and surname boxes at the same time without having clicked any of them.
I've just initialized the name textbox's selected variable to true assuming that the player would type his/her name before surname. You could initialize both to false so that the boxes wait for one of them to be clicked before enabling text input. Do remember that clicking on the one disables the other to prevent text displaying in both at the same time. If both are set to selected = true, then the same text will appear in both.
I'm using these to create a question and answer system in my game. I had a problem where if someone answered a question and moved onto the next question, their previous answer would still be there. In essence, the text typed in beforehand wasn't cleared. I tried setting both the "txt" variable and "keyboard_string" to undefined, but instead of actually setting the variable to nothing, it would type out the word "undefined" in the textbox. Anyone have an idea on how to fix this?
I tried using the input in math and it always says its wrong and when i print the question and the answer they are the same, anyone know a way around this?
Game Reactions You're already saving the entered string with the following code: name = obj_textbox.txt; You could make that global instead if it is to be used throughout your game: global.name = obj_textbox.txt; Then whenever an NPC wants to use the player's name, place the global.name variable in the output string.
Hey dude, really great video, thanks for uploading, it helped me progress on my computer science assignment! Sorry to bother you on a 2 and a half year old video but it seems whatever input I have entered before accessing the room with the text box, as soon as I input the first character any prior inputs are slotted in before it. For example my beginning screen is a "press any key to continue" and if I had pressed, say the letter "h", once I got to the room with the text box it would appear normal with the message that it should have when it is blank, but once I begin typing, the letter "h" will appear before whatever character I had just input. This also occurs if I had pressed multiple characters before hand, all of which are slotted in. Normally this bug would just be a minor annoyance but it's fairly detrimental to my game as it is essentially a speed typing game. I'd very much appreciate your input here, I was thinking something along the lines of somehow removing previous inputs in the create event of the text box? I'm not sure how I would do this, however. Thank you so much!
Hi, can u help me please? "FATAL ERROR in action number 1 of Keyboard Event for Key for object obj_textbox: Push :: Execution Error - Variable Get -1.max_width(100000, -1) at gml_Object_obj_textbox_Keyboard_1 (line 3) - if (string_width(keyboard_string) < max_width) //if keyboard_string's width is smaller than the maximum"
Jaxi Each textbox needs to have a variable called max_width to ensure the player doesn't type too many characters. Check you textbox's create event code for: max_width=300;//could be any integer depending on the length of your textbox :D
I thought for a moment that I did something wrong, but I downloaded your gmk file and imported it into my newest version of game maker studio. (not gms2 mind you, just gms) Anyways, Upon test running your file I realized that it doesn't work in the new version of game maker studio, as the program you're using is game maker 8.0 I believe? I'm not mad or anything, as I'm going to try to fix it to work in gms, but could you edit the title to mention that it only works in your version? (or at least say in the description that it doesn't work in game maker studio?) Thanks! Have a good day!
Hi, I wouldn't mind recreating this video in GMS2. It is in dire need of an upgrade and many people still find it useful. It might be a little easier adapting to GMS from 2 than from GM 8. Is there any part you found challenging recreating in GMS? The code should still be compatible.
GravityShift Games I can personally send you the file to first make sure I didn't do anything wrong and I can give you direct feed footage of the test run and how it looks in engine if you would like
if(can_click == true); { selected = true; //the player has selected the textbox keyboard_string = txt; } (error, in event "Left Button Pessed, action number 1 at line number 1.) What can i do to fix this error? (If it helps any, I am using the newer version of Game Maker Studio, Not the Steam Version.)
What's the full error? but from the way you typed that I see an error right away.. If you are getting unexpected symbol that is because when you write an if statement you do not include " ; " at the end. so your post if(can_click == true); should actually be if(can_click == true)
SlasherXGAMES ™ hey dude, i did this tutorial but for the game im working on i dont particularly want text but rather numbers, and the event is not working for me. is there any way to use numbers 0-9 in GM alone?
I wish there was a D&D for text entry. I want the player to be able to type messages to NPCs and they can understand them. The game doesn't pause while this is happening tho(just like real life).
Not pausing during interaction is a smart move. I'm sure it's possible to D&D the text input. Below is an example. Be warned, I'm not a D&D expert, but I'm sure it'll work: For textbox press any key event: Test variable: variable = selected, value = true, operation = equal to. Start of Block. Test variable: variable = string_width(keyboard_string), value = max_width, operation = smaller than. Start of Block. Set variable txt, value = keyboard_string. End of Block Else. Start of Block. Set variable keyboard_string, value = txt. End of Block. End of Block. Just read the code line by line and convert it to D&D. It'll take a while but it is possible. Then you could use some string handling functions to parse the input and then have your NPC respond to words it recognizes.
What I do if: ERROR in action number 1 of Draw Event for object object7:Error in code at line 4: draw_text(x, y, txt); //draw the text ^ at position 18: Unknown variable txtBy the way: I have lite version.
Solved: I added an if statement thatbif lastchar of keyboard is "#" then keyboard string = txt slasher i have a question if you press # with ALT GR it goes down how can i make it check that and do nothing when that happens
So i am PRO on this stuff so i ganna tell best error EVER ( I creating game with register and login yea, so i have this problem - unknown variable txt ( solution = in the create event write in obj_textbox_1 && 2 write text = 0 if you see text = "" so leave it there we need that )
This video is way too long. The best tutorials are the short ones. It is not that my attention span is lacking here, just the fact that if you cannot cannot explain something simply, then you might not understand it well enough. This is very unconcise.
garagavia While I do agree with you to a certain degree, some things should not be rushed. While yes if I had to do this video again with the tutorial making experience I have now, I could make it slightly shorter. I think you mean to say this video is quite prolix. I'll be sure to keep this in mind for future videos. Thanks for stopping by :)
SlasherXGAMES ™ This is exactly what i mean. Think short, both content wise and word wise. Go in deapth where necesary, but do not cover or talk too much when it is not. Thanks for taking my mean feedback to heart, it shows character.
Be sure to subscribe for more great videos ruclips.net/channel/UCAumdO1yv-di4fI6IZQIy3Q
Thank you helped a lot, I've been trying to find gml code as easy as this for ages now. Will definitely be giving credit in my current project.
You're welcome!
Nice - pretty much what I was looking for. A little pacey towards the end there, but realise you had to "get there". Thank you.
+Nathan Laing, You're more than welcome :)
Thanks dude! Working on a project for school and you realllyyy helped me with this tutorial !
+Matix Gaming, No prob bud! Good luck with your project :)
LOL thank you dude, im doing a "who's that pokemon" quiz in game maker and i wanted to write the name now i know how thank you again :3
5:54 I think the textbox should not be selected at start.
If you set "selected = false;" then the textbox will be selected once you click on it
and now we need a script to deselect it.
What do you think?
IT'S ALIVE!!! Thanks bro ;D
my God, this is just what i'm trying to find for hours,
really great, easy to follow, and very awesome tutorial :D
thank you so much, you really saved my day :D
Good tutorial! And might I say, you have an amazing & captivating voice.
last video some one complained about something bothering them.... i couldn't post on that video not sure why (crappy chat system) but ignore that asshat your TuTs are awesome keep making them!
I've uploaded a smart memory example too. Link in the description. It has the ability to remember up to 10 previous inputs for each text box. Pressing the "Enter" key after typing in a box saves the input to a string array. Use the up and down arrow keys to scroll through previous inputs. I've also added a HUD on the right hand side so you can see what is stored in each text box's array. Let me know what you think.
A little tweak you guys might want, when you click the box the display of name disappears and the blink starts right away before typing to let the user know where they are typing. Very simple in your textbox's create event change the selected to false. Then in your textbox's drawevent, where you have if (text == " ") add to that if statement && (selected == false). So you will end up with something like this..
if (text == " ") && (selected == false)
{
draw_text(x, y, "NAME");
}
What that will do is make the initial display of name disappear and start drawing the blink the moment you click on the textbox.
Now you can also expand on that a little if you add on to the code..
if (text == " ") && (selected == false)
{
draw_text(x, y, "NAME");
}else
if (text == " ") && (selected == true)
{
draw_text(x, y, "NAME");
if (blink == true)
{
draw_text(x, y, "| ");
}
}else
what this will do is give you a bar similar to youtube's search bar where it shows your blink with the display of name still there until you type.. Hehe sorry i like messing with codes and building sometimes hope this helps someone even though i'm late :) came here from your networking videos
Excellent. Thanks for expanding on this solution with some clever ideas. Well done. Enjoy the networking vids :)
Now it should be mentioned that at least newest GM:S version allows you to do draw_self(); instead of drawing sprite...
EDIT: also in alarm0 event you can just do this:
blink = !blink, basically it will toggle between true and false too, just less code.
blink is true, so !blink (NOT true, is false), then when it's false, !blink is not false, but true.
lol i was waiting for that error! great tut btw
Great tutorial! It worked out great!
Thanks. I'm glad all went well!
Wow, very very useful. Thank you :)
You sir are awesome!!!!
+Jonni Hirst Haha, thanks!
Great tutorial! Just what I was looking for. But what did we need "obj_text" for? You didn't put it in the room and it wasn't a parent object
TheBroman90 Yeah, I changed my mind on that mid object way through. You don't need it at all :P
i'm probably a few years to late on this, but, how could i have it so when i "left click" it selects the whole of the word, ready to be replaced by whatever i type next, instead of having to delete them letter by letter. thanks.
by making the variable holding the keyboard data = " "; this will erase all data;
Thank you So much :D
This Video was very helpful to me!
It work, thanks you very much
I guess it was going to control the alpha and some formatting of the text but the textboxes do that themselves so I should have deleted obj_text. You can ignore it.
thanks for this. I'm trying to change from one textbox to the other using the Tab key, and it isn't working. The tab gets hit and prints out my debug message but the 'selection' doesn't switch from one textbox to the other. My 'Any Key' for my textbox code is now below - do you have any idea why? I'm using Gamemaker 2. I know this video is old but I found it very helpful as I'm just learning GM2, thanks!
if (selected == true)
{
if keyboard_check_pressed(vk_tab)
{
selected = false;
obj_textbox_password.selected = true;
show_debug_message("hitting tab");
}
else
{
if (string_width(keyboard_string) < max_width)
{
untxt = keyboard_string;
}
else
{
keyboard_string = untxt;
}
}
}
Hi - I figured it out...I wasn't clearing the Tab from the keyboard_press...so it was hitting it twice. needed keyboard_clear(vk_tab)
Hey I was curious to know how you would make it so if the user puts in text past a set width that the program would send the additional text to the line under. Example being if I wanted my user to be able to input a paragraph of information to be accessed later, how would I make it so the paragraph of words don't trail off the screen.
+gyptice something like "if string length > max_width then txt += #; max_width += maxwidth"?
# to create a new line of course.
Perfect tutorial, Muchas gracias !! :D
Great tutorial, helped me alot! Thanks! Is there any way to clear the text in the textboxes when you press done-button? So you don't have to erase the text manually if you want to enter new words in the boxes?
Just add obj_textbox_1.txt = "";
obj_textbox_2.txt = "";
for when the button is pressed.
SlasherXGAMES I have a question I am modifying this to change the way it works like that it uses lstchar in place of keyboard string but i have a question how i can make it that if i place the cursor somewhere in the middle it will go there and i can add there
Now i have not checked if you already have made a tutorial of this..but can you make a tutorial of 2 different things, if you are able to. 1# how can i stop my player from moving/ running while i attack..it works fine with just standing and hitting in different directions, my character is told to
if keyboard_check_pressed(ord("K")) &&facing_right==true || moving
switch(sprite_index)
case :spr_rightidle
case: spr_runright
case:hspeed
hspeed=0;
sprite_index=spr_attack_right;
image_speed=1.2;
audio_sound_play(snd_attack1,1,false);
break;
}
}
then back to idle when animation has ended.. But when i run and attack i only get GM to play the sound..while im running. I know this requires conditions..but all my conditions will not help, due to all of this is made in the step event..so i guess my character is trying to make the animation and stop but somehow the running animation is taking over due to "keyboard_check(ord"D")" and the attack is in the Event when key pressed K. I tried to have it in the step event also but no cigarr there either. Im doing something wrong..maybe i have to redirect the action to alarms and set a timer when to return to idle state?.. Okay that was a long one, but ive been struggling for about 1½ week with it in and out.
Secondly, a video of a topdown rpg jumping. Like Alundra. If thats managable i reeeally want this in my game, due to my puzzle ideas for my game.
Hope this wasnt to much, ;) Im thankful for answers!
BR
Bithium.
Hey I want to make this for android mobile (so i'm using gm studio), but if I click the text box, I dont get a keyboard. How can I make it so I get the keyboard popup?
jippie1912 The android virtual keyboard only works with get_string, get_string_async, get_int and get_int_async unfortunately. All of which are for debug input and aren't very nice to look at. I'll be making a tutorial on a custom virtual keyboard soon :)
SlasherXGAMES ™ Thankyou and fast reply :) But I am new to gamemaker and im noob in coding. So where do I need to typ get_string_async and get_int? I see a lot keyboard_string but I dont know where to place the other code.
SlasherXGAMES ™ Can you pls help me with this?
Good tutorial ! Thanks !!!
anyway to make that in one object ?
Hi , do you have an example which you can send the value keyed in the textbox into notepad/ txt file?
Yeah, as the text from each textbox is stored in its variable txt, one can write this value to an ini file after it is captured. Check out my tutorial on using ini files here: Game Maker Tutorial - Working with ini files
Hey! You're video helped me out a lot, but I have a quick question:
How would I go about displaying the text that is input into the different boxes, in another textbox in a different room?
For example if a player put their name as "Billy"
How would i get another textbox in another room to display their name?
The draw_text() function always gives me a push execution error
+LegitBrowniesGaming Well, the text variable of each input box only lasts as long as the object is in existence. How about you save this variable to a global variable before changing rooms and then set the new text box's text variable to that of the global variable when it is created in the new room? :)
+SlasherXGAMES ™ Thanks for the tutorial, it was great.
Is there a way to stop the player from entering more the a particular amount of characters. Like, I don't want the player to make his name 100 characters long.
+Anthony Williams that's what max_width is for - it's set to 400 in the tutorial but if you want the limit to be less you can decrease it.
I am releasing my first game next year and this was insanely helpful. Thank you so much for all of your videos. I have one question that I hope I can find a work around. I know that using "#" will created a line break, and I don't want the system to glitch if a player uses that character. Is there an easy way to include that character or remove it from being used altogether? Thank you for your help.
+Andres Reyes I actually got it working. txt = string_lettersdigits(keyboard_string); This will remove all characters except for Numbers and Letters, making this an easy solution.
+Andres Reyes Good piece of info. Just working on my first releasable game too. What's your game called btw?
hi, i got a problem with the textbox. can u help me please? even though you don't select the textbox you can already input texts. i only have one textbox. thank you.
Jerome Zantua Yeah, I can help :D
Make sure the variable 'selected' is set to false in the Create event of that textbox.
When is obj_text used? There is no reference to it in the code :O
I can't get this to work in GM: Studio Pro 1.2.1135. I'm using a single text box setup. The code is good with no errors, the text box does not seem to be clickable, and you can not type anything.
Try import the .gmk of this tutorial into Studio and run it. If it runs and all works as in the video then there is something wrong with your code. Compare the code in the tutorial with the way you have done it and look for differences that may cause your problems. Make sure that when you click the box that it sets selected = true for the textbox. The variable "selected" determines if text appears when one types.
This is irrelevant since this tut was 4 years ago but I just wanted to let anyone else with this problem know is that it is because your text is drawing BEHIND the text box. It worked when I made the text box clear
ACTUALLY, it is because the text is the same colour as the text box.
Shouldn't you initialize the "selected" variable of obj_textbox as false? If not, then you can write in both name and surname boxes at the same time without having clicked any of them.
I've just initialized the name textbox's selected variable to true assuming that the player would type his/her name before surname. You could initialize both to false so that the boxes wait for one of them to be clicked before enabling text input. Do remember that clicking on the one disables the other to prevent text displaying in both at the same time. If both are set to selected = true, then the same text will appear in both.
I'm using these to create a question and answer system in my game. I had a problem where if someone answered a question and moved onto the next question, their previous answer would still be there. In essence, the text typed in beforehand wasn't cleared. I tried setting both the "txt" variable and "keyboard_string" to undefined, but instead of actually setting the variable to nothing, it would type out the word "undefined" in the textbox. Anyone have an idea on how to fix this?
i wish you actually taught me something
Hi, what was the point of the obj_text? You never used it in any room. Thanks!
+xDDufiosy Yeah, ignore it. The solution I arrived to in the end didn't need it.
I tried using the input in math and it always says its wrong and when i print the question and the answer they are the same, anyone know a way around this?
good work!
How do you make it so that an npc where to say your name in a dialogue, whatever the name you have
?
Game Reactions
You're already saving the entered string with the following code:
name = obj_textbox.txt;
You could make that global instead if it is to be used throughout your game:
global.name = obj_textbox.txt;
Then whenever an NPC wants to use the player's name, place the global.name variable in the output string.
Thanks very much! Ive already subscribed :)
Hey dude, really great video, thanks for uploading, it helped me progress on my computer science assignment! Sorry to bother you on a 2 and a half year old video but it seems whatever input I have entered before accessing the room with the text box, as soon as I input the first character any prior inputs are slotted in before it. For example my beginning screen is a "press any key to continue" and if I had pressed, say the letter "h", once I got to the room with the text box it would appear normal with the message that it should have when it is blank, but once I begin typing, the letter "h" will appear before whatever character I had just input. This also occurs if I had pressed multiple characters before hand, all of which are slotted in.
Normally this bug would just be a minor annoyance but it's fairly detrimental to my game as it is essentially a speed typing game. I'd very much appreciate your input here, I was thinking something along the lines of somehow removing previous inputs in the create event of the text box? I'm not sure how I would do this, however. Thank you so much!
Never mind! I fixed it! In the create event of the textbox, I set the keyboard_string = "" and this solved the issue! Thanks again for the video!
+DaMadMoose Glad everything is working :)
there are two types of programmers:
if (check) {
variable;
}
and
if (check)
{
variable;
}
Lol, im the first one
Second...lol
First one!!!
second
both sometimes first sometimes second
thank you so much it worked great!!
Hi, can u help me please?
"FATAL ERROR in
action number 1
of Keyboard Event for Key
for object obj_textbox:
Push :: Execution Error - Variable Get -1.max_width(100000, -1)
at gml_Object_obj_textbox_Keyboard_1 (line 3) - if (string_width(keyboard_string) < max_width) //if keyboard_string's width is smaller than the maximum"
Jaxi Each textbox needs to have a variable called max_width to ensure the player doesn't type too many characters. Check you textbox's create event code for:
max_width=300;//could be any integer depending on the length of your textbox :D
I can't get this to work in GM: Studio Pro 1.2.1224.
Well It's A Game Maker 8.1 Download!
Is it any diffrent from Game Maker Studio
No, it isn't, Studio is a updated version, it can do more than this one, but it'll work :D
helloe sir, sir i have a problem.. every time i move onto the next room or back the input box is still there... please help sir...
did you make it persistant?
hahaha... yes... i figured it out after i post this question but thanks for the response :D
np
I thought for a moment that I did something wrong, but I downloaded your gmk file and imported it into my newest version of game maker studio. (not gms2 mind you, just gms) Anyways, Upon test running your file I realized that it doesn't work in the new version of game maker studio, as the program you're using is game maker 8.0 I believe? I'm not mad or anything, as I'm going to try to fix it to work in gms, but could you edit the title to mention that it only works in your version? (or at least say in the description that it doesn't work in game maker studio?) Thanks! Have a good day!
Hi, I wouldn't mind recreating this video in GMS2. It is in dire need of an upgrade and many people still find it useful. It might be a little easier adapting to GMS from 2 than from GM 8. Is there any part you found challenging recreating in GMS? The code should still be compatible.
GravityShift Games I can personally send you the file to first make sure I didn't do anything wrong and I can give you direct feed footage of the test run and how it looks in engine if you would like
I see, somehow i did it in a different way, great tutorial btw =)
Great Job
Does anyone know how to detect keys like / and : using keyboard_check_pressed?
go to the built in help index for a full list
anyone know how to type a straight line?
nevermind
I'm glad you figured it out. Thanks for watching :)
if(can_click == true);
{
selected = true; //the player has selected the textbox
keyboard_string = txt;
} (error, in event "Left Button Pessed, action number 1 at line number 1.)
What can i do to fix this error? (If it helps any, I am using the newer version of Game Maker Studio, Not the Steam Version.)
What's the full error? but from the way you typed that I see an error right away.. If you are getting unexpected symbol that is because when you write an if statement you do not include " ; " at the end. so your post
if(can_click == true);
should actually be
if(can_click == true)
Hey Nice Tutorial. I have a question: Can you tell me how I can display it like a password with ****** or similar?
Sorry, found already a solution
I'm glad you found a solution to your problem :)
I've got no fonts(
Is it just me or is obj_text not even used?
I didn't understand this too. He didn't instance it any time.
Yeah, I didn't bother creating the "obj_text" in the first place, and yep, everything works fine
SlasherXGAMES ™ hey dude, i did this tutorial but for the game im working on i dont particularly want text but rather numbers, and the event is not working for me. is there any way to use numbers 0-9 in GM alone?
+Matthew Subrattie Something like text = string_digits(text); should do.
I wish there was a D&D for text entry. I want the player to be able to type messages to NPCs and they can understand them. The game doesn't pause while this is happening tho(just like real life).
Not pausing during interaction is a smart move.
I'm sure it's possible to D&D the text input. Below is an example. Be warned, I'm not a D&D expert, but I'm sure it'll work:
For textbox press any key event:
Test variable: variable = selected, value = true, operation = equal to.
Start of Block.
Test variable: variable = string_width(keyboard_string), value = max_width, operation = smaller than.
Start of Block.
Set variable txt, value = keyboard_string.
End of Block
Else.
Start of Block.
Set variable keyboard_string, value = txt.
End of Block.
End of Block.
Just read the code line by line and convert it to D&D. It'll take a while but it is possible.
Then you could use some string handling functions to parse the input and then have your NPC respond to words it recognizes.
thanks v useful tute.
What I do if: ERROR in
action number 1
of Draw Event
for object object7:Error in code at line 4:
draw_text(x, y, txt); //draw the text
^
at position 18: Unknown variable txtBy the way: I have lite version.
You need to declare and set a value for the variable txt before you use it i the draw event. I.e. In your create have:
txt = "";
thanks!
nice one
Thank you :)
Solved: I added an if statement thatbif lastchar of keyboard is "#" then keyboard string = txt
slasher i have a question if you press # with ALT GR it goes down how can i make it check that and do nothing when that happens
thanks
when use this
in android
no show keyboard
plaese help me
I've got all my volume at max and I can still barely hear you cmon
+RunAndGunGamer23 my volume on my PC is at half, same for youtube, my headphone direct audio is 2/3rds, and i hear him fine.
I'm deaf as a post can hear him fine too.
too bad it doesn't work with GM: Studio :-(
+Roach Ant, The concept isn't version specific. You'll find me using this method in many of my Studio tutorials too.
+SlasherXGAMES ™ the else and alarm function does not work in studio
اشتركوا في قناتي هتعجبكم جدا وليصلكم كل جديد 🆕 ومفيد واتفرجوا علي كل ع
So i am PRO on this stuff so i ganna tell best error EVER ( I creating game with register and login yea, so i have this problem - unknown variable txt ( solution = in the create event write in obj_textbox_1 && 2 write text = 0 if you see text = "" so leave it there we need that )
This video is way too long. The best tutorials are the short ones. It is not that my attention span is lacking here, just the fact that if you cannot cannot explain something simply, then you might not understand it well enough. This is very unconcise.
garagavia While I do agree with you to a certain degree, some things should not be rushed. While yes if I had to do this video again with the tutorial making experience I have now, I could make it slightly shorter. I think you mean to say this video is quite prolix. I'll be sure to keep this in mind for future videos. Thanks for stopping by :)
SlasherXGAMES ™ This is exactly what i mean. Think short, both content wise and word wise. Go in deapth where necesary, but do not cover or talk too much when it is not. Thanks for taking my mean feedback to heart, it shows character.
garagavia Cool beans man :)
This video must be shorter