How to make the score right-justified?

Ah you discovered a solution, cool! Could you give me the tip please? I didn't find it in AUBF's 2021 version.
Because isn't on that version :)

This is what I use to display the helper name, but centered:
C-like:
@script
    void self = getlocalvar("self"); //Get calling entity.
            if(frame==1)
    {
          char hName = "Jean Grey";
          settextobj(1, 240-(strwidth(hName,2)/2),  254, 2, 999999999, hName, 300+openborvariant("elapsed_time"));
    }
@end_script

if I am not mistaken, this would right align it

C-like:
@script
    void self = getlocalvar("self"); //Get calling entity.
            if(frame==1)
    {
          char hName = "Jean Grey";
          settextobj(1, 240-(strwidth(hName,2)),  254, 2, 999999999, hName, 300+openborvariant("elapsed_time"));
    }
@end_script

This is how you align a text, but you would need to build your logic to get your score and output it
 
@16-bit Fighter Is this correct?


If yes, this is the code I'm currently using in the SORX but modified for the right-alignment. Just import it to your updated.c and call the writeScore() function filtered by the openborvariant "in_level".

Like @O Ilusionista posted, the "strwidth" function is the key to align texts.

Code:
void writeScore()
{//Draw score using custom font
    void player1 = getplayerproperty(0, "entity");
    void player2 = getplayerproperty(1, "entity");
    void player3 = getplayerproperty(2, "entity");
    void player4 = getplayerproperty(3, "entity");
    
    if(!openborvariant("pause")){
        WriteFunction(player1, 0);
        WriteFunction(player2, 1);
        WriteFunction(player3, 2);
        WriteFunction(player4, 3);
    }
}

void WriteFunction(void player, int pIndex)
{//Script used to reduce code size

    //USED FOR PLAYERS ALREADY IN-GAME
    if(player != NULL()){
        void type    = getentityproperty(player, "type");
        int exists    = getentityproperty(player, "exists");
        
        //DETECTS IF THE DEFINED PLAYER IS IN-GAME AND ALIVE
        if(exists){
            int score    = getplayerproperty(pIndex, "score");
            int xPos    = 81;
            int xDif    = 120;
            int xAdd    = xDif*pIndex;
            int yPos    = 9;
            int font    = 1;
            int layer    = 1001;

            drawstring(xPos+xAdd-strwidth(""+score, font), yPos, font, score, layer);
        }
    }
}
 
Back
Top Bottom