Get/Save data from cloud

  1. 2 months ago
    Edited 2 months ago by SCAR

    Hi,
    I've tried for the past 3 days but I'm unable to get / set anything from the cloud in and addon that I'm building. Therefore I've started an empty mission with only ALiVE Required, ALiVE Data and this in init.sqf:

    if (isServer) then {
    
    	diag_log text "TEST: initializing";
    
    	waitUntil { ["ALiVE_sys_data"] call ALiVE_fnc_isModuleInitialised };
    
    	diag_log text "TEST: done waiting for alive data";
    	
    	private _aliveKey = "MyTestKey";
    	private _aliveHash = [[["one", 1], ["time", time]], objNull] call CBA_fnc_hashCreate;
    	
    	diag_log text "TEST: get value";
    	private _savedValue = [_aliveKey] call ALiVE_fnc_getData;
    
    	if !(isNil _savedValue) then {
    		diag_log text format["TEST: got value %1", _savedValue];
    	} else {
    		diag_log text "TEST: got NO value";
    	};
    	
    	[_aliveKey, _aliveHash] call ALiVE_fnc_setData;
    	diag_log text format ["TEST: data %1 stored, SAVE & EXIT as admin", _aliveHash]; 
    };

    Started mission, clicked on SERVER SAVE & EXIT (ADMIN ONLY).
    Restarted mission, logs are:

    12:28:32 TEST: done waiting for alive data
    12:28:32 TEST: get value
    12:28:32 Error in expression <ashGet;
    } else {
    _result = "ERROR";
    };
    
    _result;>
    12:28:32   Error position: <_result;>
    12:28:32   Error Undefined variable in expression: _result
    12:28:32 File \x\alive\addons\sys_data\fnc_getData.sqf [ALiVE_fnc_getData], line 1782
    12:28:32 TEST: data ["#CBA_HASH#",["one","time"],[1,0],<NULL-object>] stored, SAVE & EXIT as admin
    12:28:32 Error in expression <ey] call ALiVE_fnc_getData;
    
    if !(isNil _savedValue) then {
    diag_log text format>
    12:28:32   Error position: <_savedValue) then {
    diag_log text format>
    12:28:32   Error Undefined variable in expression: _savedvalue
    12:28:32 File mpmissions\__cur_mp.Altis\init.sqf, line 15
    12:28:32 ALiVE SYS_DATA - ASYNC WRITE LOOP STARTING

    => ERROR

    I can click on SERVER SAVE & EXIT (ADMIN ONLY) but when I restart, same thing.

  2. Edited 2 months ago by SCAR

    So I tried this:

    if (isServer) then {
    
    	diag_log text "TEST: initializing";
    
    	waitUntil { ["ALiVE_sys_data"] call ALiVE_fnc_isModuleInitialised };
    
    	diag_log text "TEST: done waiting for alive data";
    	
    	private _aliveKey = "MyTestKey";
    	private _aliveHash = [[["one", 1], ["time", time]], objNull] call CBA_fnc_hashCreate;
    	
    	diag_log text "TEST: get value";
    	private _savedValue = objNull;
    	if (!isNil { [_aliveKey] call ALiVE_fnc_getData }) then {
    		_savedValue = [_aliveKey] call ALiVE_fnc_getData;
    	};
    		
    	if !(_savedValue isEqualTo objNull) then {
    		diag_log text format["TEST: got value %1", _savedValue];
    	} else {
    		diag_log text "TEST: got NO value";
    	};
    	
    	[_aliveKey, _aliveHash] call ALiVE_fnc_setData;
    	diag_log text format ["TEST: data %1 stored, SAVE & EXIT as admin", _aliveHash]; 
    };

    Started mission, clicked on SERVER SAVE & EXIT (ADMIN ONLY).
    Restarted mission, logs are:

    12:54:05 ALiVE [m_0|30] Module ALiVE_sys_data INIT COMPLETE TIME:  1.92599
    12:54:05 TEST: done waiting for alive data
    12:54:05 TEST: get value
    12:54:05 TEST: got NO value
    12:54:05 TEST: data ["#CBA_HASH#",["one","time"],[1,0],<NULL-object>] stored, SAVE & EXIT as admin
    12:54:05 ALiVE SYS_DATA - ASYNC WRITE LOOP STARTING
    
    ...
    
    12:55:45 ALiVE Extension (ALiVEPlugIn) Error: ['{"error":"not_found","reason":"missing"}
    '] CMD: SendJSON ['GET','sys_spotrep/2RGTIncursori_alive_store_test','']

    => NO VALUE FOUND.

    Now, clicking on SERVER SAVE & EXIT (ADMIN ONLY) does NOT exit the mission. Nothing comes up, nothing happens. I have to click on SERVER EXIT (ADMIN ONLY), that works.

    => CANNOT SAVE ANYMORE.

    Full log: https://pastebin.com/ZsFG5C5W

  3. Edited 2 months ago by SCAR

    From this moment on, SERVER SAVE & EXIT (ADMIN ONLY) stopped working completely. I've tried 3 times and restarted the server.

    Seeing that "not_found" error in the JSON reply, I thought I'd give changing my mission name a try (at this point I'm not sure what else to do...).

    I tried this code:

    if (isServer) then {
    
    	diag_log text "TEST: initializing";
    
    	waitUntil { ["ALiVE_sys_data"] call ALiVE_fnc_isModuleInitialised };
    
    	diag_log text "TEST: done waiting for alive data";
    	
    	private _aliveKey = "MyTestKey";
    	private _aliveHash = [[["one", 1], ["time", time]], objNull] call CBA_fnc_hashCreate;
    	
    	diag_log text "TEST: get value";
    	private _savedValue = objNull;
    	try { _savedValue = [_aliveKey] call ALiVE_fnc_getData; } catch {};
    
    	if !(_savedValue isEqualTo objNull) then {
    		diag_log text format["TEST: got value %1", _savedValue];
    	} else {
    		diag_log text "TEST: got NO value";
    	};
    	
    	[_aliveKey, _aliveHash] call ALiVE_fnc_setData;
    	diag_log text format ["TEST: data %1 stored, SAVE & EXIT as admin", _aliveHash]; 
    };

    Started mission, clicked on SERVER SAVE & EXIT (ADMIN ONLY). This time it worked again.
    Restarted mission, logs are:

    13:16:49 TEST: done waiting for alive data
    13:16:49 TEST: get value
    13:16:49 Error in expression <ashGet;
    } else {
    _result = "ERROR";
    };
    
    _result;>
    13:16:49   Error position: <_result;>
    13:16:49   Error Undefined variable in expression: _result
    13:16:49 File \x\alive\addons\sys_data\fnc_getData.sqf [ALiVE_fnc_getData], line 1782
    13:16:49 TEST: data ["#CBA_HASH#",["one","time"],[1,0],<NULL-object>] stored, SAVE & EXIT as admin

    => ERROR.

    Again, clicking on SERVER SAVE & EXIT (ADMIN ONLY) does NOT exit the mission. Nothing comes up, nothing happens. I have to click on SERVER EXIT (ADMIN ONLY), that works.

    => CANNOT SAVE ANYMORE.

  4. Edited 2 months ago by SCAR

    One last try with code #2, here are the logs:

    1st mission

    13:28:22 ALIVE_SYS_DATA START PLUGIN: ["StartALiVE","OK","Performance Monitor: Disabled"]
    13:28:22 DATA: Attempting to load ALiVE web services config.
    13:28:23 ALiVE-0 CONNECTED TO CLOUD SERVICE AND PERFDATA IS ALLOWED
    13:28:23 DATA: Loading data dictionary dictionary_2RGTIncursori_alive_store_test_2.
    13:28:23 ALiVE Extension (ALiVEPlugIn) Error: ['{"error":"not_found","reason":"missing"}
    '] CMD: SendJSON ['GET','sys_data/dictionary_2RGTIncursori_alive_store_test_2_1','']
    13:28:23 DATA: Loading mission compositions data.
    13:28:24 DATA: Starting AAR system.
    13:28:24 DATA: Waiting for global DISABLED variable...
    13:28:24 DATA: SYS DATA enabled: true
    13:28:24 DATA: Starting stats system.
    13:28:24 "Operation: alive_store_test_2"
    13:28:24 Adding ACE Stats EHs to player <NULL-object>
    13:28:24 ALiVE [m_0|30] Module ALiVE_sys_data INIT COMPLETE TIME:  1.98
    13:28:24 TEST: done waiting for alive data
    13:28:24 TEST: get value
    13:28:24 TEST: got NO value
    13:28:24 TEST: data ["#CBA_HASH#",["one","time"],[1,0],<NULL-object>] stored, SAVE & EXIT as admin
    13:28:24 ALiVE SYS_DATA - ASYNC WRITE LOOP STARTING

    2nd mission

    13:30:53 ALiVE Extension (ALiVEPlugIn) Error: ['StartALiVE','ERROR','ALiVE already initialized'] CMD: StartALiVE ['true']
    13:30:53 ALIVE_SYS_DATA START PLUGIN: SYS_DATA_ERROR
    13:30:53 DATA: Attempting to load ALiVE web services config.
    13:30:53 ALiVE-0 CONNECTED TO CLOUD SERVICE AND PERFDATA IS ALLOWED
    13:30:53 DATA: Loading data dictionary dictionary_2RGTIncursori_alive_store_test_2.
    13:30:54 ALiVE Extension (ALiVEPlugIn) Error: ['{"error":"not_found","reason":"missing"}
    '] CMD: SendJSON ['GET','sys_data/dictionary_2RGTIncursori_alive_store_test_2_1','']
    13:30:54 DATA: Loading mission compositions data.
    13:30:54 DATA: Starting AAR system.
    13:30:54 DATA: Waiting for global DISABLED variable...
    13:30:54 DATA: SYS DATA enabled: true
    13:30:54 DATA: Starting stats system.
    13:30:54 "Operation: alive_store_test_2"
    13:30:54 Adding ACE Stats EHs to player <NULL-object>
    13:30:54 ALiVE [m_0|30] Module ALiVE_sys_data INIT COMPLETE TIME:  1.603
    13:30:54 TEST: done waiting for alive data
    13:30:54 TEST: get value
    13:30:54 TEST: got NO value
    13:30:54 TEST: data ["#CBA_HASH#",["one","time"],[1,0],<NULL-object>] stored, SAVE & EXIT as admin
    13:30:54 ALiVE SYS_DATA - ASYNC WRITE LOOP STARTING

    => NO VALUE FOUND.
    => CANNOT SAVE ANYMORE until I restart the server.

    Full logs here .

  5. Any pointers for me, or do I just have to give up ALiVE persistence and integration...?

    Thank you,
    _SCAR

  6. I'd say just hang on tight. The tail end of the week and especially the weekends tend to be a bit slower with dev activity in these parts. You guys will get there, I'm sure. Keep up the good work and thanks again for doing this!

  7. You can manually check the contents of GVAR(mission_data) (or alive_mission_data). That's what ALiVE_fnc_getData and ALiVE_fnc_setData operate on.

  8. @marceldev89 I can give that a try, not sure what help it would do?

    Unfortunately I've disabled ALiVE support for now. Hopefully we can solve this.

  9. Just interested to see what's in there. Maybe something is off or whatever. :)

  10. Edited 2 months ago by SCAR

    There you go:

    14:25:26 DUMP of alive_mission_data on end any
    14:25:26 Error in expression <UMP of alive_mission_data on start %1", alive_mission_data];
    
    private _aliveKey >
    14:25:26   Error position: <alive_mission_data];
    
    private _aliveKey >
    14:25:26   Error Undefined variable in expression: alive_mission_data

    ...or is it namespaced somewhere in particular?

    BTW re-tried everything again today. First time saving on a NEW mission, it works. Second time, never. Does anyone know eventually an alternative persistent system compatible with ALiVE?

  11. Edited 2 months ago by SCAR

    Can we just have a stupid simple sample mission with NOTHING but a custom variable being read on init of a mission and set on endMission?

    We get things like this all of the time:

    14:43:25 ALiVE Extension (ALiVEPlugIn) Error: ['{"error":"not_found","reason":"missing"}
    '] CMD: SendJSON ['GET','sys_data/dictionary_2RGTIncursori_alive_store_test','']

    Bad configuration? Servers down? Has this anything to do with what I am experiencing?
    Any inputs welcome.

    _SCAR

  12. Friznit

    Sep 29 Administrator

    I can understand your frustration - as said above ALiVE wasn't built with third party integration in mind so you are leading the discovery on this one. With work during the week we are not in a position to provide support at short notice so please be patient and hopefully Tup will get a chance to take a look over the weekend.

    In the meantime, I'd recommend focusing on local persistence, which seems to be working more reliably. It's by far the recommended approach to persisting data and has fewer complexities involved. 90% of the time it will be sufficient for what you are trying to achieve, though I do appreciate you would like to have both in the long term.

  13. Thank you @Friznit. I've decided to build UCM's own persistent module. Will be keeping an eye on this in the future, let me know if you'd like to take this further.

    Best,
    _SCAR

  14. Can I ask if there is a callback when ALiVE saves data? I was using endMission but you have disabled it when running on dedicated servers:
    https://github.com/ALiVEOS/ALiVE.OS/blob/c3f7b268c90403a57b4887093af6455fe49728e1/addons/main/fnc_buttonAbort.sqf#L535

    So I don't know what to listen to...

  15. BIS_fnc_endMission is called on dedicated servers, otherwise the mission wouldn't end. ^^ https://github.com/ALiVEOS/ALiVE.OS/blob/c3f7b268c90403a57b4887093af6455fe49728e1/addons/main/fnc_buttonAbort.sqf#L441

    The case "SAVESERVER" bit seems to be code that's not used anymore.

  16. Edited 2 months ago by SCAR

    It doesn't look like endGame is triggered on a dedicated server when you use SERVER SAVE AND EXIT (Admin Only).

    Anyway, I've hacked into the ALiVE pause interface and added a callback to save UCM too when the SAVE button is clicked, so that I don't need a callback. Also, I've made it clear in the menu that UCM is supported:

    -image-

    This is the best I could do to integrate saves. Hope it's ok with @Tupolov and @Friznit. If it's an issue WHATSOEVER, please let me know and I'll remove the textual reference, no issues. I'll have to keep the save callback to make it work with ALiVE though...

    Code is here .

  17. This is now live.

    Best,
    _SCAR.

  18. Edited 2 months ago by SavageCDN

    Green eggs and spam

 

or Sign Up to reply!