User Set Text

Get help using Construct 2

Post » Tue Sep 20, 2011 6:43 am

Don't click the link, copy it to the url bar.
Or click here.

@simwhi thanks for the share.

Kyatric2011-09-20 06:43:40
New to Construct ? Where to start

Image Image
Image Image

Please attach a capx to any help request or bug report !
Moderator
B
247
S
85
G
40
Posts: 6,998
Reputation: 57,791

Post » Tue Sep 20, 2011 6:55 am

Ah thanks. Excited to see how this works.
B
4
G
2
Posts: 44
Reputation: 1,088

Post » Tue Sep 20, 2011 7:07 am

I did copy the public link but I'm not sure what went wrong. I've fixed the problem now. Click on the link above again.

Sorry about that!!!
B
26
S
5
G
5
Posts: 151
Reputation: 6,279

Post » Tue Sep 20, 2011 7:10 am

No problem Kyatric. Let me know if there is a better way of doing it. I'm still learning!!!!
B
26
S
5
G
5
Posts: 151
Reputation: 6,279

Post » Tue Sep 20, 2011 8:03 am

I think I am going to try and mess with it and see if there is a way to have it so that when you type a letter on the keyboard, it tells the program to type that. Do you have a way so that the final name or word can be recognized as a value and be given to something, like say, a save game file?
B
4
G
2
Posts: 44
Reputation: 1,088

Post » Tue Sep 20, 2011 8:36 am

You can do it by adding an event for each key you want to use. I used the clickable keyboard approach because I couldn't find a way of capturing a key press event for all keys (A-Z). I didn't want to create an event for each key pressed.

If someone knows of a better way I'd love to know.

If I understand what you mean correctly, you can compare whatever the user types to another text box or variable adding an ENTER key event.

B
26
S
5
G
5
Posts: 151
Reputation: 6,279

Post » Tue Sep 20, 2011 9:16 am

Yeah I thought about it but it doesn't look like when you type it all out that it is one value, but many. So I have to come up with a way to have an event so that it will put it together as a value
B
4
G
2
Posts: 44
Reputation: 1,088

Post » Tue Sep 20, 2011 9:37 am

The text is all one value. What you type is appended to the Text object (this displays all characters typed on screen). All you have to do is compare the Text box to whatever you want. I implemented an underline character as a cursor, so you will need to remove it from the Text string before comparing.

I hope this helps.

   
B
26
S
5
G
5
Posts: 151
Reputation: 6,279

Post » Tue Sep 20, 2011 9:43 am

Oh alright that is awesome. Thank you very much, this is incredibly helpful. Now I just have to wait for tile map support and .exe export features :D
B
4
G
2
Posts: 44
Reputation: 1,088

Post » Fri Sep 30, 2011 4:06 pm

I may just be talking out my ass here, but I think it would make sense to edit your exported html file to include a form (or have your game open a pop-up form when text is needed). Then you could have the Javascript for the game get the text from a good ole text input. You'd have to actually edit the code though after exporting your game. I haven't tried it yet and it's been too long since I've played with Javascript so it's still just a theory at this point.
B
20
S
8
G
2
Posts: 15
Reputation: 2,444

PreviousNext

Return to How do I....?

Who is online

Users browsing this forum: 99Instances2Go, shinkan, stylie1, tarek2 and 13 guests