Text alignment reversed

tatiangtatiang Member, Sous Chef, PRO, Senior Sous-Chef Posts: 11,949
Thought I'd share an odd issue in the unlikely event that someone else has this problem.

I'm using a loop to generate a text attribute by concatenating a bunch of table cells together like this: tableCellValue(Table,1,1).."\n"..tableCellValue(Table,2,1).."\n"..etc.

The problem is that if I use DisplayText to show the text attribute and I set the text alignment to left, it aligns the text with the right side of the actor instead. If I change the text alignment to right, it aligns the text with the left side of the actor.

It took me a long time but I finally figured out that the DisplayText -- while I think of it as a Constrain behavior -- was having trouble with an empty text attribute value at the beginning of the loop. If I put the DisplayText inside of a When self.Time>[time the loop takes to complete], it works as expected.

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

Comments

  • tatiangtatiang Member, Sous Chef, PRO, Senior Sous-Chef Posts: 11,949
    What I described above is what happens when previewed in Creator. On an iPhone, the actors show up completely black.

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

  • tatiangtatiang Member, Sous Chef, PRO, Senior Sous-Chef Posts: 11,949
    edited January 2013
    Hmm... coulda sworn there was a comment from @Gyroscope here. Anyway... I was able to duplicate the problem, so I'll submit a bug report.

    If you try out the attached file, what happens is that the displayText actor on the right side waits 3 seconds and aligns the text correctly, but the displayText actor on the left side doesn't align things properly.

    On a device -- oddly enough -- the WHOLE screen turns black when the displayText actor(s) fail to align correctly.

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

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

    Hi @tatiang Yes, I did leave a comment but decided to delete it: it was a bit obvious a question asking if you were going to report the bug... ;-) (And a thumbs-up for spotting it).

    Strange bug, I'll download your test file now to see it in action....

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

  • tatiangtatiang Member, Sous Chef, PRO, Senior Sous-Chef Posts: 11,949
    Thanks... I had thought that adding a When self.Time>[amount of time to finish loop] rule fixed it, but on an iPhone 3GS, it still appears as black boxes/actors even if I extend the self.Time to greater than several seconds (i.e. longer than the loop takes to traverse 60 rows).

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

  • tatiangtatiang Member, Sous Chef, PRO, Senior Sous-Chef Posts: 11,949
    Update: it worked properly with a table size of 10 rows, but not with 60. I either have invalid table data or the size of my actor (which is constrained to a multiple of the table row count) is too large for the scene.

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

  • sparkaniasparkania Member, PRO Posts: 300
    I'm gonna say this before Socks does....

    If you turn your device around... everything will be correct.... :D
  • tatiangtatiang Member, Sous Chef, PRO, Senior Sous-Chef Posts: 11,949
    But I'm already standing on my head, @sparkania!

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

  • sparkaniasparkania Member, PRO Posts: 300
    great... now there's gonna be a discussion about Gravity isn't there...
  • tatiangtatiang Member, Sous Chef, PRO, Senior Sous-Chef Posts: 11,949
    Well, I wasted a perfectly good morning only to discover that this was an issue with imported csv data. I don't know the exact cause (possibly auto-formatting in Excel) but I re-entered the data by hand in the GS table and it works for 20 rows and probably for 100 rows. *sigh*

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

  • sparkaniasparkania Member, PRO Posts: 300
    Excel justifies numbers Right and Text Left as default..
  • SocksSocks London, UK.Member Posts: 12,822
    I'm gonna say this before Socks does....

    If you turn your device around... everything will be correct.... :D
    Or if you shake it the letters line themselves up.
  • sparkaniasparkania Member, PRO Posts: 300
    @ Socks
    nope nope... to late.. I got here first!!!! [-X
  • tatiangtatiang Member, Sous Chef, PRO, Senior Sous-Chef Posts: 11,949
    Excel justifies numbers Right and Text Left as default..
    Right, but that's not the issue here. There IS a problem with displaying the text before the loop is finished, but there was also a problem with my data (I think related to percentages in Excel). That's my story and I'm sticking to it.

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

  • SocksSocks London, UK.Member Posts: 12,822
    @ Socks
    nope nope... to late.. I got here first!!!! [-X


    8-X
  • tatiangtatiang Member, Sous Chef, PRO, Senior Sous-Chef Posts: 11,949
    edited January 2013
    I decided to keep the actor size constant (at a small height) and just use DisplayText to display the saved games. Unfortunately, the black box is back. I'm going to submit a bug report with the project file and see what comes of it.

    It seems related to the timing of the DisplayText. If the DisplayText behavior triggers before the text string is fully generated, it presents a black box. If there's enough time before the behavior triggers, it displays correctly.

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

  • tatiangtatiang Member, Sous Chef, PRO, Senior Sous-Chef Posts: 11,949
    Starting to think the issue must be with the loop that generates a concatenated text string. Perhaps the "time stamp" method of looping is too fast (every 0.005 seconds) and GS can't concatenate text that quickly.

    Going to try a slower looping function and see if that helps.

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

  • PixelMetalPixelMetal Member Posts: 283
    on Android, the text is randomly offset depending on which device you're testing on. Methinks Display Text is in dire need of a rewrite.
Sign In or Register to comment.