seth_321 Posted July 26, 2015 Share Posted July 26, 2015 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>", @ Quote Link to comment Short link Share on other sites More sharing options...
TornadoCat Posted July 26, 2015 Share Posted July 26, 2015 @seth_321, use textformat tabstops, Luke ) @ Quote Link to comment Short link Share on other sites More sharing options...
seth_321 Posted July 26, 2015 Author Share Posted July 26, 2015 @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! @ Quote Link to comment Short link Share on other sites More sharing options...
Alfalis Posted July 26, 2015 Share Posted July 26, 2015 (edited) 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 July 26, 2015 by Alfalis @ Quote Link to comment Short link Share on other sites More sharing options...
TornadoCat Posted July 26, 2015 Share Posted July 26, 2015 (edited) @seth_321, look into my config, I tink it'll help playersPanel.xcand see what I did vid dem Edited July 26, 2015 by Metallist95 @ Quote Link to comment Short link Share on other sites More sharing options...
seth_321 Posted July 26, 2015 Author Share Posted July 26, 2015 Cheers guys, I'll put this into my code. This is exactly what I'm looking for! :) @ Quote Link to comment Short link Share on other sites More sharing options...
TornadoCat Posted July 26, 2015 Share Posted July 26, 2015 Cheers guys, I'll put this into my code. This is exactly what I'm looking for! :)You're welcome ) @ Quote Link to comment Short link Share on other sites More sharing options...
seth_321 Posted July 27, 2015 Author Share Posted July 27, 2015 *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}}"}] }, @ Quote Link to comment Short link Share on other sites More sharing options...
Alfalis Posted July 27, 2015 Share Posted July 27, 2015 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. @ Quote Link to comment Short link Share on other sites More sharing options...
soulza Posted July 27, 2015 Share Posted July 27, 2015 (edited) 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:- Edited July 27, 2015 by soulza @ Quote Link to comment Short link Share on other sites More sharing options...
seth_321 Posted July 28, 2015 Author Share Posted July 28, 2015 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> @ Quote Link to comment Short link Share on other sites More sharing options...
Alfalis Posted July 28, 2015 Share Posted July 28, 2015 {{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. @ Quote Link to comment Short link Share on other sites More sharing options...
seth_321 Posted July 28, 2015 Author Share Posted July 28, 2015 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>", @ Quote Link to comment Short link Share on other sites More sharing options...
soulza Posted July 28, 2015 Share Posted July 28, 2015 as i posted above use thew extra fields , its a lot easier to align ,move ,replace items @ Quote Link to comment Short link Share on other sites More sharing options...
TornadoCat Posted July 28, 2015 Share Posted July 28, 2015 as i posted above use thew extra fields , its a lot easier to align ,move ,replace items and lose computer's performance @ Quote Link to comment Short link Share on other sites More sharing options...
soulza Posted July 29, 2015 Share Posted July 29, 2015 (edited) 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 July 29, 2015 by soulza @ Quote Link to comment Short link Share on other sites More sharing options...
seth_321 Posted July 29, 2015 Author Share Posted July 29, 2015 So does anyone have a fix for me? One that uses my original code and I won't lose performance? @ Quote Link to comment Short link Share on other sites More sharing options...
TornadoCat Posted July 29, 2015 Share Posted July 29, 2015 even if you did loose performance it would be tiny and on todays machines nothing at allbut if NOT todays ? 1 @ Quote Link to comment Short link Share on other sites More sharing options...
seth_321 Posted July 31, 2015 Author Share Posted July 31, 2015 So I've waited a few days and have yet to get a full response. Can anyone help me align my right side? @ Quote Link to comment Short link Share on other sites More sharing options...
TornadoCat Posted July 31, 2015 Share Posted July 31, 2015 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 @ Quote Link to comment Short link Share on other sites More sharing options...
Recommended Posts
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.