Checking tables for Values quickly

fmakawafmakawa Member Posts: 565

Hi folks,
So I hit a snag that has left me a little amused and befuddled. So I've been creating a word game and had been using @t-shirtbooth's method of word checking which used a LOT of text attributes for the word list. Now I needed to deviate from his word list mostly because I need a much a bigger one, roughly 5 times the size that he had - the Scrabble SOWPODS list. This meant using a table. Now my problem is, how do I constrain it that whatever I am typing is automatically being looked for in the table and doing it quickly? I tried using string expressions but I think I am mangling them. I am finding that table searches are slower than looking in attributes, significantly so, which os problematic since you want the word to be accepted or denied pretty much instantaneously rather than waiting 5 seconds for it to run the search. Speaking of said tables, should I maintain just one column and an odd 300000 rows or split it into multiple columns- which should reduce search time I think, unless there is an advantage of a single column?
Thanks muchly!

Comments

  • ArmellineArmelline Member, PRO Posts: 5,364

    A lot of @tshirtbooth's tutorials are out of date now since the introduction of the extra table and string functions. Which tutorial did you use?

    Sounds like you need to use tableSearch(), though. It's pretty much instant.

  • fmakawafmakawa Member Posts: 565

    @Armelline I realised that but when I was learning and now still, his tutorials where like the only stuff on word related games. I started with his word checker tutorial which led to boggle. I figured table search is it and I'm just mangling the rules. Using tablesearch in string expression as a condition seems not to be the way since that give you an integer and would not have a "contain", unless I do a "does not contain: = 0? I off course cant treat the table as an attribute like I did the text attributes with the word list. hmm. Frankly, I'm clueless. face palm

  • ArmellineArmelline Member, PRO Posts: 5,364

    I'm really not sure what you're trying to do. Perhaps break it down to one problem, outline it clearly, and see if people can help with that.

  • fmakawafmakawa Member Posts: 565

    I have a word list, SOWPODS, in a table. I want to type words, which changes a text attribute and have that text attribute be searched for in the table as I type it. example- If I write the word 'top' it is searched for in the table. if found it displayed in green. If I continued to 'topp' that would not be green because it wouldn't be found. But if I continued to 'topping' it would be green again. Before I had all the words in a text attribute so my code read:

    if 'game.wordlist' contains 'game.typedword'
    etc.
    Now I need to convert that to a tablesearch parameter.

  • ArmellineArmelline Member, PRO Posts: 5,364

    You have a custom keyboard and text entry method set up?

  • RThurmanRThurman Member, Sous Chef, PRO Posts: 2,880

    Here is an example that might help:

  • fmakawafmakawa Member Posts: 565

    Yes, I do. That custom keyboard changes the value of the text attribute "game.typedword". So I need to find that.

    @Armelline said:
    You have a custom keyboard and text entry method set up?

  • fmakawafmakawa Member Posts: 565
    edited June 2016

    @RThurman right on the money!! Thanks!!

  • ArmellineArmelline Member, PRO Posts: 5,364

    Annoyingly I had to make a keyboard in order to demo this properly, but perhaps someone will find my 1 actor keyboard handy :D (Uses one prototype, needs 1 instance placed on the scene, then keyboard out of nowhere.)

    Highlights a word found in the • WORDS • table green, and words not found are red. The actual part you need is pretty straightforward.

  • tatiangtatiang Member, Sous Chef, PRO, Senior Sous-Chef Posts: 11,949

    Love it, @Armelline! The only thing better is this:

    New to GameSalad? (FAQs)   |   Tutorials   |   Templates   |   Greenleaf Games   |   Educator & Certified GameSalad User

  • fmakawafmakawa Member Posts: 565

    That's actually awesome!!! I'm going to use it too for another thing.

    @Armelline said:
    Annoyingly I had to make a keyboard in order to demo this properly, but perhaps someone will find my 1 actor keyboard handy :D (Uses one prototype, needs 1 instance placed on the scene, then keyboard out of nowhere.)

    Highlights a word found in the • WORDS • table green, and words not found are red. The actual part you need is pretty straightforward.

  • RThurmanRThurman Member, Sous Chef, PRO Posts: 2,880

    @Armelline said:
    perhaps someone will find my 1 actor keyboard handy :D

    Magic!

Sign In or Register to comment.