Is it possible to separate text strings from a single cell?
MattButlerStudios
Member Posts: 486
I am wondering if it is possible to separate a list of text strings inside of a single table cell.
See picture below:
Would it be possible to seperate each of these words as their own individual value instead of one big string of text?
Comments
I am a little bit confused about the question.
If you are asking if this is in a table cell how can you make it all their own table cells you would make three text attributes (self.string, self.return, self.newTableValue) and two integer (self.foundSpot and self.tableSpot).
change attribute self.string = tableCellValue(...).
Then you would have a loop: while self.string contains self.return - where self.return is a text attribute of "\n".
Change attribute self.foundSpot to textFind(self.string, self.return, 1).
Then you would say change attribute self.newTableValue to textSubStr(self.string, 1, self.foundSpot). Change table value game.table, row self.tableSpot, column 1, to self.newTableValue. Change attribute self.tableSpot to self.tableSpot + 1.
Then lastly change attribute self.string to textSubStr(self.string , self.foundSpot +1,textLength( self.string ))
That will take all the values of a string separated by returns, and make them there own table value. (untested but should work - EDIT I think self.tableSpot has to start at 1)
@zweg25 thanks a lot! I'll have to try this out!
www.mbstudios.co | Free Stuff
Quick demo
@zweg25
I think that you may have misunderstood my question. Here is an example of what I am trying to achieve. *Read from left to right
Sorry the first image was a bit misleading.
www.mbstudios.co | Free Stuff
Here's a demo I just made. See the notes in the actor's rules.
New to GameSalad? (FAQs) | Tutorials | Templates | Greenleaf Games | Educator & Certified GameSalad User
@tatiang Thanks a lot! I really appreciate the template. Just what I needed!
www.mbstudios.co | Free Stuff
Yes, my template actually does the same thing...
Only difference is that I preset the string and that I did it for returns. Easy to change to self.space and it would work as well...
@zweg25 Ok. thanks a lot!
www.mbstudios.co | Free Stuff