Jump to content
ins3821

variable working to strange. Help me.

Recommended Posts

variable working to strange.

when I try test, "IF" not find variable(Armed_car, APC).
but another variable(Car, Air, Ship, Autonomous, heli, AH, po etc) is very good finded. so i very confuse.

is anyone familiar with this problem?

 

Quote

resualt

Car, Air, Ship, Armored, Autonomous, Support, Heli, bigsusong, AH, po, CAS = passed

APC, Armed_car = no passed

private["_filter","_ret","_vehicleList"];
_filter = [_this,0,"",[""]] call BIS_fnc_param;
systemChat format["%1",_filter]; //test     <<------------------- good find here but
if(_filter == "") exitWith {[]}; //can't find here.  <<------------------- here cant find

//Setup our array.
_ret = [];

_vehicleList = switch(_filter) do
{
	case "All": {(VVS_pre_Car + VVS_pre_Air + VVS_pre_Ship + VVS_pre_Armored + VVS_pre_Support + VVS_pre_Autonomous + VVS_pre_Heli + VVS_pre_bigsusong + VVS_pre_AH + VVS_pre_po + VVS_pre_Cas + VVS_pre_armed_car + VVS_pre_APC)};
	case "Car": {VVS_pre_Car};
	case "Armed_car": {VVS_pre_armed_car};
	case "APC": {VVS_pre_APC};
	case "Air": {VVS_pre_Air};
	case "Ship": {VVS_pre_Ship};
	case "Armored": {VVS_pre_Armored};
	case "Autonomous": {VVS_pre_Autonomous};
	case "Support": {VVS_pre_Support};
	case "Heli": {VVS_pre_Heli};
	case "bigsusong": {VVS_pre_bigsusong};
	case "AH": {VVS_pre_AH};
	case "po": {VVS_pre_po};
	case "Cas": {VVS_pre_Cas};
	default {[]};
};

 

Share this post


Link to post
Share on other sites

The question is: What kind of data you are passing as _filter?

What are your variables VVS_pre_APC or VVS_pre_armed_car?

What did you expect with:
if(_filter == "") exitWith {[]}; //can't find here. <<------------------- here cant find ??

  • Like 1

Share this post


Link to post
Share on other sites
58 minutes ago, pierremgi said:

The question is: What kind of data you are passing as _filter?

What are your variables VVS_pre_APC or VVS_pre_armed_car?

What did you expect with:
if(_filter == "") exitWith {[]}; //can't find here. <<------------------- here cant find ??

Q - What kind of data you are passing as _filter?
_filter is recive string from server.

ex)
VVS_fnc_openVVS

private["_filter","_ret","_vehicleList"];
_filter = [_this,0,"",[""]] call BIS_fnc_param;
systemChat format["%1",_filter]; //test     <<------------------- good find here but
if(_filter == "") exitWith {[]}; //can't find here.  <<------------------- here cant find

//Setup our array.
_ret = [];

_vehicleList = switch(_filter) do
{
	case "All": {(VVS_pre_Car + VVS_pre_Air + VVS_pre_Ship + VVS_pre_Armored + VVS_pre_Support + VVS_pre_Autonomous + VVS_pre_Heli + VVS_pre_bigsusong + VVS_pre_AH + VVS_pre_po + VVS_pre_Cas + VVS_pre_armed_car + VVS_pre_APC)};
	case "Car": {VVS_pre_Car};
	case "Armed_car": {VVS_pre_armed_car};
	case "APC": {VVS_pre_APC};
	case "Air": {VVS_pre_Air};
	case "Ship": {VVS_pre_Ship};
	case "Armored": {VVS_pre_Armored};
	case "Autonomous": {VVS_pre_Autonomous};
	case "Support": {VVS_pre_Support};
	case "Heli": {VVS_pre_Heli};
	case "bigsusong": {VVS_pre_bigsusong};
	case "AH": {VVS_pre_AH};
	case "po": {VVS_pre_po};
	case "Cas": {VVS_pre_Cas};
	default {[]};
};

this addaction["spawn APC",VVS_fnc_openVVS, ["spawnlocation","APC"]]; 
and _filter = "APC".
test code(systemChat) recive "APC", but if(_filter == "") exitWith {[]}; recive noting. so that's code is exitwith.



Q - What are your variables VVS_pre_APC or VVS_pre_armed_car?
just classname.



Q - What did you expect with
if(_filter == "") exitWith {[]}; //can't find here. <<------------------- here cant find ??

_filter recived "APC" then switch code execute.

Share this post


Link to post
Share on other sites

code "systemChat" receives variables, but code "if(_filter == "") exitWith {[]};" does not receive variables. this is the point.

Share this post


Link to post
Share on other sites
43 minutes ago, ins3821 said:

code "systemChat" receives variables, but code "if(_filter == "") exitWith {[]};" does not receive variables. this is the point.


If you see something output by systemchat, then the "if(_filter == "") exitWith {[]};" will be skipped, always.  The systemchat confirms if _filter has a value, while the exitWith line only activates if _filter is empty.

If this is working in some cases and not others, like if it prints "APC" but doesn't do anything else, it's because VVS_pre_APC doesn't work right.

 

  • Like 1

Share this post


Link to post
Share on other sites
6 minutes ago, dwringer said:


If you see something output by systemchat, then the "if(_filter == "") exitWith {[]};" will be skipped, always.  The systemchat confirms if _filter has a value, while the exitWith line only activates if _filter is empty.

If this is working in some cases and not others, like if it prints "APC" but doesn't do anything else, it's because VVS_pre_APC doesn't work right.

 

do output by systemChat, but doesnt skip the "if(_filter == "") exitWith {[]};" code.
so i confuse.

Share this post


Link to post
Share on other sites

what I'm doing now is adding APC, Armed_car. It worked well when I did this before.

Share this post


Link to post
Share on other sites
8 minutes ago, ins3821 said:

do output by systemChat, but doesnt skip the "if(_filter == "") exitWith {[]};" code.
so i confuse.

 

If the systemChat outputs anything at all, that means _filter is provably not empty.  That means there is absolutely no way that "if(_filter == "") exitWith {[]};" isn't skipped.  _filter is provably not equal to "", and since it's private we know it couldn't have changed.

 

I guarantee if it printed something from the systemChat, it does skip the "if(_filter == "") exitWith {[]};" code.

 

I can't see what the issue is because I don't know what the rest of your code looks like.

  • Like 2

Share this post


Link to post
Share on other sites

I solved the problem. Thank you for your interest.
Thank you so much for your hard work despite my terrible English.

I wrote the wrong code because of some mistakes.

  • Like 1

Share this post


Link to post
Share on other sites

Please sign in to comment

You will be able to leave a comment after signing in



Sign In Now

×