Compare if text box value matches array content?

0 favourites
  • 6 posts
From the Asset Store
OpenAI TTS
$10 USD
Text-to-Speech plugin.Allows your Construct 3 project to convert written text into spoken words
  • I cannot get how I should build the events... I have an array with strings (one string/line). I want to test if the content of a text box (input by the player) can be found in the array after the player hits enter. If it matches, something happens, if not something else happens.

    I must have some kind of a total logic error in my head, this cannot be really complicated

  • On enter pressed ,

    Set a global variable i.e. name to textbox.text (the input)

    For each XYZ element,

    compare current value = name > something happens

    else

    something else happens

  • Thanks, iIgot the content of the textbox updated to the variable, but cannot understand where do I get the Compare XYZ. Only way to get that option, is to add a completely new event with "System". How can I get that "under" the "key pressed" event?

    Could you please give me anothet hint on the later part?

    Thanks and sorry

  • On enter pressed is one event.

    Compare XYZ is a new event that's correct but instead of picking System, you pick the Array object and the conditions are in there.

    If you still can't work it out I can make a file later on today.

  • Thanks for your patience I still can't figure it out. I now know how to make the event, but how do I make it work this way:

    1. Whenever enter is pressed the TextBox.Text is read into the global variable "input" (this already works)

    2. Also whenever enter is pressed the value of "input" is compared to the words in the array (I think I got this too...)

    3. If the input does not match with the array -"Syntax error" in one of the text objects.

    Sorry :/

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
Jump to:
Active Users
There are 1 visitors browsing this topic (0 users and 1 guests)