• 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.

[JASS] Save informations in a replay

Status
Not open for further replies.
Level 1
Joined
Jul 1, 2012
Messages
5
Hello,

i have found out, that its possible, to save information in a replay with the syncStoredInteger function (for example save the winner of a game)

I googled, that i should be able to create 0x 6b -Bytes with this command and than be able to parse the replay with them.

Now i have tryed it. I created a trigger with the following action, but there will no 0x 6b bytes be in the replay:

JASS:
local gamecache g = InitGameCache("Map.w3v")
    call StoreInteger(g, "Map", "winner", 1)
    call TriggerSyncStart()
    call SyncStoredInteger(g, "Map", "Host")
    call TriggerSyncReady()
    call FlushGameCache(g)
    set g = null

Can somebody help me?
 
Level 1
Joined
Jul 1, 2012
Messages
5
Nobody there who knows this?

I would also pay for a working example.
Its realy important for a big project.

Ty guys.
 
Level 5
Joined
Jun 16, 2004
Messages
108
First, why is it that you store something in "Map","winner" and then try to sync on "Map","Host" ? You should be syncing for stuff you have stored values for.

Syncing an integer should put a 0x6B action in the replay, but it might not be working because you are trying to sync a value you do not even have stored.

Here is a replay loaded up in Replay Explorer (by Strilanc) which does some syncing while I am alone in a game: http://puu.sh/F1YF
And one packet with several sync actions in it loaded up in a more detailed view: http://puu.sh/F1Zp
Notice the format of a sync action, which looks something like... 0x6B [STRING: gamecache name] 0x00 [STRING: mission key] 0x00 [STRING: key] 0x00 [32 BIT INTEGER: synced value]
 
Level 1
Joined
Jul 1, 2012
Messages
5
Hello,

thank you for your answer.

I have changed the Code:
JASS:
function Trig_Untitled_Trigger_001_Actions takes nothing returns nothing

local gamecache g = InitGameCache("Map.w3v")
call StoreInteger(g, "Map", "winner", 1)
call TriggerSyncStart()
call SyncStoredInteger(g, "Map", "winner")
call TriggerSyncReady()
call FlushGameCache(g)
set g = null

call DisplayTextToForce( GetPlayersAll(),"Tried to store info")

endfunction

The function is called by a chat-event.
I get the Output from DisplayText.., so im sure the function is called.
But if i look in the replay with a hex editor, there is no 00 6b :/

I have attached the map.
 

Attachments

  • test_sync.w3x
    16.7 KB · Views: 58
Level 5
Joined
Jun 16, 2004
Messages
108
Get rid of the TriggerSyncStart and TriggerSyncReady calls. They are not very useful functions to begin with, and you especially do not need them if you are just trying to store data in the replay. Besides, I get the impression that they probably are causing your trigger to fail when you are alone (which is how I assume you are testing it).
 
Level 1
Joined
Jul 1, 2012
Messages
5
Thank you for your fast reply :thumbs_up:
I have changed the code again and removed the named parts.

JASS:
  local gamecache g = InitGameCache("Map.w3v")
  call StoreInteger(g, "Map", "winner", 2) 
  call SyncStoredInteger(g, "Map", "winner")
  call FlushGameCache(g)
  set g = null
  call DisplayTextToForce( GetPlayersAll(),"Tried to store info")

But no 0x6b to find in the reply :(
 
Level 5
Joined
Jun 16, 2004
Messages
108
I am pretty sure it is working now, I tested that code before replying previously.

Are you aware that actions are not stored in their plain format in the replay? I believe the replay is compressed and/or encoded. Simply throwing the replay into a hex editor will not work in that case. You will need to look into the replay format somewhere. It should not be too much trouble, I believe GHost++ has to deal with replay formats, and Replay Explorer might provide its source, and there are probably posts online detailing replays.

Try Replay Explorer by Strilanc (http://www.wc3c.net/showthread.php?p=1120344) to check your replay for what Replay Explorer calls the "GameCacheSyncInteger" action (http://puu.sh/F4NG).

On another note, the TriggerSyncStart / TriggerSyncReady calls probably did not stop your code from sending the integer sync, but they did stop Replay Explorer from parsing the full replay properly, so I had to remove them to verify that the sync was going through. I stand by the claim that they are not useful and not necessary in this case, though.
 
Level 1
Joined
Jul 1, 2012
Messages
5
You are my hero of the (last 4) day(s)!

i've tried it so many hours and never detected the 0x6b in my hex editor..

U are right it will not be displayed there but it is there :)
Ty so mutch.
 
Status
Not open for further replies.
Top