comparing text attributes
pjcohen
Member Posts: 0
I want to compare two text attributes to see if one comes before the other like:
if game.word1 < game.word2
or
if game.word1 is min(game.word1, game.word2)
Can it be done?
if game.word1 < game.word2
or
if game.word1 is min(game.word1, game.word2)
Can it be done?
This discussion has been closed.
Answers
New to GameSalad? (FAQs) | Tutorials | Templates | Greenleaf Games | Educator & Certified GameSalad User
@pjcohen
Hi, as @tatiang says, there's no way to do this with text attributes alone; you'd have to use more attributes. You could use a table as well, I'm thinking.
But even without a table: use an integer called WordCount. As well, for every word used, make an integer attribute, i.e W1Pos, W2Pos, etc. and as they are used, Change Attribute WordCount to WordCount+ 1, then Change Attribute W?Pos to WordCount. Then you've got something to compare. Hope that helps out.
""You are in a maze of twisty passages, all alike." - Zork temp domain http://spidergriffin.wix.com/alphaghostapps
New to GameSalad? (FAQs) | Tutorials | Templates | Greenleaf Games | Educator & Certified GameSalad User
Hi @tatiang Interesting, and i agree with what you're saying. But the way I saw it: although not knowing what sort of game @pjcohen is making, I assumed, by the short description, that word after word is used in some way, created one after the other; and he needs to find out an order comparison "after the event" rather than comparing any of the letters in each word...that's how I understood it anyhow. So if that's right, and the words are created one after the other as I thought, then using integer attributes linked with each word, for position as they are made, would work....
But for what reason I can't quite work out... ;-) Which leads me to think that @pjcohen did mean alphabetical order rather than placement order..... ah well, I tried!
""You are in a maze of twisty passages, all alike." - Zork temp domain http://spidergriffin.wix.com/alphaghostapps
here is a video tutorial I made comparing attributes in a table. It's a quiz style app.
@mhbartaby Please don't bump threads that are two years old. It just so happens that the current version of GameSalad Creator includes powerful text string manipulation functions that make this sort of thing quite easy now.
New to GameSalad? (FAQs) | Tutorials | Templates | Greenleaf Games | Educator & Certified GameSalad User