Jump to content
Korean Random
Sign in to follow this  
seth_321

How do I align my players panel information?

Recommended Posts

Hello everyone,

 

     I'm wondering if someone can please help me tweak my code a little. I'm looking to make my players panel (dog ears) more organized and pretty so that everything aligns/centered nicely. I'm willing to limit how many characters on player names there are so I have room to make it all centered and work. However, I can't seem to code it right to align nicely. For example, in the picture, you can see that the average damage "AvgDmg: xxxx" is located separate from everyone else, I want to be able to align them all for a better read. Attached should be a screenshot of what I'm talking. Here is the code I have created as well:

 

"formatLeft": "<font color='{{c:xte}}'>{{vehicle%-10.10s}}</font> <font color='{{c:wn8}}'>{{nick%-10.10s}}</font> AvgDmg: <font color='{{c:tdb}}'>{{tdb%4.3i}}</font>",

//

"formatRight": "{{spotted}} <font color='{{c:tdb}}'>{{tdb%4.3i}}</font> :AvgDmg <font color='{{c:wn8}}'>{{nick%10.10s}}</font> <font color='{{c:xte}}'>{{vehicle%10.10s}}</font>",

 

 

 

 

post-16472-0-70013900-1437930038_thumb.jpg

Share this post


Link to post

Short link
Share on other sites

@seth_321, use textformat tabstops, Luke )

What is a textformat tabstop? Where can I find the coding for this so I can practice it and implement it in? Sorry, I'm a noob lol.

 

Cheers!

Share this post


Link to post

Short link
Share on other sites

One example, taken from my hitlog config:

 

"formatHistory": "<textformat tabstops='[20,50,90,190]'><font size='12'>#{{n-player}}:</font><tab>{{dmg-player}}<tab>| <font color='{{c:dmg-kind}}'>{{dmg}}</font><tab>|<font color='{{c:wn8}}'> {{vehicle}} {{dead}}</font><tab><font color='#FFFFFF'>| {{nick}}</font></textformat>",

 

The values 20, 50, 90 and 190 define where each value is positioned after a <tab>. This will give you a nice list with all values right below each other, no matter how "long" they are (simple example below).

 

value1  value2  value3

v1        v2        v3

value1  val2     valu3

Edited by Alfalis

Share this post


Link to post

Short link
Share on other sites

Cheers guys, I'll put this into my code. This is exactly what I'm looking for! :)

You're welcome )

Share this post


Link to post

Short link
Share on other sites

*UPDATE*

 

Hey guys,

 

     So I've spent about 3-4 hours trying to get the code correct and I still don't understand it. I have the left Player Panel aligned nicely, but I don't understand how to <tab> the right side to align perfectly. Please look at my code and provide advice. I'm sure it's a simple fix, I just don't understand it as of now. Also, please check the image provided to see my progress. Here is my code:

"medium": {

      // false - disable (?????????)
      "enabled": true,

      // Minimum width of the player's name column, 0-250. Default is 46.
      "width": 46,

      // Display format for the left panel (macros allowed, see readme-en.txt).      
      "formatLeft": "<textformat tabstops='[70,135]'><font alpha='{{alive?#FF|#80}}'color='{{c:xte}}'>{{vehicle%-11.11s}}</font><tab><font alpha='{{alive?#FF|#80}}' color='{{c:wn8}}'>{{name%-9.9s}}</font><tab><i>AvgDmg: </i><font alpha='{{alive?#FF|#80}}' color='{{c:tdb}}'>{{tdb%-4.3i}}</font></textformat>  ",

      // Display format for the right panel (macros allowed, see readme-en.txt).
      "formatRight": "<textformat tabstops='[85]'><font alpha='{{alive?#FF|#80}}' color='{{c:tdb}}'>{{tdb%4.3i}}</font><i> :AvgDmg</i><tab><font alpha='{{alive?#FF|#80}}' color='{{c:wn8}}'>{{name%9.9s}}</font> <font alpha='{{alive?#FF|#80}}' color='{{c:xte}}'>{{vehicle%11.11s}}</font></textformat>",

      // Display format for frags (macros allowed, see readme-en.txt).      
      "fragsFormatLeft": "{{frags}}",
      "fragsFormatRight": "{{frags}}",

      // Extra fields. Each field have size 350x25. Fields are placed one above the other.      
      // Set of formats for left panel (extended format supported, see above)      
"extraFieldsLeft": [
      ],
"extraFieldsRight": [
      {"x": -50, "y": 8, "bindToIcon": true, "format": "{{spotted}}"}]
    },

post-16472-0-80971500-1438018720_thumb.jpg

Share this post


Link to post

Short link
Share on other sites

After taking a quick look without any testing: You are missing a second tab on the right side compared to the left

 

"formatRight": "<textformat tabstops='[100, 165]'><font alpha='{{alive?#FF|#80}}' color='{{c:tdb}}'>{{tdb%4.3i}}</font><i> :AvgDmg</i><tab><font alpha='{{alive?#FF|#80}}' color='{{c:wn8}}'>{{name%9.9s}}</font><tab><font alpha='{{alive?#FF|#80}}' color='{{c:xte}}'>{{vehicle%11.11s}}</font></textformat>",

 

Please try my bold suggestions (100 and 165 are just guesses, you might have to tweak them a little ;D) and let us know how it worked out.

Share this post


Link to post

Short link
Share on other sites

just my input on this , the info given above indeed is correct on how to align items in players panels and works fine but

all that info you want to display and are having trouble with can be done via the extra fields? use the formatleft/right just for the players name , then you can add the other items with EXACT placment via X and Y positions , reason for doing things this way is its easier to add change items that you want to display , you can just // a line of code out and add another beneath it, i know its radical if you dont use this system but it is easier in the long run m8

 

"medium2": {
      "width": 170,
   "removeSquadIcon": true,
     
      "formatLeft": "<b><font face='$fieldfont' size='14' color='{{c:xwn8}}'>{{name%-10.10s}}</b></font>",
      "formatRight": "<b><font face='$fieldfont' size='14' color='{{c:xwn8}}'>{{name%-10.10s}}</b></font>",

      "fragsFormatLeft": "",
      "fragsFormatRight": "",
     
      "extraFieldsLeft": [
   { "x": 175, "src": "xvm://res/keho/squads_a/{{squad}}{{squad-num}}.png", "alpha": "{{alive?100|40}}"  },
    { "x": 46, "y": 2, "valign": "center", "h": 21, "w": "{{hp-max:140}}", "bgColor": 0, "alpha": 40 },
    { "x": 46, "y": 2, "valign": "center", "h": 21, "w": "{{hp:140}}", "bgColor": "0x1878B0", "alpha": 70 },
   { "x": 17, "y": 4, "h": 20, "w": 20, "valign": "center", "src": "cfg://soulzaskehoblue/img/ppanel/fraggs/{{frags}}.png", "alpha": "{{alive?100|60}}"  },
    { "w": 15,  "y": 2, "valign": "center", "h": 21, "bgColor": "0x1878B0", "alpha": "{{alive?75|0}}" }
   ],
    
      "extraFieldsRight": [
   { "x": 175, "src": "xvm://res/keho/squads_e/{{squad}}{{squad-num}}.png", "alpha": "{{alive?100|40}}"  },
   { "x": 46, "y": 2, "valign": "center", "h": 21, "w": "{{hp-max:140}}", "bgColor": 0, "alpha": 40 },
   { "x": 46, "y": 2, "valign": "center", "h": 21, "w": "{{hp:140}}", "bgColor": "0xD62E2B", "alpha": 70 },
   { "w": 15,  "y": 2, "valign": "center", "h": 21, "bgColor": "0xD62E2B", "alpha": "{{alive?75|0}}" },
   { "x": 17, "y": 4, "h": 20, "w": 20, "valign": "center", "src": "cfg://soulzaskehoblue/img/ppanel/fraggs/{{frags}}.png", "alpha": "{{alive?100|60}}"  },
   { "x": 14, "y": 0, "valign": "top", "bindToIcon": true, "format": "{{spotted}}", "shadow": {} }
   ]
    }
,

 

 

this code displays this:-

pre_1438030727__capture.png

Edited by soulza

Share this post


Link to post

Short link
Share on other sites

After taking a quick look without any testing: You are missing a second tab on the right side compared to the left

 

"formatRight": "<textformat tabstops='[100, 165]'><font alpha='{{alive?#FF|#80}}' color='{{c:tdb}}'>{{tdb%4.3i}}</font><i> :AvgDmg</i><tab><font alpha='{{alive?#FF|#80}}' color='{{c:wn8}}'>{{name%9.9s}}</font><tab><font alpha='{{alive?#FF|#80}}' color='{{c:xte}}'>{{vehicle%11.11s}}</font></textformat>",

 

Please try my bold suggestions (100 and 165 are just guesses, you might have to tweak them a little ;D) and let us know how it worked out.

Thanks for the reply! I tried your code and it didn't work.... It almost looks good, and I tweaked with the numbers a bit, but it still didn't work. Sometimes some tanks don't have an Average Damage value, and I think this is throwing it off... even though it should be aligining to the right, it's still aligned to the left?  {{tdb%4.3i}}</font><i> :AvgDmg</i><tab>

Share this post


Link to post

Short link
Share on other sites

 

 

{{tdb%4.3i}} :AvgDmg

 

Replace it with {{tdb%4.3i|---}} - the "|xxx" is a default value that is displayed if the macro in front of it doesn't return anything.

Add whatever you want behind the "|". The reason for missing values is usually that the player doesn't have this tank for very long and thus XVM doesn't have any values for it yet.

 

Please make this adjustment and then send us another screenshot.

Share this post


Link to post

Short link
Share on other sites

Alfalis,

 

     As requested, I changed out the code and tried it. It still didn't work. It seems that both the 'AvgDmg' part and the ' player names' don't align. I've even tried aligning them to the left instead and it didn't fix it. Attached is the screenshot, and here is the code:

"formatRight": "<textformat tabstops='[100,165]'><font alpha='{{alive?#FF|#80}}' color='{{c:tdb}}'>{{tdb%4.3i|---}}</font><i> :AvgDmg</i><tab><font alpha='{{alive?#FF|#80}}' color='{{c:wn8}}'>{{name%9.9s}}</font><tab><font alpha='{{alive?#FF|#80}}' color='{{c:xte}}'>{{vehicle%11.11s}}</font></textformat>",

 

post-16472-0-58874300-1438096482_thumb.jpg

Share this post


Link to post

Short link
Share on other sites

as i posted above use thew extra fields ,

its a lot easier to align ,move ,replace items

and lose computer's performance

Share this post


Link to post

Short link
Share on other sites

you dont loose any performance by using extra fields ????

in fact i would suspect the code is very much cleaner?

 

even if you did loose performance it would be tiny and on todays machines nothing at all

Edited by soulza

Share this post


Link to post

Short link
Share on other sites

even if you did loose performance it would be tiny and on todays machines nothing at all

but if NOT todays ?
  • Downvote 1

Share this post


Link to post

Short link
Share on other sites

So I've waited a few days and have yet to get a full response. Can anyone help me align my right side?

amplify da tabstop in da rite side ;P

Share this post


Link to post

Short link
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Sign in to follow this  

  • Recently Browsing   0 members

    No registered users viewing this page.

×
×
  • Create New...