Jump to content
Sign in to follow this  
Taurus

call compile doesn't work!

Recommended Posts

<table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE">

_clientarry = []

call compile ("_clientarry =" + MyArry)

it works with string names that reference global variables so I expect it to work for the names too.

Declaring the local variable right before the code allows it to work. Global variables should be predefined too in the init.

Unfortunately not.

Having this at server:

<table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE"><for loop here which uses _i = _i + 1>{

_newGuy = <code to create unit here>;

_array set [_i,_newGuy];

};

MyArry = _array;

publicVariable "MyArry";//Defined naturally in the init;)

And this at the client:

<table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE">_clientArry = [];

call compile ("_clientArry =" + MyArry);

Returns this very error:

|#| West 1-1-B:1 ... missing ]

When trying to name a unit

West 1-1-B:1

In the editor, you get

Invalid variable name!

And in its init

West 1-1-B:1 = this;

Error: West 1-1-B:1 missing ;

Even with

"West 1-1-B:1" = this;

Returns error: West 1-1-B:1 missing ;

So confused_o.gif

Share this post


Link to post
Share on other sites

Make the arry like your doing....

then

<table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE">

MyArrystring = format ["%1",Myarry]

PublicVariable "MyArryString"

then do the other thing allready shown. I thought this was working fine but I guess well have to see.

Share this post


Link to post
Share on other sites

Heya Please try this:

<table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE">

_array = [];

<for loop here which uses _i = _i + 1>{

_newGuy = <code to create unit here>;

_tmpName = format["this setVehicleVarName 'Wz%1'",_i]; //Will be Wz0 and etc

_newGuy setVehicleInit _tmpName;

_array set [_i,_newGuy];

};

processInitCommands;

sleep 1; // <--- try with and without, I am uncertain if the names of the units are changed in time

myArray = format["%1",_array]; //this is a global variable

publicVariable "myArray";

hint myArray;

And reply back what you read at the hint aswell. thanks

I usually use this method btw:

<table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE">_clientArry = [];

_clientArry = call compile MyArray;

BTW, do you still need all the above only for a join command? As that should work even when executed from server or any client afaik.

Share this post


Link to post
Share on other sites
Heya Please try this:

<table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE">

_array = [];

<for loop here which uses _i = _i + 1>{

_newGuy = <code to create unit here>;

_tmpName = format["this setVehicleVarName 'Wz%1'",_i]; //Will be Wz0 and etc

_newGuy setVehicleInit _tmpName;

_array set [_i,_newGuy];

};

processInitCommands;

sleep 1; // <--- try with and without, I am uncertain if the names of the units are changed in time

myArray = format["%1",_array]; //this is a global variable

publicVariable "myArray";

hint myArray;

And reply back what you read at the hint aswell. thanks

I usually use this method btw:

<table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE">_clientArry = [];

_clientArry = call compile MyArray;

BTW, do you still need all the above only for a join command? As that should work even when executed from server or any client afaik.

Hint returns: Wz0,Wz1,Wz2

As my sideChats returned, the line after "publicVar" was an sideChat which I posted wink_o.gif

I don't know what I did wrong before, but now, the array join playerGroup, with running almost the same code(just re-named some variables and stuff around it)

<span style='font-size:17pt;line-height:100%'>WORKS!</span>

Successfully got my 3 guys from a script executed by the dedicated server yay.gif

Perhaps this too was a benefit from upgrading to 1.08.

I was too winded up with getting the compile array thing to work that I "forgot" to test the array join playerGroup thing again.

If theres such a thing as Arma editing/scripting fatigue I'm suffering from it, I should get some rest.

But I want to be finished sometime soon too, but I don't need to preach about that to an already addicted crowd smile_o.gif

I'll calculate the time used on trial and error when I'm finished, then I need to get drunk to forget all about it! biggrin_o.gif

Thanks for all the help and patience ! smile_o.gif

I think I'm ready for now, I put the compile array thingy aside as I dont' need it.

Share this post


Link to post
Share on other sites

Check this out.....

I use a list of prepared string names to create markers on the client.

Markernames = [0,"Marker1","Marker2","Marker3"]

This helps me reference the markers in other scripts on the client....

Worked well for my purposes.

But when I wanted the server to get those marker positions, I didnt even try to reference those string names as

a) they were created on client so Im assumin the server is clueless to their presence

and

b) Ive learned not to assume nuttins easy in this area.

So I passed those getmarkerpos arrays into strings (with format %1) and then put the strings into an array and THEN made the array into a string and publicVared that monster and it worked great. This is how I get my map click placed markers referenced on the server.

I havent tried yet but I probably dont need to get the markerpos arrays into strings since the whole array is made into a string. But its working so Im loathe to change it.

Back on the server, I run two layers of call compile to extract the marker position arrays into local vars and then create logics at those positions as normal.

Phew.

So its crazy and probably can be optimized a bit.

What kind of lag would a string with 4 getmarkerpos arrays in them induce in a medium crowded MP game? Should I expect the worst or is this not an issue with current HW?

Share this post


Link to post
Share on other sites
Check this out.....

I use a list of prepared string names to create markers on the client.

Markernames = [0,"Marker1","Marker2","Marker3"]

This helps me reference the markers in other scripts on the client....

Worked well for my purposes.

Ok thumbs-up.gif

Hmm, you put the names into the "name" element of when creating the markers too?

My issue was that I crated my troops runtime and tried to put their little object called WEST 1-1-B:1 into an array and publicVariable and decompile it on the client.

Not even setVariableEtc blabla worked so...

And there's where I stopped, because the [serverArray] join player worked smile_o.gif

But when I wanted the server to get those marker positions, I didnt even try to reference those string names as

a) they were created on client so Im assumin the server is clueless to their presence

Hm, to be confusing you some more, markers are indeed global, and should therefor be sent over the network.

Check this out, and look at the small icons atop.

createMarker

I missed it wink_o.gif

Now I can not assure these markers to be "getPosed" on the server, but they "should"

[edit inner]

not to mention that it say

Quote[/b] ]createMarker is global, use createMarkerLocal if you want to create a marker locally
biggrin_o.gif

[/edit inner]

AHA!? crazy_o.gif

And thats also why they(BIS) have the "name" element on creation, as they need to be unique.

On clients stuff can have the same variable name referring to different objects, until someone of them, or the server "publicVariable"(or setVehicleblabla) one of them.

b) Ive learned not to assume nuttins easy in this area.

Nope, nothing is biggrin_o.gif

....So I passed those getmarkerpos arrays into strings (with format %1) and then put the strings into an array and THEN made the array into a string and publicVared that monster and it worked great. This is how I get my map click placed markers referenced on the server.

I havent tried yet but I probably dont need to get the markerpos arrays into strings since the whole array is made into a string. But its working so Im loathe to change it.

Back on the server, I run two layers of call compile to extract the marker position arrays into local vars and then create logics at those positions as normal.

Phew.

So its crazy and probably can be optimized a bit.

Phew indeed, thats something!

What kind of lag would a string with 4 getmarkerpos arrays in them induce in a medium crowded MP game? Should I expect the worst or is this not an issue with current HW?

It wouldn't create any lag TBH.

Share this post


Link to post
Share on other sites

I reference the string on the array when creating the marker by making a _markername variable that selects the string by a number given to it from above in the script.

_lzname = _Markers select _counter

or something like that.

then that local variable will act as a string name when you create the marker. The reason for doing this initially was to have six sets of markers available for six airlifts. So in MP you call it and you get LZ_1 you know you have the first Airlift out of the six.

But this globalnes of Markers thing is interesting because the server should be able to be pointed to that string name and then access the markerpos directly which may junk a bit of my work as obsolete but at least the concept was proven to work.

So I may just try to de-string my position arrays first because that is much less scripting to do at this point.

I assume Game logics "everywhere" in the same way? If not they should be.

So, (deep breath) Publicvar of a reference to a Marker string name from the client could be sent to the server where the server gets Markers select _pubvarnumber into a local variable and done...

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
Sign in to follow this  

×