Jump to content
Korean Random
Sign in to follow this  
joscha999

Carousel Config value normalization

Recommended Posts

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

Share this post


Link to post

Short link
Share on other sites

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 by scyorkie

Share this post


Link to post

Short link
Share on other sites

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.

Share this post


Link to post

Short link
Share on other sites

If you chose my solution then use the code from the file carouselNormal.xc from my last post, not the first one.

Share this post


Link to post

Short link
Share on other sites

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 by scyorkie

Share this post


Link to post

Short link
Share on other sites

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

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...