Not finding value in array (logic flow)

0 favourites
  • 1 posts
From the Asset Store
100 items casual and logic games. All icons are of a high quality.
  • I posted something similar this morning, then ran some tests and deleted the post. But I'm still stumped so I'm posting again.

    I have a fairly simple function that looks something like this:

    ON FUNCTION "check_words" --> set text_1, text_2 and text_3 to ""
    
    [ul]
    	[li]array_all_words contains "apple" --> text_1 = "FOUND APPLE"[/li]
    [/ul]
    [ul]
    	[li]array_all_words contains "orange" --> text_2 = "FOUND ORANGE"[/li]
    [/ul]
    [ul]
    	[li]array_all_words contains "pear" --> text_3 = "FOUND PEAR"[/code:1sucty74][/li]
    [/ul]
    If my function finds all the words then all three "FOUND" messages are displayed. But if a word is NOT found, the function doesn't seem to check the rest of the words. In other words, as soon as it can't find a word then all the messages below are blank, even if those words are IN the array.
    
    I tried to recreate the problem with a smaller array and it worked as intended, so I'm kind of stumped. Any suggestions? My word_array is pretty large (13,000 entries) so maybe it's taking too long to search the whole array and it's an internal timing issue?
    
    UPDATE: I reworked everything and it seems to be performing as intended now. I still think it was a timing problem of some kind. For those interested, my solution was to create three separate functions, one for each word. I also added a flag to tell me if a word had already been checked or not. That cut down on the number of checks that needed to be made.
  • 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)