Page MenuHomeFeedback Tracker

Paramsarray defined on server at pre-init, but not on client
Reviewed, WishlistPublic

Description

Paramsarray is defined on the server (local or dedicated) at the point where the function called by cfgfunctions, preinit=1 is run.
However on the client paramsarray has not been defined at this point.

This creates issues when you are trying to get a paramsarray value required during the preinit phase.
In my case, am wanting to define a debug value as assigned by the admin via the paramsarray to allow logging to the rpt.

Details

Legacy ID
4197654891
Severity
None
Resolution
Open
Reproducibility
Always
Category
Scripting
Steps To Reproduce

create a simple mission
define a function via cfgFunctions and assign it as preinit=1

in that function add the code

    diag_log text format["Isnil Paramsarray: %1",isnil "Paramsarray"];

The result is
On local server or dedicated server: FALSE
On a client: TRUE

Event Timeline

Terox edited Steps To Reproduce. (Show Details)Apr 4 2014, 6:07 PM
Terox edited Additional Information. (Show Details)
Terox set Category to Scripting.
Terox set Reproducibility to Always.
Terox set Severity to None.
Terox set Resolution to Open.
Terox set Legacy ID to 4197654891.May 7 2016, 6:21 PM
Bohemia added a subscriber: AD2001.Apr 4 2014, 6:07 PM
Terox added a subscriber: Terox.May 7 2016, 6:21 PM
Terox added a comment.Apr 4 2014, 7:09 PM

this is a bummer then, all that is needed here is to read the config and return the selected value.

When the admin selects a parameter option, while in the unit selection screen, the remote players all see this change, so the data has already been transmitted before any preinit function has been run.

So I see no issue in declaring paramsarray on the clients prior to the preinit stage.

I don't understand why this variable should be assosciated with Publicvariables

paramsArray is not even reserved variable in Arma. My guess it gets publicVariable "paramsArray" on the start, if this is the case then it is understandable why it will not be available in pre-init on clients.

Terox added a comment.Apr 5 2014, 12:14 PM

Hi killzone,

My understanding is that the order of initiation is

  1. Admin selects mission
  2. Description.ext is run
  3. Unit selection gui is loaded
  4. Admins select param options and players slot up
  5. Some B.I.S Magic
  6. Players see newly selected param options
  7. Admin starts mission
  8. cfgFunctions preinit code is run
  9. Mission.sqm is run
  10. Init.sqf is run and any code other code to the point where they halt at any waituntil or sleep commands
  11. Any spawn scripts executed from preinit or init will now run

(So the selected setting is already known by the clients

My point is, that at stage 6, well before preinit is launched the values selected by the admin for the param options have already been sent and received over the network during B.I.S magic at stage 5. This is well before any Publicvariable (As we know it)could be sent. PV's seem to be received a few milliseconds after preinit has finished.

So any argument about this having to be sent by a PV seems sensless.
Why would you need to pv a value that is already available on the remote client anyway and if it is already known, why not make this available for use at preinit.

If B.I do not want to do this then that's their call but assuming that this can only be done as a pv would seem unreasonable based on what I have tried to explain above

I don't know if others see admin selecting params on role selections, i cannot test this, but JIP see default options even if admin changed them, this means paramsArray gets PVed