<SOLVED> Force player to type correct text

0 favourites
  • 14 posts
From the Asset Store
Fully animated top down pit bull type dog game asset
  • Hi everybody,

    Thanks for reading.

    I want to add a text object for the player to type in,

    but I want the player to enter in the text exactly right or it is rejected after pressing next button.

    for example, I want the player to type in the word, happy

    How can I do that please?

    Also, please provide capx if possible.



    capx posted down a few posts by HCCGRA.

  • Try Construct 3

    Develop games in your browser. Powerful, performant & highly capable.

    Try Now Construct 3 users don't see these ads
  • add this as a condition:

    system compare two values: textbox.txt = "happy"

  • LittleStain

    I appreciate you responding, and to a more experienced user the above explanation would probably suffice.

    I am a Newbie, any possibility you would kindly do a quick capx with a button to press to accept or deny. Please. <img src="smileys/smiley4.gif" border="0" align="middle" />

  • I'm sorry, but I don't have the time to create and upload capx. The above is pretty straightforward.

    on button pressed

    system compare two values: textbox.txt = "happy" - perform action

  • I will make for you

    .. here you are ...

    I had an extra 1 and a half minute ... :-)

    click here

    I remember what it was like to be a new user of C2....

  • hccgra

    I remember too and I've learned more from fiddling about after reading an answer than from getting capx's..

    And although making a capx for something like this only takes a short while, he could have done it himself in three clicks and probably discovered more..

  • Thank you both for the help.

    Much appreciated.

  • LittleStain

    I agree.

    Whilst I have no issues in helping people, I see far too many users not bothering to take the time to read the manual or look at tutorials, or even use search. They will learn nothing from just getting others to do everything for them.

    In principle, I generally ignore such posts. Harsh - but I detest such laziness.

  • zenox98


    I learn by reverse 'engineering' the capx.

    that's why I like the capx,

    besides anyone else that may look at his post may like the capx too.

    I mean the capx is literally 1 event with a few conditions long.

    I don't mean to be lazy, I just don't want to spend 2 hours trying to figure out out what could take 2 minutes to create, I have already done that twice;

    I have a 4 year old daughter I want to spend time with and I also have a full-time job so wanking around Event Sheets (getting frustrated)

    trying to figure out simple tasks is not my idea of being productive,


    if someone is kind enough to help me out thank you very much,

    if not , no problem.


    I spent literally hours making Game Play Format tutorials for Newbies,

    so I don't think I am lazy and I am sure the newbies appreciate these types of tutorials too.

    Click Here for Lesson 1 GPF Tutorial here

    Click Here for Lesson 2 GPF Tut

  • Reverse engineering a capx with one event, while someone told you how to create the event above?

    You are right, that's not being lazy..

    There are other words for it though..

    While typing in the event as shown above you'd have noticed after typing the dot behind textbox a menu pops up showing all the different things you can put behind the dot. This is actually true for every object you type the name in for. So if you ever need the height of an object in a "formula" object.height will do it for you.

    Reverse engineering, while possibly usefull, isn't the same as programming. Programming is solving issues while building something. reverse engineering just shows the one possible solution to an issue someone decided to use. It could be very possible there are easier ways to solve the issue, but by reverse engineering you'll never learn those.

    But if it works for you to ask people to do unnessecary work for you, that's fine..

  • Like my Art-teacher once said:

    You will never learn to paint like Van Gogh by reverse engineering his brush-strokes..


  • Valid points thanks for sharing

  • Honestly I think the one your using isn't very future ready. It's very locked to a set of words and requires additional Event for each word.

    Instead you should use an Array and do a


    Array.hasValue( trim( inputbox.text ) )

    --> Do actions


    However that would require either initiating an array on the game start by

    Array.setX(0, word)

    or using a dictionary and taking advantage of tokenate

    so create a file with

    happy, smile, sun, good, mom, dad, green,......

    then use AJAX


    On StartUp(do this for game start)

    • ajax.load(dictionaryfile)


    • repeat (tokenatecount(ajax.lastdata), ",")

    -- array.push to back on X with value trim(ajax.lastdata(tokenate, loopindex, ","))

    and there you go. An easy way to add LOTS of words without adding in any more events.

  • jayderyu

    Thanks for that idea, I haven't yet delved into Arrays but I will try now.

Jump to:
Active Users
There are 1 visitors browsing this topic (0 users and 1 guests)