I tested this in 3.91 beta2:
- unfreeze_game does nothing if the game was not frozen with freeze_game
- is_game_frozen normaly returns 0 when called within the exit_freeze hook
- if unfreeze_game was used after the next call of step_game or pressing space, the is_game_frozen function returns 1
This is just an example I observed other oddities in the new_game hooks and leave_game as well.
I attached a event_log script which I created to implement custom events.
You can use it for buggy state testing as well.
It writes log entries of this format:
00021 enter_frame - {{p=0,mf=0,r=0,tto=-1,f=0,np=2,tf=1,gt=0,win=-1},{f=1,tf=0},{f=1}}
00000 - match_unfrozen
Where the first number is the number of frame ticks since the last event followed by the hook name.
Then comes a table consisting of 3 tables. The first is the current state, the second is the state change since the last event and the third holds custom state vars which are carried from one state to the other (not of interest until you want to implement custom events yourself).
For the first two tables the vars mean:
p - game paused
mf - match frame, where 0 means 0, 1 means greater 0 and less then indicated by the rules, 2 means equal or bigger then set in the rules
r - replay mode, can be 0, 1 or 2 (for the demo mode)
tto - turn timeout, where 0 means 0, 1 means greater than frame_tick, -1 means less then frame_tick
f - is_game_frozen
np - number of players
tf - turn frame, where 0 means 0, 2 means greater than indicated by the rules, 1 else
gt - game type, 0 for single, 1 for multi
win - winner, where -1 means no winner set, 1 means there is a winner or draw
The second line shows a configured custom event.
Just for completeness:
You can configure the custem events by editing the event_map table within the script file.
You will notice that there the same state table format is used as outputed by the script, so you can use copy and paste to map a custom event to a hook and state. If there a variable is missing it means "don't care about it". You can add a fourth table to the state there, the vars within will become part of the third table in the next event.
If you manage to create a config that triggers all custom 'game_..', 'match_..' and 'replay_..' events at the right time and don't misses one post it.
I never made it because of the oddities.
So happy testing!
Last edited by DeFransen; Jan 26, 2011 at 11:38 PM.
Reason: Forgot Attachment