Coroutines once again?

If you have a module that you'd like comments on or would like to know how to create your very own module, post here

Moderator: Moderator

Post Reply
Message
Author
yufra
Perspiring Physicist
Posts: 1332
Joined: Tue Jul 13, 2010 2:53 pm

Coroutines once again?

#1 Post 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.
<DarkGod> lets say it's intended

darkgod
Master of Eyal
Posts: 10750
Joined: Wed Jul 24, 2002 9:26 pm
Location: Angolwen
Contact:

Re: Coroutines once again?

#2 Post 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
[tome] joylove: You can't just release an expansion like one would release a Kraken XD
--
[tome] phantomfrettchen: your ability not to tease anyone is simply stunning ;)

yufra
Perspiring Physicist
Posts: 1332
Joined: Tue Jul 13, 2010 2:53 pm

Re: Coroutines once again?

#3 Post by yufra »

Exactly what I was looking for, thanks!
<DarkGod> lets say it's intended

Post Reply