Bug with texts?

HbkmadnessHbkmadness Member, PRO Posts: 35
edited March 2014 in Working with GS (Mac)

Hi,

I'd like to ask if there is a bug with the text attribute when you use the "if" statement.

Example:

I know my string is "pararampam" but I care only for the last 3 chars.

When I use "If x ends with "pam" do { blabla } else {blablabla} " It does not work properly eventhough the text is ending with "pam".

But when I use "if x IS "pararampam" do { blabla } else {blablabla} " It works fine, now the problem is that I really want to check only the last 3 chars in the text and not the whole one. So is it a bug or I don't use it properly ?

Comments

  • gyroscopegyroscope I am here.Member, Sous Chef, PRO Posts: 6,598

    Hi @Hbkmadness I'm almost certain that the Windows version of GSC is the same as the Mac in this respect.... "ends with" refers to only the last character (in this case, "m")

    Sorry about that; hope that helps somehow.

    ""You are in a maze of twisty passages, all alike." - Zork        temp domain http://spidergriffin.wix.com/alphaghostapps

  • HbkmadnessHbkmadness Member, PRO Posts: 35

    Ya I thought It could do this, thanks. I guess I have to think for another way.

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

    You can do this very easily with the Release Candidate for Mac but those features do not exist in Windows Creator. You'd have to enter each letter in a table cell and then check the table cells to determine ends of words.

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

  • HbkmadnessHbkmadness Member, PRO Posts: 35

    Ya like working with arrays I guess. That's good idea, thanks.

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

    Yes, exactly like an array. The downside of tables is that the tableColCount() function applies to the entire table so if you have multiple rows of data (multiple words) there is no simple way to determine their length. In an app I built for a similar purpose I added a symbol (#) after the last letter and then used a custom loop to check for that value, which would signify the end of the word/row.

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

Sign In or Register to comment.