- Joined
- Jul 10, 2007
- Messages
- 6,306
So this syncing script doesn't work. It stores the name of the local player in the game cache, then tries to sync player 1 up with the rest. The local player name is still displayed (sync fails).
My goal should be obvious from the above ^_^. My problem is that the player name displayed is still that of the local player, not that of player 1.
The first player to respond is obviously player 1... so I don't get why it doesn't sync
.
JASS:
struct tester extends array
public static constant integer SYNC_PLAYER = 1
public static string data
public static integer file
public static gamecache syncer
public static player sync
public static string pid
private static method test takes nothing returns nothing
set tester.syncer = InitGameCache("hello")
set tester.sync = Player(tester.SYNC_PLAYER)
set tester.pid = I2S(GetPlayerId(tester.sync))
set tester.data = GetPlayerName(GetLocalPlayer())
//set file = FileOpen("test", false)
//call FileWrite(file, data)
//call FileClose(file)
if GetLocalPlayer()==tester.sync then
call StoreString(tester.syncer, "data", tester.pid, tester.data)
endif
call TriggerSyncStart()
if GetLocalPlayer()==tester.sync then
call SyncStoredString(tester.syncer, "data", tester.pid)
endif
call TriggerSyncReady()
set tester.data = GetStoredString(tester.syncer,"data",tester.pid)
call DisplayTextToPlayer(GetLocalPlayer(), 0, 0, tester.data)
endmethod
private static method onInit takes nothing returns nothing
call TimerStart(CreateTimer(), 0, false, function thistype.test)
endmethod
endstruct
My goal should be obvious from the above ^_^. My problem is that the player name displayed is still that of the local player, not that of player 1.
The first player to respond is obviously player 1... so I don't get why it doesn't sync