Nerexis

Disable scientific notation

9 posts in this topic

Is it possible to disable scientific notation for prices in shop? I have prices going into millions, and I dont want something like this 5.0+e005 etc. but 50000000 or even better 5 000 000.

Share this post


Link to post
Share on other sites

I don't believe this is possible, I've not seen it on any other servers and I suspect it's an ARMA 3 output that cannot be changed. See what others say though as I'd love to be proven wrong.

Share this post


Link to post
Share on other sites
Advertisement

You can make abbreviations for the high amounts, because Arma simply won't show these amounts without fucking it up, so you can make if statements to change the output so: 

100000 = 100k - For example. 

A lot of people complained about the statusbar doing the exact same thing. But that's the only solution to this, make if statements "if above xxxxx then" B|

Share this post


Link to post
Share on other sites

Nah, you are wrong guys, I have figured it out.
To do that, overwrite ExileClient_gui_vehicleTraderDialog_updateVehicleListBox.sqf

/**
 * ExileClient_gui_vehicleTraderDialog_updateVehicleListBox
 *
 * Exile Mod
 * exile.majormittens.co.uk
 * © 2015 Exile Mod Team
 *
 * This work is licensed under the Creative Commons Attribution-NonCommercial-NoDerivatives 4.0 International License. 
 * To view a copy of this license, visit http://creativecommons.org/licenses/by-nc-nd/4.0/.
 */
 
private["_dialog","_categoryClasses","_itemListControl","_categoryClass","_categoryVehicleClassNames","_className","_salesPrice","_indexEntryIndex","_playerMoney","_quality","_requiredRespect","_qualityColor","_popTabColor","_missingPopTabs","_missingRespect"];
disableSerialization;
_dialog = uiNameSpace getVariable ["RscExileVehicleTraderDialog", displayNull];
_categoryClasses = _this;
if (_categoryClasses select 0 == "") then
{
    _categoryClasses = getArray(missionConfigFile >> "CfgTraders" >> ExileClientCurrentTrader >> "categories");
};
_itemListControl = _dialog displayCtrl 4001;
// added by nerexis, thanks to reddit user https://www.reddit.com/user/AgentRev for this function
fnConvertNumber = {
    private ["_number","_mod","_digots","_digitsCount","_modBase","_numberText"];

    _number = [_this,0,0,[0]] call BIS_fnc_param;
    if (!finite _number) exitWith { str _number };

    _mod = [_this,1,3,[0]] call BIS_fnc_param;

    _digits = _number call BIS_fnc_numberDigits;
    _digitsCount = count _digits - 1;

    _modBase = _digitsCount % _mod;
    _numberText = "";

    {
        _numberText = _numberText + str _x;
        if ((_forEachIndex - _modBase) % _mod == 0 && _forEachIndex != _digitsCount) then { _numberText = _numberText + "," };
    } foreach _digits;

    _numberText
};

lbClear _itemListControl;
{
    _categoryClass = _x;
    _categoryVehicleClassNames = getArray(missionConfigFile >> "CfgTraderCategories" >> _categoryClass >> "items");
    {
        _className = _x;
        _salesPrice = getNumber(missionConfigFile >> "CfgExileArsenal" >> _className >> "price");
        _indexEntryIndex = _itemListControl lbAdd getText(configFile >> "CfgVehicles" >> _className >> "displayName");
        _playerMoney = player getVariable ["ExileMoney", 0];
        _quality = getNumber(missionConfigFile >> "CfgExileArsenal" >> _className >> "quality");
        _requiredRespect = getNumber(missionConfigFile >> "CfgTrading" >> "requiredRespect" >> format["Level%1",_quality]);
        _qualityColor = [1, 1, 1, 1];
        _popTabColor = [1, 1, 1, 1];
        switch (_quality) do
        {
            case 2:          { _qualityColor = [0.62, 0.87 ,0.23, 1]; };
            case 3:         { _qualityColor = [0, 0.78, 0.92, 1]; };
            case 4:         { _qualityColor = [0.62, 0.27, 0.58, 1]; };
            case 5:         { _qualityColor = [1, 0.7, 0.09, 1]; };
            case 6:         { _qualityColor = [0.93, 0, 0.48, 1]; };                        
        };
        if (_salesPrice > _playerMoney) then
        {
            _popTabColor = [0.91, 0, 0, 0.6];
            _missingPopTabs = _salesPrice - _playerMoney;
            _itemListControl lbSetTooltip [_indexEntryIndex, format["Missing %1 Pop Tabs", _missingPopTabs call fnConvertNumber]];
        };
        if (_requiredRespect > ExileClientPlayerScore) then
        {
            _qualityColor set [3, 0.3];
            _popTabColor set [3, 0.3];
            _missingRespect = _requiredRespect - ExileClientPlayerScore;
            _itemListControl lbSetTooltip [_indexEntryIndex, format["Missing %1 Respect", _missingRespect]];
        };
        if ((_salesPrice > _playerMoney) && (_requiredRespect > ExileClientPlayerScore)) then
        {
            _itemListControl lbSetTooltip [_indexEntryIndex, format["Missing %1 Pop Tabs & %2 Respect", _missingPopTabs call fnConvertNumber, _missingRespect]];
        };
        _itemListControl lbSetData [_indexEntryIndex, _className];
        _itemListControl lbSetTextRight [_indexEntryIndex, format["%1", _salesPrice call fnConvertNumber]];
        _itemListControl lbSetPictureRight [_indexEntryIndex, "exile_assets\texture\ui\poptab_trader_ca.paa"];
        _itemListControl lbSetColor [_indexEntryIndex, _qualityColor];
        _itemListControl lbSetColorRight [_indexEntryIndex, _popTabColor];
        _itemListControl lbSetPictureRightColor [_indexEntryIndex, _popTabColor];
        _itemListControl lbSetValue [_indexEntryIndex, _quality * 100000 + _salesPrice];
    }
    forEach _categoryVehicleClassNames;
}
forEach _categoryClasses;
lbSortByValue _itemListControl;
true

 

  • Like 2

Share this post


Link to post
Share on other sites

We are testing it and its working so far. Only traders. You have to use that function which formats number into text variable to use it somewhere else.

fnConvertNumber
Edited by Nerexis
  • Like 1

Share this post


Link to post
Share on other sites

@Nerexis Awesome work!  I've seen the scientific notation issue on MANY servers that have high value items. I specifically designed my server economy to prevent anything at the traders costing over 999,999 PT's. Probably would have been easier to use the script :)

Share this post


Link to post
Share on other sites
13 hours ago, infiSTAR said:

maybe because it's changing the value a bit

yfxNJIJClRk7z0YXaaKSQ.png

but idk

Very interesting, most reasonable numbers return properly lol. I think anything under 2 billion will be fine, of course with a 32bit program anything over 2,147,483,647 will certainly not work correctly, so Arma being 32bit will definitely not display that particular number right ;)

Share this post


Link to post
Share on other sites
Advertisement

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

  • Recently Browsing   0 members

    No registered users viewing this page.