joscha999 0 Posted May 14, 2017 Hey guys, can anyone tell me whether or not Nomalzation (using : ) works on the carousel, currently trying to show a progressbar that shows how far one is with xp on the tank. Current code: { "enabled": true, "x": 0, "y": 95, "width": "{{v.xpToEliteLeft:200}}", "height": 4, "bgColor": "#3bba18" }, My cells are 100x200, if i read correctly :200 should mean i get values from 0 to 200, the bar shows but it allways is as wide as the cell, no matter how much xp i need (in %). Also interesting, with this code: { "enabled": true, "x": 0, "y": 95, "width": "{{v.xpToEliteLeft?10|{{v.xpToEliteLeft:200}}}}", "height": 4, "bgColor": "#3bba18" } XVM seems to fall back to 10 leaving a small 10x4 xp bar at the bottom. Is this a bug or is the normalization not intended to work in the carousel :c ? Greetings, joscha Quote Share this post Link to post Short link Share on other sites
konrad509 445 #390662 Posted May 14, 2017 (edited) Check this topic https://koreanrandom.com/forum/topic/35263-showing-xp-left-to-elite-tank-as-a-percentage-carousel Edited May 14, 2017 by konrad509 Quote Share this post Link to post Short link Share on other sites
scyorkie 50 #390664 Posted May 14, 2017 (edited) Hmm I was looking for that thread that konrad pointed out, but couldn't locate it. In the meantime, I figured out a solution: - set width like this: "w": "{{py:math.mul({{py:math.div({{v.xpToEliteLeft}},{{v.xpToElite}})}},200)}}" (200-pixel bar grows shorter as you gain more XP) - set alpha like this: "alpha": "{{v.xpToEliteLeft>0?100|0}}" (necessary or else elited tanks will show the bar as well) Note: I logged into a friend's account to test this, since I only have 1 non-elite tank. It generally works except for his T28 Prot, which shows a full bar (i.e. no XP gained towards elite status) even though he has researched all modules + T30, but not the T28. I'm not sure why this happens. Edited May 15, 2017 by scyorkie Quote Share this post Link to post Short link Share on other sites
joscha999 0 #390669 Posted May 14, 2017 Thx guys, works perfectly well, pretty old problem tho. Thx konrad for taking the time to find/make that solution :) Only problem now, with some tanks, elited ones actually the bar shows some seemingly random number, not to bad, can always just hide it, interested in why it does. Quote Share this post Link to post Short link Share on other sites
konrad509 445 #390770 Posted May 15, 2017 If you chose my solution then use the code from the file carouselNormal.xc from my last post, not the first one. Quote Share this post Link to post Short link Share on other sites
scyorkie 50 #390799 Posted May 15, 2017 (edited) It seems that the {{v.xpToElite}} macro has certain rules:- the macro has no values for stock tanks with nothing researched and no games played - otherwise, for tanks with multiple modules and future tanks unresearched, the macro totals the XP for all of these components, but disregards what has already been researched - thus, for tanks with only 1 module (or tank) left to research, the macro only considers the XP required to get that component That's why my friend's T28 Prot had an almost 100% bar. Similarly for my brother's KV-2, as it disregards the fact that the T-150 is researched, and only looks at the progress towards the S-51. For my M53/55, it only looks at the XP required for the T92, and disregards the XP for the modules on the M53/55. Basically, as you play your tank and research modules, the progress bar (regardless whether it counts up based on XP accumulated, or counts down based on XP remaining) can shorten or lengthen, and it will seem random unless you understand the rules behind the {{v.xpToElite}} macro. And this is why I've decided that I prefer a simple text display of {{v.xpToEliteLeft}}, over a progress bar. Lastly, this is what I'm using to display {{v.xpToEliteLeft}}: {{v.xpToEliteLeft>10000?{{py:math.div({{v.xpToEliteLeft}},1000)%-2d~k}}|{{v.xpToEliteLeft>1000?{{py:math.div({{v.xpToEliteLeft}},1000)%-2.1f~k}}|{{v.xpToEliteLeft}}}}}} The above shows: - XXk if more than 10k XP left (round to thousands, no decimals) - X.Xk if between 1k and 10k XP left (round to thousands, 1 decimal) - XXX if less than 1k XP left (no rounding) Edited May 15, 2017 by scyorkie Quote Share this post Link to post Short link Share on other sites
scyorkie 50 #393619 Posted June 3, 2017 To update, my methods above produced syntax errors in xvm.log. To avoid these errors, this line for example: {{v.xpToEliteLeft>10000?{{py:math.div({{v.xpToEliteLeft}},1000)%-2d~k}}|{{v.xpToEliteLeft>1000?{{py:math.div({{v.xpToEliteLeft}},1000)%-2.1f~k}}|{{v.xpToEliteLeft}}}}}} has to be edited to look like this: {{v.xpToEliteLeft>10000?{{py:math.div({{v.xpToEliteLeft|1}},1000)%-2d~k}}|{{v.xpToEliteLeft>1000?{{py:math.div({{v.xpToEliteLeft|1}},1000)%-2.1f~k}}|{{v.xpToEliteLeft}}}}}} to avoid null values for tanks that have been elited. And this is how my XP bars look like in the carousel at the moment: http://i.imgur.com/er4cbz8.jpg Quote Share this post Link to post Short link Share on other sites