Page 1 of 1

Coroutines once again?

Posted: Tue Mar 12, 2013 10:05 pm
by yufra
Alright DG (and others), I am back to a problem that I am fairly certain requires coroutines. The situation is similar to how Game targeting is handled, where a specific portion of code is paused while you do something. In this case it is a dialog (through Game:registerDialog) that I want to wait until it completes. Any ideas? Alternatively I can switch to something a bit more like GameTargeting where I click on regions of the screen to select cards to discard. Cheers.

Re: Coroutines once again?

Posted: Wed Mar 13, 2013 11:15 am
by darkgod
When do you run it?
If this is in a talent (which suonds like it) then it already runs in a coroutine so you can do as I do in some dialog-talents already.

For example check out the Ward talent in tome in talents/misc/objects.lua, it uses a Chat but taht's the same.
Basically you pause the current coroutine and tell the dialog to start it back when it's unloaded

Re: Coroutines once again?

Posted: Thu Mar 14, 2013 2:42 pm
by yufra
Exactly what I was looking for, thanks!