Hello all!
I've recently started using Solarus and have been loosely following the tutorials. But when I get to the "ask if the player wants to save" part (chapter 5 in the french tut of the Wiki), I get a problem... the question doesn't return anything. Also the 2nd question is skipped, but I think the cause is the same
(I noticed because it didn't save. Also I need to press space once more after selecting the answer to get to the next step and unpause).
Here's the code I use:
in the game_manager
in dialogs.dat
and I get these errors (first one is because dialog_box.lua is needed but empty at this point of the tutorial)
As far as I can tell it looks exactly as it should... What am I doing wrong?
I've recently started using Solarus and have been loosely following the tutorials. But when I get to the "ask if the player wants to save" part (chapter 5 in the french tut of the Wiki), I get a problem... the question doesn't return anything. Also the 2nd question is skipped, but I think the cause is the same
(I noticed because it didn't save. Also I need to press space once more after selecting the answer to get to the next step and unpause).
Here's the code I use:
in the game_manager
Code Select
game.on_started = function()
game.dialog_box = dialog_box_builder:create(game)
sol.menu:start(game,game.dialog_box)
end
game.on_paused = function()
game:start_dialog("pause_menu", function(answer) -- DOES NOT RETURN ANYTHING. answer == nil
if answer == 1 then
game:save()
end
game:start_dialog("answer_"..answer) -- testing
game:start_dialog("pause_menu_2", function(answer) -- DOES NOT RETURN ANYTHING. answer == nil
if answer == 1 then
sol.main.reset()
end
game:start_dialog("answer_"..answer) -- testing
end)
end)
in dialogs.dat
Code Select
dialog{
id = "pause_menu",
question = true,
text = [[
Sauvegarder la partie ?
Oui
Non
]]
}
-- pause_menu_2
dialog{
id = "pause_menu_2",
question = true,
text = [[
Quitter le jeu?
Oui
Non
]]
}
--answer was 1
dialog{
id = "answer_1",
text = [[
you answered: 1
]]
}
and I get these errors (first one is because dialog_box.lua is needed but empty at this point of the tutorial)
Code Select
Error: In on_started: [string "scripts/game_manager.lua"]:18: attempt to index upvalue 'dialog_box_builder' (a boolean value)
Error: In dialog callback: [string "scripts/game_manager.lua"]:28: attempt to concatenate local 'answer' (a nil value)
As far as I can tell it looks exactly as it should... What am I doing wrong?