-
Notifications
You must be signed in to change notification settings - Fork 12
/
debug.lua
30 lines (25 loc) · 859 Bytes
/
debug.lua
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
--
-- Script for debugging in VSCode with
-- Local Lua Debugger by Tom Blind (https://github.com/tomblind/local-lua-debugger-vscode)
-- Dependencies
local narrator = require('narrator.narrator')
local bot = require('bot')
-- Loading
-- local book = require('stories.debug')
-- local book = narrator.parseBook('Hello world!', { '=== one === \n text 1', '=== two === \n text 2' })
local book = narrator.parse_file('stories.debug', { save = false })
local story = narrator.init_story(book)
local answers = { }
-- Choice instructor for a bot
local function instructor(choices, step)
local answer = answers[step]
if answer == nil then
math.randomseed(os.time() * 10000000)
answer = math.random(1, #choices)
end
return answer
end
-- Game
print('--- Game started ---\n')
bot.play(story, instructor, { print = true })
print('\n--- Game over ---')