Better narration processing
This commit is contained in:
@@ -655,3 +655,54 @@ setup_handler(function(event, trigger_entity, what_entity)
|
||||
--]]
|
||||
end
|
||||
end)
|
||||
|
||||
--[[
|
||||
active_dialogues = {}
|
||||
setup_action_handler("talk", function(town, index, word)
|
||||
local ret = ""
|
||||
local choices = {}
|
||||
local have_choice = false
|
||||
local have_paragraph = false
|
||||
local book = narrator.parse_file('stories.talk')
|
||||
local story = narrator.init_story(book)
|
||||
if story == nil then
|
||||
crash()
|
||||
end
|
||||
story:begin()
|
||||
narrate("Boo!!!!")
|
||||
if story.can_continue() then
|
||||
local paragraph = story:continue(1)
|
||||
print(dump(paragraph))
|
||||
if story:can_choose() then
|
||||
have_choice = true
|
||||
local ch = story:get_choices()
|
||||
for i, choice in ipairs(ch) do
|
||||
table.insert(choices, choice.text)
|
||||
print(i, dump(choice))
|
||||
end
|
||||
if #choices == 1 and choices[1] == "Ascend" then
|
||||
story:choose(1)
|
||||
choices = {}
|
||||
end
|
||||
if #choices == 1 and choices[1] == "Continue" then
|
||||
this.story:choose(1)
|
||||
choices = {}
|
||||
end
|
||||
end
|
||||
end
|
||||
if (#choices > 0) then
|
||||
print("choices!!!")
|
||||
narrate(ret, choices)
|
||||
else
|
||||
narrate(ret)
|
||||
end
|
||||
if not have_choice and not have_paragraph then
|
||||
-- complete
|
||||
crash()
|
||||
else
|
||||
print("can continue")
|
||||
end
|
||||
|
||||
end)
|
||||
]]--
|
||||
|
||||
|
||||
6
lua-scripts/stories/talk.ink
Normal file
6
lua-scripts/stories/talk.ink
Normal file
@@ -0,0 +1,6 @@
|
||||
Dialogue...
|
||||
Whatever...
|
||||
* [Ascend]
|
||||
~ crash()
|
||||
- ->END
|
||||
|
||||
Reference in New Issue
Block a user