Jump to content

[RELEASE] VASP - Vehicle and Skin preview on Traders v1.2 (Updated 06/18/2014)


Recommended Posts

Has anyone got this working on zupa's Single currency 3.0 yet.

 

I think I got one part done!! Line 2 doesn't seem right

	// trader menu code
	if (DZE_ConfigTrader) then {
		call compile preprocessFileLineNumbers "custom\Virtual_Currency\player_traderMenu.sqf";
	}else{
		call compile preprocessFileLineNumbers "custom\Virtual_Currency\cfgServerTrader.hpp";
	};

// trader menu code
    if (DZE_ConfigTrader) then {
        call compile preprocessFileLineNumbers "custom\VASP\player_traderMenuConfig.sqf";
    }else{
        call compile preprocessFileLineNumbers "custom\VASP\player_traderMenuHive.sqf";
    };
Link to comment
Share on other sites

  • 2 weeks later...
  • 1 month later...

Hello everybody.

 

Many thanks for this awesome kind of script :).

That's exactly what sure everybody wanted to have (How much space has this Lada and how looks these Ural trucks exacty?).

 

It work's fine on my Server, but i noticed a client side error (arma2oa.rpt).

As i say, everything works. But i want to know what this error causes and how i can fix that.

 

Error in expression <) displayRemoveEventHandler ["KeyDown", VehiclePreviewHotkey];


VehiclePreviewH>
  Error position: <VehiclePreviewHotkey];


VehiclePreviewH>
  Error Nicht definierte Variable in Ausdruck: vehiclepreviewhotkey
File mpmissions\__CUR_MP.chernarus\ZSC\gold\player_traderMenu.sqf, line 256
Error in expression <) displayRemoveEventHandler ["KeyDown", VehiclePreviewHotkey];


VehiclePreviewH>
  Error position: <VehiclePreviewHotkey];


VehiclePreviewH>
  Error Nicht definierte Variable in Ausdruck: vehiclepreviewhotkey
File mpmissions\__CUR_MP.chernarus\ZSC\gold\player_traderMenu.sqf, line 256
Error in expression <) displayRemoveEventHandler ["KeyDown", SkinPreviewHotkey];


SkinPreviewHotkey >
  Error position: <SkinPreviewHotkey];


SkinPreviewHotkey >
  Error Nicht definierte Variable in Ausdruck: skinpreviewhotkey
File mpmissions\__CUR_MP.chernarus\ZSC\gold\player_traderMenu.sqf, line 327
Error in expression <) displayRemoveEventHandler ["KeyDown", SkinPreviewHotkey];


SkinPreviewHotkey >
  Error position: <SkinPreviewHotkey];


SkinPreviewHotkey >
  Error Nicht definierte Variable in Ausdruck: skinpreviewhotkey
File mpmissions\__CUR_MP.chernarus\ZSC\gold\player_traderMenu.sqf, line 327

 

I merged the player_traderMenu.sqf with the one from Zupas single currency 3.0

 

Thanks for your help. :)

Link to comment
Share on other sites

 

Has anyone got this working on zupa's Single currency 3.0 yet.

 

I think I got one part done!! Line 2 doesn't seem right

	// trader menu code
	if (DZE_ConfigTrader) then {
		call compile preprocessFileLineNumbers "custom\Virtual_Currency\player_traderMenu.sqf";
	}else{
		call compile preprocessFileLineNumbers "custom\Virtual_Currency\cfgServerTrader.hpp";
	};

// trader menu code
    if (DZE_ConfigTrader) then {
        call compile preprocessFileLineNumbers "custom\VASP\player_traderMenuConfig.sqf";
    }else{
        call compile preprocessFileLineNumbers "custom\VASP\player_traderMenuHive.sqf";
    };

 

Im using single currency 3.0 too and not seeing anything, nore does my f5 open the menu.

 

I also did the changes in my infistar, which it shouldnt block superadmins from execing the code. So I don't think its infistars issue at this point in time.

 

I have re-verified my files and they are correct.

 

Any clue as to why this is happening? I don't know what the quote guys talking about but he might be on to something with the 3.0 traders?

Link to comment
Share on other sites

  • 1 month later...
  • 4 weeks later...

Has anyone had any luck using this alongside ZSC 3.0 and Advanced Trading? I remapped the preview button to 'L' as I'm running Infistar but the hint window never appears even with the debug monitor closed and pressing 'L' yields no previews.

Link to comment
Share on other sites

Sorry guys but one of the basic skills you should be learning at first is diffmerge or merge with notepad, what i personally thing looks nicer.

So if somebody provides files instead of code blocks you should diffmerge them and shout at creator, after thanking him for all that work.

So, yeah umm getting this to work with zsc shouldn't be that hard. As you'll just have to try it and we'll help solving issues.

Link to comment
Share on other sites

you dont have to understand whats going on in there, just let it display for you:

 

just make a simple:

diag_log format ["MyDebug: _myVariable1: %1 | _myVariable2: %2 | myfunction: %3",_myVariable1,_myVariable2, (player distance _position)];

This output you can read in the RPT, for server files in your server RPT (instance_XX_worldmap) and for client scripts in your local RPT (C:\Users\Username_000\AppData\Local\ArmA 2 OA)

Link to comment
Share on other sites

  • 4 weeks later...

Has anyone had any luck using this alongside ZSC 3.0 and Advanced Trading? I remapped the preview button to 'L' as I'm running Infistar but the hint window never appears even with the debug monitor closed and pressing 'L' yields no previews.

 

I'd be interested in this as well. When I have more time I'll look around in the files to see if I can figure it out, but in the mean time maybe someone that has done it will share.

Link to comment
Share on other sites

  • 2 weeks later...

i tried to install VASP today into the files from ElDubya

without success...

the hint for F5 never shows up... and i can press F5 until my keyboard breaks... nothing happens...

 

so it seems this needs some kind of update to make it work with these mods in combination...

 

EDIT:

 

 

so VASP changes 2 files

player_traderMenuConfig.sqf

player_traderMenuHive.sqf

 

and zupas singlecoin also changes one... different name but similar content

which is player_traderMenu.sqf

so i guess we need to combine these files

Link to comment
Share on other sites

  • 2 weeks later...
  • 2 months later...

I need help...

I'm trying to install VASP on my Epoch-Server to my various scripts, like shorter buying animation and CFG-Trader.

But even for me as admin it doesnt work.

I don't even know if its probably loaded.
Cause my custom-Debug-Monitor may block ur display.

So I have 2 Questions: why not add a little line in chat like AGN-Safezones instead of the Monitor?
and How do I verify the script is at least being loaded?

When I push F5 NOTHING happens. I have also Vector-Building and Alchemical Crafting installed, they may struggle with VASP as they also check for F5.

 

EDIT:
I already added a systemchat and even not this is displaying so it seems to be, that the script is not even loaded.

Edited by Basti890
Link to comment
Share on other sites

 

Ok so after trying to install this many, MANY times. I finally figured it out.  One of the main reasons i wanted this script is so people could see my custom textures on the vehicles before they buy it.  Because in the list of the trader its just the name of it.

Not to mention the beautiful work of otternas.  This is amazing work :)

I use SC 2.0, I had to merge both the files player_traderMenuConfig.sqf and player_traderMenuHive.sqf with the single currency ones. But using bits and pieces from the Single currency into the VASP.  So the compiles look like in the Original post.

I also noticed at the very bottom of my compiles it was calling again for

 

call compile preprocessFileLineNumbers "Scripts\Gold_Coin_system\Trading_Stuff\player_traderMenu.sqf";

 

so i changed it to

call compile preprocessFileLineNumbers "custom\VASP\player_traderMenuConfig.sqf";

all this after merging the files.

Finally i got it working after doing this. I change the preview command to the letter "H" also.

I was super happy to get it working, but it was not showing my custom skins.  I fixed that by adding 

 

#include "suvskins.sqf";

 

above

 

/* Create the Cam */

 

in the VASP_init.sqf

As for the SUV skins, I used these links to get it working.  And you must take the "skin.sqf" you've created and copy and paste it in the VASP folder for the custom skins to show in VASP.

Here is a picture of my Canadian SUV skin in the VASP editor

Here is my player_traderMenuConfig

 

/*------------------------------------*/
/* VASP v1.3                          */
/* Vehicle and Skin Preview           */
/* OtterNas3                          */
/* 06/17/2014                         */
/* Last update: 06/22/2014            */
/*------------------------------------*/

// trader menu gui by maca134
TraderDialogCatList = 12000;
TraderDialogItemList = 12001;
TraderDialogBuyPrice = 12002;
TraderDialogSellPrice = 12003;
TraderDialogBuyBtn = 12004;
TraderDialogSellBtn = 12005;
TraderDialogCurrency = 12006;

TraderCurrentCatIndex = -1;
TraderCatList = -1;
TraderItemList = -1;

TraderDialogLoadItemList = {
    private ["_index","_trader_id","_activatingPlayer","_distance","_objclass","_item_list"];
    TraderItemList = -1;
    _index = _this select 0;

    LastTraderSelectCategory = _index;
    if (_index < 0) exitWith {};
    //TraderCurrentCatIndex = _index;

    _trader_id = TraderCatList select _index;
    _activatingPlayer = player;

    lbClear TraderDialogItemList;
    ctrlSetText [TraderDialogBuyPrice, ""];
    ctrlSetText [TraderDialogSellPrice, ""];

    _cfgTraderCategory = missionConfigFile >> "CfgTraderCategory" >> (format["Category_%1",_trader_id]);    

    PVDZE_plr_TradeMenuResult = [];
    
    for "_i" from 0 to ((count _cfgTraderCategory) - 1) do {
        _class = configName (_cfgTraderCategory select _i);
                    
        _type  = getText ((_cfgTraderCategory select _i) >> "type");    
        _buy  = getArray ((_cfgTraderCategory select _i) >> "buy");    
        _sell = getArray ((_cfgTraderCategory select _i) >> "sell");
        
        _buy set [2,1];
        _sell set [2,1];

        _typeNum = 1;
        if (_type == "trade_weapons") then {
            _typeNum = 3;
        } else { 
            if (_type in ["trade_backpacks", "trade_any_vehicle", "trade_any_vehicle_free", "trade_any_boat", "trade_any_bicycle"]) then {
                _typeNum = 2;
            };
        };
        
        _data = [9999,[_class,_typeNum],99999,_buy,_sell,0,_trader_id,_type];
        
        PVDZE_plr_TradeMenuResult set [count PVDZE_plr_TradeMenuResult, _data];
    };

    lbClear TraderDialogItemList;
    _item_list = [];
    {
        private ["_header", "_item", "_name", "_type", "_textPart", "_qty", "_buy", "_bqty", "_bname", "_btype", "_btextCurrency", "_sell", "_sqty", "_sname", "_stype", "_stextCurrency", "_order", "_order", "_afile", "_File", "_count", "_bag", "_bagclass", "_index", "_image"];
        _header = _x select 0; // "TRD"
        _item = _x select 1;
        _name = _item select 0;
        _type = _item select 1;
        switch (true) do {
            case (_type == 1): {
                _type = "CfgMagazines";
            }; 
            case (_type == 2): {
                _type = "CfgVehicles";
            }; 
            case (_type == 3): {
                _type = "CfgWeapons";
            };
        };
        // Display Name of item
        _textPart =    getText(configFile >> _type >> _name >> "displayName");

        // Total in stock
        _qty = _x select 2;

        // Buy Data from array
        _buy = _x select 3;
        _bqty = _buy select 0;
        _bname = _buy select 1;
        _btype = _buy select 2;
        switch(true)do{ 
            case (_btype == 1): {
                _btype = "CfgMagazines";
            }; 
            case (_btype == 2): {
                _btype = "CfgVehicles";
            }; 
            case (_btype == 3): {
                _btype = "CfgWeapons";
            }; 
        }; 

        // Display Name of buy item
        _btextCurrency = getText(configFile >> _btype >> _bname >> "displayName");

        _sell = _x select 4;
        _sqty = _sell select 0;
        _sname = _sell select 1;
        _stype = _sell select 2;
        switch(true)do{ 
            case (_stype == 1): { 
                _stype = "CfgMagazines";
            }; 
            case (_stype == 2): { 
                _stype = "CfgVehicles";
            }; 
            case (_stype == 3): { 
                _stype = "CfgWeapons";
            }; 
        }; 
        // Display Name of sell item
        _stextCurrency =    getText(configFile >> _stype >> _sname >> "displayName");

        // Menu sort order
        _order = _x select 5;

        // Action file to use for trade
        _afile = _x select 7;
        _File = "Scripts\Gold_Coin_system\Trading_Stuff\" + _afile + ".sqf";
        _count = 0;
        if(_type == "CfgVehicles") then {
            if (_afile == "trade_backpacks") then {
                _bag = unitBackpack player;
                _bagclass = typeOf _bag;
                if(_name == _bagclass) then {
                    _count = 1;
                };
            } else {
                if (isClass(configFile >> "CfgVehicles" >> _name)) then {
                    _distance = dayz_sellDistance_vehicle;
                    if (_name isKindOf "Air") then {
                        _distance = dayz_sellDistance_air;
                    };
                    if (_name isKindOf "Ship") then {
                        _distance = dayz_sellDistance_boat;
                    };
                    _count = {(typeOf _x) == _name} count (nearestObjects [(getPosATL player), [_name], _distance]);
                };
            };
        };

        if(_type == "CfgMagazines") then {
            _count = {_x == _name} count magazines player;
        };

        if(_type == "CfgWeapons") then {
            _count = {_x == _name} count weapons player;
        };

        _index = lbAdd [TraderDialogItemList, format["%1 (%2)", _textPart, _name]];

        if (_count > 0) then {
            lbSetColor [TraderDialogItemList, _index, [0, 1, 0, 1]];
        };

        _image = getText(configFile >> _type >> _name >> "picture");
        lbSetPicture [TraderDialogItemList, _index, _image];

        _item_list set [count _item_list, [
            _name,
            _textPart,
            _bqty,
            _bname,
            _btextCurrency,
            _sqty,
            _sname,
            _stextCurrency,
            _header,
            _File
        ]];
    } forEach PVDZE_plr_TradeMenuResult;
    TraderItemList = _item_list;
    TraderCategoryLoadFinished = true;
};

TraderDialogShowPrices = {
    private ["_index", "_item"];
    _index = _this select 0;

    LastTraderSelectItem = _index;

    if (_index < 0) exitWith {};
    while {count TraderItemList < 1} do { sleep 1; };
    _item = TraderItemList select _index;

    _qty = {_x == (_item select 3)} count magazines player;

    ctrlSetText [TraderDialogBuyPrice, format["%1 %2", _item select 2, _item select 4]];

    /*
    if(_qty == 0) then {
        ctrlEnable [TraderDialogBuyBtn, false];
    } else {
        ctrlEnable [TraderDialogBuyBtn, true];
    };
    */

    ctrlSetText [TraderDialogSellPrice, format["%1 %2", _item select 5, _item select 7]];

    /* If Vehicle-Preview is enabled in the config */
    if (VASP_VehiclePreview) then {
    
        /* Fail-Safe check if Hotkey is set and if remove it */
        if (!isNil "VehiclePreviewHotkey") then {
            
            /* Reset the VehiclePreviewList variable */
            VehiclePreviewList = nil;
            
            /* Remove the Preview-Hotkey */
            (findDisplay 46) displayRemoveEventHandler ["KeyDown", VehiclePreviewHotkey];
            
            /* Reset the VehiclePreviewHotkey variable */
            VehiclePreviewHotkey = nil;
        };
        
        /* If the Item that clicked on in the Traderdialog is a Vehicle */
        if (["trade_any_",_item select 9] call fnc_inString) then {
            
            /* Store the Traderdialog Item information in VehiclePreviewList */
            VehiclePreviewList = _item;
            
            /* Add the Preview-Hotkey */
            VehiclePreviewHotkey = (findDisplay 46) displayAddEventHandler ["KeyDown", "
                _handled = false;
                if ((_this select 1) == VASP_HotKey) then {
                    [VehiclePreviewList,LastTraderSelectCategory,LastTraderSelectItem] spawn ON_fnc_VehiclePreview;
                    _handled = true;
                };
                _handled
            "];
            
            /* If Infistar is running we override his Debug-Monitor */
            if (ServerRunsInfistar) then {
                debugMonitorX = false;
            };
            
                [
            format ["<t size='0.80' font = 'Bitstream' color='#009FCF' align='center'>! PREVIEW !<br/></t>
            <t></t><br/>
            <t size='0.6'font='Bitstream'align='center'color='#FFFFFF'>For preview of</t><br/>
            <t></t><br/>
            <t size='0.6'font='Bitstream'align='center'color='#31C300'>%1</t><br/>
            <t></t><br/>
            <t size='0.6'font='Bitstream'align='center'color='#FFFFFF'>Press H now</t><br/>",
            (_item select 1)],
            [safezoneX + safezoneW - 0.6,0.50],
            [safezoneY + safezoneH - 0.9,0.7],
            2,
            0.5
            ] spawn BIS_fnc_dynamicText;

            /* Spawn check for Dialog close */
            [] spawn {
                
                /* Wait until the Tradermenu is closes either by Preview-Hotkey or by closing the Traderdialog normal */
                waitUntil {sleep 0.1;!dialog};
                
                /* If Infistar is running we remove the override of his Debug-Monitor */
                if (ServerRunsInfistar) then {
                    debugMonitorX = false;
                };
                
                /* Remove the Preview-Hotkey */
                (findDisplay 46) displayRemoveEventHandler ["KeyDown", VehiclePreviewHotkey];
                
                /* Reset the VehiclePreviewHotkey variable */
                VehiclePreviewHotkey = nil;
            };
        };
    };
    
    /* If Skin-Preview is enabled in the config */
    if (VASP_SkinPreview) then {
        
        /* Fail-Safe check if Hotkey is set and if remove it */
        if (!isNil "SkinPreviewHotkey") then {

            /* Reset the SkinPreviewList variable */
            SkinPreviewList = nil;

            /* Remove the Preview-Hotkey */
            (findDisplay 46) displayRemoveEventHandler ["KeyDown", SkinPreviewHotkey];

            /* Reset the SkinPreviewHotkey variable */
            SkinPreviewHotkey = nil;
        };

        /* If the Item that clicked on in the Traderdialog is a Skin */
        if ((_item select 9) == "\z\addons\dayz_code\actions\trade_items.sqf" && (_item select 0) in AllAllowedSkins) then {
            
            /* Store the Traderdialog Item information in VehiclePreviewList */
            SkinPreviewList = _item;
            
            /* Add the Preview-Hotkey */
            SkinPreviewHotkey = (findDisplay 46) displayAddEventHandler ["KeyDown", "
                _handled = false;
                if ((_this select 1) == VASP_HotKey) then {
                    [SkinPreviewList,LastTraderSelectCategory,LastTraderSelectItem] spawn ON_fnc_SkinPreview;
                    _handled = true;
                };
                _handled
            "];

            /* If Infistar is running we override his Debug-Monitor */
            if (ServerRunsInfistar) then {
                debugMonitorX = false;
            };

                [
            format ["<t size='0.80' font = 'Bitstream' color='#009FCF' align='center'>! PREVIEW !<br/></t>
            <t></t><br/>
            <t size='0.6'font='Bitstream'align='center'color='#FFFFFF'>For preview of</t><br/>
            <t></t><br/>
            <t size='0.6'font='Bitstream'align='center'color='#31C300'>%1</t><br/>
            <t></t><br/>
            <t size='0.6'font='Bitstream'align='center'color='#FFFFFF'>Press H now</t><br/>",
            (_item select 1)],
            [safezoneX + safezoneW - 0.6,0.50],
            [safezoneY + safezoneH - 0.9,0.7],
            2,
            0.5
            ] spawn BIS_fnc_dynamicText;

            /* Spawn check for Dialog close */
            [] spawn {

                /* Wait until the Tradermenu is closes either by Preview-Hotkey or by closing the Traderdialog normal */
                waitUntil {sleep 0.1;!dialog};
                
                /* If Infistar is running we remove the override of his Debug-Monitor */
                if (ServerRunsInfistar) then {
                    debugMonitorX = false;
                };
                
                /* Remove the Preview-Hotkey */
                (findDisplay 46) displayRemoveEventHandler ["KeyDown", SkinPreviewHotkey];

                /* Reset the VehiclePreviewHotkey variable */
                SkinPreviewHotkey = nil;
            };
        };
    };
};

TraderDialogBuy = {
    private ["_index", "_item", "_data"];
    _index = _this select 0;
    if (_index < 0) exitWith {
        cutText [(localize "str_epoch_player_6"), "PLAIN DOWN"];
    };
    _item = TraderItemList select _index;

    if( 0 > 1 )then{

    _data = [_item select 0, _item select 1, _item select 2, _item select 8];
    _data execVM "Scripts\Gold_Coin_system\Trading_Stuff\trade_items_buy.sqf";

    } else {

    _data = [_item select 0, _item select 3, 1, _item select 2, "buy", _item select 4, _item select 1, _item select 8];
    [0, player, '', _data] execVM (_item select 9);

    };
    TraderItemList = -1;
};

TraderDialogSell = {
    private ["_index", "_item", "_data"];
    _index = _this select 0;
    if (_index < 0) exitWith {
        cutText [(localize "str_epoch_player_6"), "PLAIN DOWN"];
    };
    _item = TraderItemList select _index;

    if( 0 > 1 )then{

    _data = [_item select 0, _item select 1, _item select 5, _item select 8];
    _data execVM "Scripts\Gold_Coin_system\Trading_Stuff\trade_items_sell.sqf";

    } else {

    _data = [_item select 6, _item select 0, _item select 5, 1, "sell", _item select 1, _item select 7, _item select 8];
    [0, player, '', _data] execVM (_item select 9);

    };
    TraderItemList = -1;
};

 

and here is my player_traderMenuHive

 

/*------------------------------------*/
/* VASP v1.3                          */
/* Vehicle and Skin Preview           */
/* OtterNas3                          */
/* 06/17/2014                         */
/* Last update: 06/22/2014            */
/*------------------------------------*/

// trader menu gui by maca134
TraderDialogCatList = 12000;
TraderDialogItemList = 12001;
TraderDialogBuyPrice = 12002;
TraderDialogSellPrice = 12003;
TraderDialogBuyBtn = 12004;
TraderDialogSellBtn = 12005;
TraderDialogCurrency = 12006;

TraderCurrentCatIndex = -1;
TraderCatList = -1;
TraderItemList = -1;

TraderDialogLoadItemList = {
    private ["_index","_trader_id","_activatingPlayer","_distance","_objclass","_item_list"];
    TraderItemList = -1;
    _index = _this select 0;

    LastTraderSelectCategory = _index;

    if (_index < 0 or TraderCurrentCatIndex == _index) exitWith {};
    TraderCurrentCatIndex = _index;

    _trader_id = TraderCatList select _index;
    _activatingPlayer = player;

    lbClear TraderDialogItemList;
    ctrlSetText [TraderDialogBuyPrice, ""];
    ctrlSetText [TraderDialogSellPrice, ""];
    lbAdd [TraderDialogItemList, "Loading precious items..."];

    //PVDZE_plr_TradeMenuResult = call compile format["tcacheBuy_%1;",_trader_id];
    PVDZE_plr_TradeMenuResult = missionNamespace getVariable (format["tcacheBuy_%1;",_trader_id]);

    //[[5969,["Ikarus",2],10003,[5,"ItemGoldBar",1],[3,"ItemGoldBar",1],0,588,"trade_any_vehicle"],[5970,["Ikarus_TK_CIV_EP1",2],10006,[5,"ItemGoldBar",1],[3,"ItemGoldBar",1],0,588,"trade_any_vehicle"],[5971,["S1203_TK_CIV_EP1",2],10004,[4,"ItemGoldBar",1],[2,"ItemGoldBar",1],0,588,"trade_any_vehicle"],[5972,["S1203_ambulance_EP1",2],10002,[4,"ItemGoldBar",1],[2,"ItemGoldBar",1],0,588,"trade_any_vehicle"]]

    if(isNil "PVDZE_plr_TradeMenuResult") then {
        PVDZE_plr_TradeMenu = [_activatingPlayer,_trader_id];
        publicVariableServer  "PVDZE_plr_TradeMenu";
        waitUntil {!isNil "PVDZE_plr_TradeMenuResult"};
        if (count PVDZE_plr_TradeMenuResult > 0) then {
            missionNamespace setVariable [(format["tcacheBuy_%1;",_trader_id]),PVDZE_plr_TradeMenuResult];
        };
    };

    lbClear TraderDialogItemList;
    _item_list = [];
    {
        private ["_header", "_item", "_name", "_type", "_textPart", "_qty", "_buy", "_bqty", "_bname", "_btype", "_btextCurrency", "_sell", "_sqty", "_sname", "_stype", "_stextCurrency", "_order", "_order", "_afile", "_File", "_count", "_bag", "_bagclass", "_index", "_image"];
        _header = _x select 0; // "TRD"
        _item = _x select 1;
        _name = _item select 0;
        _type = _item select 1;
        switch (true) do {
            case (_type == 1): {
                _type = "CfgMagazines";
            }; 
            case (_type == 2): {
                _type = "CfgVehicles";
            }; 
            case (_type == 3): {
                _type = "CfgWeapons";
            };
        };
        // Display Name of item
        _textPart =    getText(configFile >> _type >> _name >> "displayName");

        // Total in stock
        _qty = _x select 2;

        // Buy Data from array
        _buy = _x select 3;
        _bqty = _buy select 0;
        _bname = _buy select 1;
        _btype = _buy select 2;
        switch(true)do{ 
            case (_btype == 1): {
                _btype = "CfgMagazines";
            }; 
            case (_btype == 2): {
                _btype = "CfgVehicles";
            }; 
            case (_btype == 3): {
                _btype = "CfgWeapons";
            }; 
        }; 

        // Display Name of buy item
        _btextCurrency = getText(configFile >> _btype >> _bname >> "displayName");

        _sell = _x select 4;
        _sqty = _sell select 0;
        _sname = _sell select 1;
        _stype = _sell select 2;
        switch(true)do{ 
            case (_stype == 1): { 
                _stype = "CfgMagazines";
            }; 
            case (_stype == 2): { 
                _stype = "CfgVehicles";
            }; 
            case (_stype == 3): { 
                _stype = "CfgWeapons";
            }; 
        }; 
        // Display Name of sell item
        _stextCurrency =    getText(configFile >> _stype >> _sname >> "displayName");

        // Menu sort order
        _order = _x select 5;

        // Action file to use for trade
        _afile = _x select 7;
        _File = "Scripts\Gold_Coin_system\Trading_Stuff\" + _afile + ".sqf";
        _count = 0;
        if(_type == "CfgVehicles") then {
            if (_afile == "trade_backpacks") then {
                _bag = unitBackpack player;
                _bagclass = typeOf _bag;
                if(_name == _bagclass) then {
                    _count = 1;
                };
            } else {
                if (isClass(configFile >> "CfgVehicles" >> _name)) then {
                    _distance = dayz_sellDistance_vehicle;
                    if (_name isKindOf "Air") then {
                        _distance = dayz_sellDistance_air;
                    };
                    if (_name isKindOf "Ship") then {
                        _distance = dayz_sellDistance_boat;
                    };
                    _count = {(typeOf _x) == _name} count (nearestObjects [(getPosATL player), [_name], _distance]);
                };
            };
        };

        if(_type == "CfgMagazines") then {
            _count = {_x == _name} count magazines player;
        };

        if(_type == "CfgWeapons") then {
            _count = {_x == _name} count weapons player;
        };

        _index = lbAdd [TraderDialogItemList, format["%1 (%2)", _textPart, _name]];

        if (_count > 0) then {
            lbSetColor [TraderDialogItemList, _index, [0, 1, 0, 1]];
        };

        _image = getText(configFile >> _type >> _name >> "picture");
        lbSetPicture [TraderDialogItemList, _index, _image];

        _item_list set [count _item_list, [
            _name,
            _textPart,
            _bqty,
            _bname,
            _btextCurrency,
            _sqty,
            _sname,
            _stextCurrency,
            _header,
            _File
        ]];
    } forEach PVDZE_plr_TradeMenuResult;
    TraderItemList = _item_list;
    TraderCategoryLoadFinished = true;
};

TraderDialogShowPrices = {
    private ["_index", "_item"];
    _index = _this select 0;
    LastTraderSelectItem = _index;
    if (_index < 0) exitWith {};
    while {count TraderItemList < 1} do { sleep 1; };
    _item = TraderItemList select _index;

    _qty = {_x == (_item select 3)} count magazines player;

    ctrlSetText [TraderDialogBuyPrice, format["%1 %2", _item select 2, _item select 4]];

    /*
    if(_qty == 0) then {
        ctrlEnable [TraderDialogBuyBtn, false];
    } else {
        ctrlEnable [TraderDialogBuyBtn, true];
    };
    */

    ctrlSetText [TraderDialogSellPrice, format["%1 %2", _item select 5, _item select 7]];

    /* If Vehicle-Preview is enabled in the config */
    if (VASP_VehiclePreview) then {
    
        /* Fail-Safe check if Hotkey is set and if remove it */
        if (!isNil "VehiclePreviewHotkey") then {
            
            /* Reset the VehiclePreviewList variable */
            VehiclePreviewList = nil;
            
            /* Remove the Preview-Hotkey */
            (findDisplay 46) displayRemoveEventHandler ["KeyDown", VehiclePreviewHotkey];
            
            /* Reset the VehiclePreviewHotkey variable */
            VehiclePreviewHotkey = nil;
        };
        
        /* If the Item that clicked on in the Traderdialog is a Vehicle */
        if (["trade_any_",_item select 9] call fnc_inString) then {
            
            /* Store the Traderdialog Item information in VehiclePreviewList */
            VehiclePreviewList = _item;
            
            /* Add the Preview-Hotkey */
            VehiclePreviewHotkey = (findDisplay 46) displayAddEventHandler ["KeyDown", "
                _handled = false;
                if ((_this select 1) == VASP_HotKey) then {
                    [VehiclePreviewList,LastTraderSelectCategory,LastTraderSelectItem] spawn ON_fnc_VehiclePreview;
                    _handled = true;
                };
                _handled
            "];
            
            /* If Infistar is running we override his Debug-Monitor */
            if (ServerRunsInfistar) then {
                debugMonitorX = false;
            };
            
                [
            format ["<t size='0.80' font = 'Bitstream' color='#009FCF' align='center'>! PREVIEW !<br/></t>
            <t></t><br/>
            <t size='0.6'font='Bitstream'align='center'color='#FFFFFF'>For preview of</t><br/>
            <t></t><br/>
            <t size='0.6'font='Bitstream'align='center'color='#31C300'>%1</t><br/>
            <t></t><br/>
            <t size='0.6'font='Bitstream'align='center'color='#FFFFFF'>Press H now</t><br/>",
            (_item select 1)],
            [safezoneX + safezoneW - 0.6,0.50],
            [safezoneY + safezoneH - 0.9,0.7],
            2,
            0.5
            ] spawn BIS_fnc_dynamicText;

            /* Spawn check for Dialog close */
            [] spawn {
                
                /* Wait until the Tradermenu is closes either by Preview-Hotkey or by closing the Traderdialog normal */
                waitUntil {sleep 0.1;!dialog};
                
                /* If Infistar is running we remove the override of his Debug-Monitor */
                if (ServerRunsInfistar) then {
                    debugMonitorX = false;
                };
                
                /* Remove the Preview-Hotkey */
                (findDisplay 46) displayRemoveEventHandler ["KeyDown", VehiclePreviewHotkey];
                
                /* Reset the VehiclePreviewHotkey variable */
                VehiclePreviewHotkey = nil;
            };
        };
    };
    
    /* If Skin-Preview is enabled in the config */
    if (VASP_SkinPreview) then {
        
        /* Fail-Safe check if Hotkey is set and if remove it */
        if (!isNil "SkinPreviewHotkey") then {

            /* Reset the SkinPreviewList variable */
            SkinPreviewList = nil;

            /* Remove the Preview-Hotkey */
            (findDisplay 46) displayRemoveEventHandler ["KeyDown", SkinPreviewHotkey];

            /* Reset the SkinPreviewHotkey variable */
            SkinPreviewHotkey = nil;
        };

        /* If the Item that clicked on in the Traderdialog is a Skin */
        if ((_item select 9) == "\z\addons\dayz_code\actions\trade_items.sqf" && (_item select 0) in AllAllowedSkins) then {
            
            /* Store the Traderdialog Item information in VehiclePreviewList */
            SkinPreviewList = _item;
            
            /* Add the Preview-Hotkey */
            SkinPreviewHotkey = (findDisplay 46) displayAddEventHandler ["KeyDown", "
                _handled = false;
                if ((_this select 1) == VASP_HotKey) then {
                    [SkinPreviewList,LastTraderSelectCategory,LastTraderSelectItem] spawn ON_fnc_SkinPreview;
                    _handled = true;
                };
                _handled
            "];

            /* If Infistar is running we override his Debug-Monitor */
            if (ServerRunsInfistar) then {
                debugMonitorX = false;
            };

                [
            format ["<t size='0.80' font = 'Bitstream' color='#009FCF' align='center'>! PREVIEW !<br/></t>
            <t></t><br/>
            <t size='0.6'font='Bitstream'align='center'color='#FFFFFF'>For preview of</t><br/>
            <t></t><br/>
            <t size='0.6'font='Bitstream'align='center'color='#31C300'>%1</t><br/>
            <t></t><br/>
            <t size='0.6'font='Bitstream'align='center'color='#FFFFFF'>Press H now</t><br/>",
            (_item select 1)],
            [safezoneX + safezoneW - 0.6,0.50],
            [safezoneY + safezoneH - 0.9,0.7],
            2,
            0.5
            ] spawn BIS_fnc_dynamicText;

            /* Spawn check for Dialog close */
            [] spawn {

                /* Wait until the Tradermenu is closes either by Preview-Hotkey or by closing the Traderdialog normal */
                waitUntil {sleep 0.1;!dialog};
                
                /* If Infistar is running we remove the override of his Debug-Monitor */
                if (ServerRunsInfistar) then {
                    debugMonitorX = false;
                };
                
                /* Remove the Preview-Hotkey */
                (findDisplay 46) displayRemoveEventHandler ["KeyDown", SkinPreviewHotkey];

                /* Reset the VehiclePreviewHotkey variable */
                SkinPreviewHotkey = nil;
            };
        };
    };
};

TraderDialogBuy = {
    private ["_index", "_item", "_data"];
    _index = _this select 0;
    if (_index < 0) exitWith {
        cutText [(localize "str_epoch_player_6"), "PLAIN DOWN"];
    };
    _item = TraderItemList select _index;

    if(_item select 9 == "Scripts\Gold_Coin_system\Trading_Stuff\trade_items.sqf")then{

    _data = [_item select 0, _item select 1, _item select 2, _item select 8];
    _data execVM "Scripts\Gold_Coin_system\Trading_Stuff\trade_items_buy.sqf";
    
    } else {

    _data = [_item select 0, _item select 3, 1, _item select 2, "buy", _item select 4, _item select 1, _item select 8];
    [0, player, '', _data] execVM (_item select 9);
    
    };
    TraderItemList = -1;
};

TraderDialogSell = {
    private ["_index", "_item", "_data"];
    _index = _this select 0;
    if (_index < 0) exitWith {
        cutText [(localize "str_epoch_player_6"), "PLAIN DOWN"];
    };
    _item = TraderItemList select _index;

    if(_item select 9 == "Scripts\Gold_Coin_system\Trading_Stuff\trade_items.sqf")then{

    _data = [_item select 0, _item select 1, _item select 5, _item select 8];
    _data execVM "Scripts\Gold_Coin_system\Trading_Stuff\trade_items_sell.sqf";

    } else {
    
    _data = [_item select 6, _item select 0, _item select 5, 1, "sell", _item select 1, _item select 7, _item select 8];
    [0, player, '', _data] execVM (_item select 9);
    };
    TraderItemList = -1;
};

 

just incase someone needs to compare :)

2015-09-09_00001.jpg

Edited by theduke
learning spoilers LOL
Link to comment
Share on other sites

  • 2 weeks later...

 

Ok so after trying to install this many, MANY times. I finally figured it out.  One of the main reasons i wanted this script is so people could see my custom textures on the vehicles before they buy it.  Because in the list of the trader its just the name of it.

Not to mention the beautiful work of otternas.  This is amazing work :)

I use SC 2.0, I had to merge both the files player_traderMenuConfig.sqf and player_traderMenuHive.sqf with the single currency ones. But using bits and pieces from the Single currency into the VASP.  So the compiles look like in the Original post.

I also noticed at the very bottom of my compiles it was calling again for

 

Hidden Content

so i changed it to

 

Hidden Content

all this after merging the files.

Finally i got it working after doing this. I change the preview command to the letter "H" also.

I was super happy to get it working, but it was not showing my custom skins.  I fixed that by adding 

 

Hidden Content

above

 

Hidden Content

in the VASP_init.sqf

As for the SUV skins, I used these links to get it working.  And you must take the "skin.sqf" you've created and copy and paste it in the VASP folder for the custom skins to show in VASP.

Here is a picture of my Canadian SUV skin in the VASP editor

Here is my player_traderMenuConfig

 

Hidden Content

and here is my player_traderMenuHive

 

Hidden Content

just incase someone needs to compare :)

2015-09-09_00001.jpg

I've did it like you, but if i press F9 (i've changed it) nothing happens.. also the message looks not right

Link to comment
Share on other sites

 

I've did it like you, but if i press F9 (i've changed it) nothing happens.. also the message looks not right

i think the  F keys are keybinds infistar bans...not sure.  If you have infistar that is...  do you have the message that pops up and says hit such button?

Link to comment
Share on other sites

yes message is there... i also tried with "P" but also didnt work :(

if the message appears you are close...make sure your compiles look like this while making sure the paths match yours

 

 /*
    if (DZE_ConfigTrader) then {
        call compile preprocessFileLineNumbers "\z\addons\dayz_code\compile\player_traderMenuConfig.sqf";
    } else {
        call compile preprocessFileLineNumbers "\z\addons\dayz_code\compile\player_traderMenuHive.sqf";
    };
    */
    // trader menu code
    if (DZE_ConfigTrader) then {
        call compile preprocessFileLineNumbers "custom\VASP\player_traderMenuConfig.sqf";
    }else{
        call compile preprocessFileLineNumbers "custom\VASP\player_traderMenuHive.sqf";
    };

 

top part is commented out

and what version of SC are you using? you might need to change some variables if its not SC 2.0

Edited by theduke
Link to comment
Share on other sites

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
  • Advertisement
×
×
  • Create New...