Lucky44 13 Posted March 9, 2012 I've been very happy using the diag_log command to export info from the game to an external file (namely, the arma2oa.rpt file). But I was frustrated to learn that it's not working on a dedicated server, but it is working for local players (i.e., saving onto their local machines). My hunch is that I'm calling it in a limiting way, preventing it from being logged onto the server. Here's how I'm going about it: I have a static object placed on the map (a Barracks building, at the moment). In its INIT box I have this code: 0 = [this] execVM "STS\tracker_addAction.sqf"; and the tracker_addAction.sqf has this in it: private ["_reporter"]; _reporter = _this select 0; _reporter addAction ["Send supply record to file","sts\OutputToFile.sqf"]; and the OutputToFile.sqf has this in it: diag_log format ["LingorLibre: DateStamp: %1",date]; diag_log format ["LingorLibre: FuelBarrels added =%1, timestamp = %2",FuelBarrels,time]; diag_log format ["LingorLibre: MedSupplies adeded =%1, timestamp = %2",MedSupplies,time]; diag_log format ["LingorLibre: BagFences added =%1, timestamp = %2",BagFences,time]; diag_log format ["LingorLibre: BigHeskos added =%1, timestamp = %2",BigHeskos,time]; diag_log format ["LingorLibre: SmHeskos added =%1, timestamp = %2",SmHeskos,time]; diag_log format ["LingorLibre: StaticMGs added =%1, timestamp = %2",StaticMGs,time]; diag_log format ["LingorLibre: CashPiles added =%1, timestamp = %2",CashPiles,time]; diag_log format ["LingorLibre: RepairCrates added =%1, timestamp = %2",RepairCrates,time]; diag_log "-------------------------------------"; diag_log "-------------------------------------"; //This section gets loadout for each player recorded///////////////////////////////////////////// _allPlayers = playableUnits; _WepArray = []; _mags = []; _playerName = ""; { _WepArray = weapons _x; _playerName = name _x; _mags = magazines _x; diag_log format ["LingorLibre: Player= %1, Loadout= %2, Mags = %3, Timestamp =%4",_playerName,_WepArray,_mags,time]; sleep 1; }foreach _allPlayers; diag_log "======================================"; diag_log "======================================"; ////////////////////////////////////////////////////////////////////////////////////////////////// //This section counts vehicles in players' possession (i.e., at their base) at mission end//////// _vehList = nearestObjects [shed3, ["Car","Tank"], 100]; { //hint format ["Vehicle = %1",_x]; // DEBUGGING ONLY !!!!!!!!!!!!! //sleep 2; // DEBUGGING ONLY !!!!!!!!!!!!! diag_log format ["LingorLibre: Player Vehicle = %1",_x]; sleep 0.1; }foreach _vehList; diag_log "++++++++++++++++++++++++++++++++++++++"; diag_log "++++++++++++++++++++++++++++++++++++++"; ////////////////////////////////////////////////////////////////////////////////////////////////// //This section counts ammo crates at players' base at mission end///////////////// _CrateList = nearestObjects [shed3, ["ReAmmoBox","ReAmmoBox_EP1"], 100]; { diag_log format ["LingorLibre: AmmoStuff = %1",_x]; sleep 0.1; }foreach _CrateList; diag_log "@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@"; diag_log "@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@"; What am I doing wrong? Is there a limitation to diag_log that I don't know about? Thanks in advance for any help! Share this post Link to post Share on other sites
.kju 3245 Posted March 9, 2012 the code called by the useraction is run only on the client. you need to send the data over network. check: http://community.bistudio.com/wiki/publicVariable http://community.bistudio.com/wiki/addPublicVariableEventHandler http://community.bistudio.com/wiki/Locality_in_Multiplayer Share this post Link to post Share on other sites
Lucky44 13 Posted March 10, 2012 Thanks for taking the time to reply, PvPscene. I have a decent understanding of PVs, MPEHs, and locality. I just hadn't thought that through that an action on an object would only remain local, even for the diag_log command. Is there a way to force it to go to the (dedicated) server? Or should I just collect the info locally, since I'll be participating in the missions anyway? Would my local client have the same info? Would all local clients? I'd think so. Share this post Link to post Share on other sites
engima 328 Posted March 12, 2012 (edited) The addAction command is local, but since you start the tracker_addAction.sqf it in the object's init line, it will run and add the action on all clients (and server), so all players can execute it. However, if a player on a client executes that action, the OutputToFile.sqf will only run on the current client machine. One fix is to make the OutputToFile.sqf run an all clients (or only on server) by setting a global variable and publicVariable it for the server. Assume you reference script PlayAction.sqf in addAction command (and "abc" is your initials). Like this: PlayAction.sqf abc_var_ActionPlayed = true; publicVariable "abc_var_ActionPlayed"; Then you can have a trigger with the variable as condition, that executes on all machines. In this trigger, start the OutputToFile.sqf when a player executed the action. All diag_logs here will now be written in .rtf on all machines (since script will run on all machines). abc_var_ActionPlayed If you only want to execute script on server (and only write to server's .rpt file): isServer && abc_var_ActionPlayed Edited March 12, 2012 by Engima Share this post Link to post Share on other sites
Lucky44 13 Posted March 12, 2012 Thanks, Engima. I will take a look at that approach. (As soon as I digest it!) Share this post Link to post Share on other sites