| 12-15-2007, 07:39 AM | #1 |
To anyone that was using the older version of the replay detect function, there were issues with it. When it was first posted on this site, the returning boolean for the function was unsynchronised which means when used will almost inevitably cause a desync. As a way to prevent this I synchronised the variable using gamecache and sync natives. Although this solved the multiplayer problem it seemed it also synchronised the boolean with replays which means it always returned true (even in replays). The function has been completely recoded, a lot of silly uneeded stuff was removed (the 2 sync functions have been removed and the globals) and I have just tested it and it works prefectly as intended Here is the updated function JASS://-> IsInGame created by PandaMine with help from Captain Griffen function IsInGame takes nothing returns boolean local integer counter = 1 local real camerax local real cameray local real x local real y local boolean output loop exitwhen counter > 12 if GetLocalPlayer() == Player(counter-1) then set camerax = GetCameraTargetPositionX() set cameray = GetCameraTargetPositionY() endif set counter = counter + 1 endloop set counter = 1 call PauseGame(true) call TriggerSleepAction(0) loop exitwhen counter > 12 if GetLocalPlayer() == Player(counter-1) then call SetCameraPosition(camerax + 1,cameray + 1) endif set counter = counter + 1 endloop call TriggerSleepAction(0) call PauseGame(false) set counter = 1 loop exitwhen counter > 12 if GetLocalPlayer() == Player(counter-1) then set x = GetCameraTargetPositionX() if x == camerax + 1 then set output = true else set output = false endif call SetCameraPosition(camerax,cameray) endif set counter = counter + 1 endloop return output endfunction With the new change to the function, it no longer needs to be synchronised however you should still initialize it like this because it has been reported that selecting units + triggersleepaction can cause desyncs JASS:function Initiate takes nothing returns nothing call EnableUserControl(false) call TriggerSleepAction(.0) set udg_InGame = IsInGame() call EnableUserControl(true) endfunction |
| 12-15-2007, 08:36 AM | #2 |
Well I see you are becoming a synchronization expert, might need your services one day. |
| 12-15-2007, 09:04 AM | #3 | |
Quote:
I am the synchotron baby ![]() |
| 12-15-2007, 09:53 AM | #4 |
the best sync method is abil typing =). ofc not custom one (using JAPI or something else) |
