KaidenSmith 1 Posted May 18, 2019 How would I go on about making it so if you try to subtract in an edit field the dialog would close. Or the dialog would close when you pressed the button that would execute the number changing. I have attempted saying if (_valuable < 0) exitWith {}; Share this post Link to post Share on other sites
stanhope 411 Posted May 18, 2019 The scripting subform is probably better but regardless you're going to need to share more of your code for us to be able to help you. Share this post Link to post Share on other sites
KaidenSmith 1 Posted May 18, 2019 It is a menu where you can sell certain items you find or buy. This would be the part of the dialog that is used in this case: class sellEdit : RscEdit { idc = 2405; text = "1"; sizeEx = 0.030; x = 0.554166 * safezoneW + safezoneX; y = 0.60537 * safezoneH + safezoneY; w = 0.069375 * safezoneW; h = 0.0235185 * safezoneH; }; class ButtonRemoveG : RscButtonSilent { idc = -1; text = "$STR_VS_SellItem"; colorBackground[] = {"(profilenamespace getvariable ['GUI_BCG_RGB_R',0.3843])", "(profilenamespace getvariable ['GUI_BCG_RGB_G',0.7019])", "(profilenamespace getvariable ['GUI_BCG_RGB_B',0.8862])", 0.5}; onButtonClick = "[] call item_sell"; x = 0.531979 * safezoneW + safezoneX; y = 0.641148 * safezoneH + safezoneY; w = 0.0803125 * safezoneW; h = 0.0272222 * safezoneH; }; I am trying to make it so the dialog closes or something like that if you put a negative number in the RscEdit box. Cause as of right now when you put a "-" in, the item will duplicate. Share this post Link to post Share on other sites
stanhope 411 Posted May 18, 2019 And what's in item_sell? Share this post Link to post Share on other sites
KaidenSmith 1 Posted May 18, 2019 8 minutes ago, stanhope said: And what's in item_sell? private["_type","_index","_price","_var","_amount","_name"]; if((lbCurSel 2402) == -1) exitWith {}; _type = lbData[2402,(lbCurSel 2402)]; _index = [_type,sell_array] call TON_fnc_index; if(_index == -1) exitWith {}; _var = [_type,0] call life_fnc_varHandle; _amount = ctrlText 2405; if(!([_amount] call TON_fnc_isnumber)) exitWith {hint localize "STR_Shop_Virt_NoNum";}; _amount = parseNumber (_amount); _amount = parseNumber true; if(_amount > (missionNameSpace getVariable _var)) exitWith {hint localize "STR_Shop_Virt_NotEnough"}; if ((time - life_action_delay) < 0.2) exitWith {hint localize "STR_NOTF_ActionDelay";}; life_action_delay = time; _price = (_price * _amount); _name = [_var] call life_fnc_vartostr; if(([false,_type,_amount] call life_fnc_handleInv)) then { hint format[localize "STR_Shop_Virt_SellItem",_amount,_name,[_price] call life_fnc_numberText]; [format["%1 (%2) sold %3 %4 for $%5.", profileName, getPlayerUID player, _amount, _name, [_price] call life_fnc_numberText], "MoneyLog"] remoteExecCall["A3Log", 2]; SaCpTBF = SaCpTBF + _price; DYNAMICMARKET_boughtItems pushBack [_type,_amount]; [] call life_fnc_virt_update; [] spawn SOCK_fnc_updateRequest; }; [0] call SOCK_fnc_updatePartial; [3] call SOCK_fnc_updatePartial; My temp fix is to use _amount = parseNumber true; Makes it so you only sell 1 item per click no matter what. Share this post Link to post Share on other sites
stanhope 411 Posted May 18, 2019 Well can't you just do if (_amount < 0) exitWith {}; right under where you parse _amount to a number? Share this post Link to post Share on other sites
pierremgi 4905 Posted May 18, 2019 _amount = _amount max 0 Every negative value will be treated as 0. 1 Share this post Link to post Share on other sites
KaidenSmith 1 Posted May 18, 2019 9 hours ago, stanhope said: Well can't you just do if (_amount < 0) exitWith {}; right under where you parse _amount to a number? Tried it and it doesn't work. Share this post Link to post Share on other sites
KaidenSmith 1 Posted May 18, 2019 7 hours ago, pierremgi said: _amount = _amount max 0 Every negative value will be treated as 0. Ty, worked perfectly! Share this post Link to post Share on other sites