OFPEC Forum
Editors Depot - Mission Editing and Scripting => ArmA - Editing/Scripting Multiplayer => Topic started by: laggy on 13 Feb 2009, 19:35:37
-
Hi this is my problem.
The problem is present even in SP, but the script needs to work in MP, therefore posted here.
I have an eventhandler that works. I have tested it with triggers. It is the "receiving" script that fails or the transfer of the array in the eventhandler.
End of lines in eventhandler:
_searcherside = getNumber (configFile >> "CfgVehicles" >> typeOf _x >> "side");
call compile format ["LAGGY_BodySide%1 = true", _deadguyside];
call compile format ["LAGGY_FinderSide%1 = true", _searcherside];
LAGGY_BodyAndFinderCombo = [format ["LAGGY_BodySide%1,LAGGY_FinderSide%2", _deadguyside,_searcherside]];
publicVariable "LAGGY_BodyAndFinderCombo";
According to my testing with triggers it works, but the following "receiving" script doesn't:
if (LAGGY_BodySide0 in LAGGY_BodyAndFinderCombo AND LAGGY_FinderSide0 in LAGGY_BodyAndFinderCombo) then
{
hint "An OPFOR body was found by OPFOR";
};
This last script has multiples of the same lines checking for different combinations, but I thought that would be unnecessary to show, since the lines have the same structure.
The problem is that I never get the hints from the receiving script, so the mistake should be in one of the above examples. My variables are either transferred wrong or received wrong.
IMPORTANT NOTE: I get NO error messages.
If my solution is all messed up, my wish is to send two variables in a "package" or array from the eventhandler.
I then want the recieving script to read the COMBINATION of the variables that come in that "package".
Laggy
-
LAGGY_BodyAndFinderCombo = [format ["LAGGY_BodySide%1,LAGGY_FinderSide%2", _deadguyside,_searcherside]];
... becomes something like ...
LAGGY_BodyAndFinderCombo = ["LAGGY_BodySide0,LAGGY_FinderSide0"];
-
Thanks a lot for the quick reply,
What does that mean exactly?
Is the problem the " (quotation marks) in the "format broadcast"?
Or was it a question?
If so, yes the variables can be :
LAGGY_BodySide0
LAGGY_FinderSide0
Or do you see another problem?
I have messed with this for days and would be really grateful for some advice.
Laggy
-
Take a closer look at it:
LAGGY_BodyAndFinderCombo becomes an array with one element: a single string. But you expect the array to have two elements: two variables.
Try this:
LAGGY_BodyAndFinderCombo = call compile format ["[LAGGY_BodySide%1,LAGGY_FinderSide%2]",_deadguyside,_searcherside];
-
AHHH,
Thanks, I'll try this out, and see what can be done.
Laggy
EDIT:
Seems to work really well. Because of all the possible combinations, I'll have to return on this subject.
Thanks a lot and a lot so far.
Laggy