SC2Mapster Forums

Development > Triggers

Alligning Text in dialog labels?

  • 6 posts
    #1 Dec 05, 2012 at 15:45 UTC - 0 likes

    I want to allign the text in a dialog label. I want the dialog to show some stats, and this is what happens now:

    Stamina:     1000...
    I want this:
    Stamina: 10000
    
    Last edited Dec 05, 2012 by Demtrod
    #2 Dec 05, 2012 at 19:25 UTC - 0 likes

    To remove the ellipse you need to increase the size of the dialog item. As far as aligning the text box itself... that should just be a matter of modifying the offset. Negative numbers are allowed.

    My Projects:
    Malum Ruina: SC2Mapster
    Eternal Exile: SC2Mapster
    Spine Crawler Madness: SC2Mapster
    Xeno Crisis: SC2Mapster

    #3 Dec 05, 2012 at 21:52 UTC - 0 likes

    I dont know exactly how you are building your dialogue, but here is how i would have done it:

    Make a dialogue > add a label. Make variables that references the label and the dialouge.

    I would then make a font style which is left aligned (or centered if you would like). To set the position of the text you need both to apply the font style to the label with dialogueItemSetStyle() and inside the label, around the text <s style="something">yourtext</s>.

    So i would add a function call after the creation of the label to dialougeItemSetStyle(yourStyle).

    Then, i would create a function that sets the content of the label, to make it easily updatable: a new function like pushScore(team1[int], team2[int]). i would then use _expressions_ to design the content of the dialouge itself. Expressions are a very powerful way of comining text items. In the function i would create a text dummy variable txt. Use a setVariable to define its content. Instead of writing the value in the "value" tab, go to expression tab. write something like:

    <s style"team1">Team 1: ~A~</s></n><s style="team2">Team 2: ~B~</s>

    the <s> segments sets the style

    the ~stuff~ segments are variables, which you define in the field below. you can rename them if you want to. The expression will only accept text variables/content, so you need to convert the integer values from the parameters to the function (team1[int], team2[int]) to integers using intToText(v).

    The </n> segment tells the engine to push a new row. The end result will be

    Team 1: 23
    Team 2: 24455

    if that was the score... ^^

    Last edited Dec 05, 2012 by Monkalizer
    #4 Dec 05, 2012 at 23:02 UTC - 0 likes

    @BasharTeg: Go I dont want to increase the size of the dialog, I want to make it allign to the right edge,

    @Monkalizer: Go I have already made the dialog, the only problem I got is that I can not make the text allign.

    Last edited Dec 05, 2012 by Demtrod
    #5 Dec 05, 2012 at 23:52 UTC - 1 like

    this should help:
    http://www.sc2mapster.com/forums/development/triggers/20693-center-dialog-label-text/?post=5

    but if you are getting dots (...) the label width is too small

    A programmer started to cuss
    Because getting to sleep was a fuss
    As he lay in his bed
    Looping 'round in his head
    Was: while (!asleep()) sheep++;

    twitter.com/SC2IncomeWars
    facebook.com/SC2IncomeWars

    #6 Dec 07, 2012 at 12:01 UTC - 0 likes

    @b0ne123: Go

    Thank you :)

  • 6 posts

You must login to post a comment. Don't have an account? Register to get one!