[vJASS] Syncing Data

I just want to check if I'm doing this right. I want to store real values in local code and then sync it to all players:

JASS:
        if p = GetLocalPlayer() then
            // do stuff
            call StoreReal(gcSM, k, I2S(GetPlayerId(p)), value)
            call SyncStoredReal(gcSM, k, I2S(GetPlayerId(p)))
            // do more stuff
        endif

Is it really this simple?
edit: seems to be working in a quick lan test

edit: can data from any player be synced at any time from anywhere? or does it need to be synced within the respective player's local code?

i.e. can I do something like this?
JASS:
function storestuff takes player p, real value returns nothing
        if p = GetLocalPlayer() then
            call StoreReal(gcSM, k, I2S(GetPlayerId(p)), value)
        endif
endfunction

function loadstuff takes player p returns real
        call SyncStoredReal(gcSM, k, I2S(GetPlayerId(p)))
        return GetStoredReal(gcSM, k, I2S(GetPlayerId(p)))
endfunction

joining lan games for my test map is constantly failing so it's hard for me to test this :(
 
Last edited:
Top