Table Search Question
mentat2963
Member, PRO Posts: 11
I am using the TableSearch function in my game. In my table I have text cells which contain spaces between the words
like, "Item #3." However, GS does not seem to allow the KEY to have spaces in the TableSearch expression. When I try to enter "Item #3" I can only enter "Item#3" and the TableSearch function fails to find the text. Does anyone know how to address this problem?
Thanks!
Comments
In the expression editor, click alt+space to add a space into the expression. That should allow your function to find your key.
My GameSalad Academy Courses! ◦ Check out my quality templates! ◦ Add me on Skype: braydon_sfx
I use a MAC so option+space did allow me to insert a space into the expression. However, the function still can't find the KEY even though the KEY is typed exactly as the text string appears in the table cell. I checked it a dozen times so I know I'm not crazy. Makes me think that there's a bug in GS.
Spaces are never a good thing to have they can cause issues at specfic time with the code. It's always good practice to use a _ for a space like item_#3
Guru Video Channel | Lost Oasis Games | FRYING BACON STUDIOS
Option+Space is not the same as Space. There are two ways you can fix this, neither ideal.
One is to make a new text attribute, put a space in it, and then use that in your search term - for example:
"Item"..self.Space...."#3"
Or just replace the spaces in your table with Option+Spaces.
(When you use Option+Space to insert a space in the expression editor, you're actually inputting an entirely different character that just happens to also look like a space. So the search will fail, as it's looking for something different to what's in the table.)
Contact me for custom work - Expert GS developer with 15 years of GS experience - Skype: armelline.support
Thanks for the help, guys. I understand the issues now. I'm new to coding - I wonder why GS won't recognize spaces as just spaces and not special characters?