• Listen to a special audio message from Bill Roper to the Hive Workshop community (Bill is a former Vice President of Blizzard Entertainment, Producer, Designer, Musician, Voice Actor) 🔗Click here to hear his message!
  • Read Evilhog's interview with Gregory Alper, the original composer of the music for WarCraft: Orcs & Humans 🔗Click here to read the full interview.

Requesting: A function...

Status
Not open for further replies.
Level 13
Joined
Sep 13, 2010
Messages
550
I need a function which with I can syncronize STRING values between players. I already made for integers and booleans but the template not works for strings... so Players have null or "" value and only one player( example: Player( 1 ) ) has something else. At the end every player has to have the same value as Player( 1 ). I need it in Jass not vJass or anything else. It must work. +Rep will be given.

Still looking for the function! Please help!
 
Last edited:
depending on how many different strings/characters you have to sync you could create a few units of which each has a corresponding string, select them for some player and call SyncSelections()
not sure if this works though
never tried
and it will take some times until everything is synced (probably depends on the ping of all players)


nvm
just use the code below
 
Last edited:
Level 13
Joined
Sep 13, 2010
Messages
550
theres something easier way with game caches. These are the integer and boolean sync functions
JASS:
function ASyncInt takes integer inp returns integer
local gamecache sync = InitGameCache( "null" )
local integer outp
call StoreInteger( sync , "1" , "1" , 0 )
call TriggerSyncStart( )
if inp == 0 then
    call SyncStoredInteger( sync , "1" , "1" )
endif
call TriggerSyncReady( )
if inp != 0 then
    call StoreInteger( sync , "1" , "1" , inp )
endif
call TriggerSyncStart( )
if inp != 0 then
    call SyncStoredInteger( sync , "1" , "1" )
endif
call TriggerSyncReady( )
set outp = GetStoredInteger( sync , "1" , "1" )
return outp
endfunction

function ASyncBool takes boolean inp returns boolean
local gamecache sync = InitGameCache( "null" )
local boolean outp
call StoreBoolean( sync , "1" , "1" , false )
call TriggerSyncStart( )
if not inp then
    call SyncStoredBoolean( sync , "1" , "1" )
endif
call TriggerSyncReady( )
if inp then
    call StoreBoolean( sync , "1" , "1" , inp )
endif
call TriggerSyncStart( )
if inp then
    call SyncStoredBoolean( sync , "1" , "1" )
endif
call TriggerSyncReady( )
set outp = GetStoredBoolean( sync , "1" , "1" )
return outp
endfunction

It is perfect for both integer and real but not for string. Dunno why.
 
Status
Not open for further replies.
Top