For the #2 case, you can encode the whole dialog, ...
# gamedev
o
For the #2 case, you can encode the whole dialog, quest or scripted story in a coroutine mostly linearly (as in Lua article, but easier). Suspend functions you call would mostly be event-style, like
resumeWhenItemInInventory(item)