ES Recruitment Drive
Original Post
exit_freeze event not firing in multiplayer
It fires in free play--I have an echo("exit freeze") there and it works. But in multiplayer fights, it never fires. I want to prevent my mod from changing joints after exit_freeze, since I think that's glitching the game, but I can't because it isn't firing.

Any ideas? Thanks!
It works fine for me. Let's see your source code.

Just for clarification, exit_freeze is called when the turn ends.
[23:23:53] <AndChat|700625> Blue eyes ultimate dragon best card
[23:24:29] <AndChat|700625> You know the one with 3 heads
[23:24:39] <~Lightningkid> just like my dick



[11:35:40] <box> Hampa suck
[11:36:21] <hampa> not the first to tell me that today
Hi box, thanks very much for the reply.

I stripped it down to the bare minimum code and I'm still seeing the problem. I'm running Toribash 4.82 on Steam under Win8.1 64-bit.
(Edit: Entering the version number reminded me that I'd opted into the beta. I went back to the non-beta version (4.91) and the behavior is exactly the same.)

lua code:
-- exitfreezetest.lua

function notifyEvent(event)
add_hook(event, "Notify"..event, function() echo("^07Event ^06"..event.."^07 fired.") end)
end

notifyEvent("enter_freeze")
notifyEvent("exit_freeze")


And here are the results...

In free-play mode:


In multiplayer:
Last edited by dotproduct; Dec 12, 2014 at 12:42 PM.
Upon further inspeciton, I had actually tried the enter_freeze hook instead of exit_freeze. My bad.

There are a few commands that cannot be used in multiplayer. I am not sure if the same applies to hooks. This is the only thing that I can imagine it being. I can ask someone who knows if this is the case, but for now, here is something like a workaround. I don't know if it will particularly work with what you're doing (since I don't know exactly what you're doing) but it does fire at essentially the same time as exit_freeze.

lua code:
function exit_freeze()
if (count ~= 1) then
echo("One frame passed.")
count = 1
end
end

function enter_freeze()
count = 0
echo "Freeze entered."
end

add_hook("enter_frame", "enter_frame", exit_freeze)
add_hook("enter_freeze", "enter_freeze", enter_freeze)


EDIT: Apparently, this doesn't work on the first turn. Again, I don't know exactly what you're trying to do, but if you need it fired on the first turn as well, the match_begin hook should do the trick.
Last edited by box; Dec 12, 2014 at 06:17 PM.
[23:23:53] <AndChat|700625> Blue eyes ultimate dragon best card
[23:24:29] <AndChat|700625> You know the one with 3 heads
[23:24:39] <~Lightningkid> just like my dick



[11:35:40] <box> Hampa suck
[11:36:21] <hampa> not the first to tell me that today
Thanks again! What I'm trying to accomplish is this: I'm making a script that helps me control my guy, with buttons to set joint states, because sometimes it's hard to click on the joint I want in the 3D view. The problem is, if I click the button after the timer runs out, then it still changes the joint state on my screen, but according to the server it's not changed, and that messes stuff up. So I want to detect when I should no longer be able to control my guy.

I've been using enter_frame and that's helped, but it is still happening occasionally. Either I haven't coded it right, or something else is also causing desyncs.
Is this what you're looking for?
[23:23:53] <AndChat|700625> Blue eyes ultimate dragon best card
[23:24:29] <AndChat|700625> You know the one with 3 heads
[23:24:39] <~Lightningkid> just like my dick



[11:35:40] <box> Hampa suck
[11:36:21] <hampa> not the first to tell me that today
Originally Posted by box View Post
Is this what you're looking for?

It's similar to my script, but I think that one's intended to use keypresses and mine uses mouse clicks. Anyway, that one has the same problem mine does: you can change joint states at any time, and if it's at a time you shouldn't be able to, bad things happen.

My next attempt will be checking get_world_state().turn_timelimit and running my own timer starting at match_begin or enter_freeze.

Thanks as always for the help.

Edit: Actually, that's how I should have done it from the start. It's all about the timer--after the timer runs out, it can be a little while due to network latency or whatever before things start animating, and presumably exit_freeze would fire. I think this way will work.
Last edited by dotproduct; Dec 13, 2014 at 12:58 AM.
Good point. I am glad that you found a solution.
[23:23:53] <AndChat|700625> Blue eyes ultimate dragon best card
[23:24:29] <AndChat|700625> You know the one with 3 heads
[23:24:39] <~Lightningkid> just like my dick



[11:35:40] <box> Hampa suck
[11:36:21] <hampa> not the first to tell me that today