[1.3] Bug SubMenu

Started by Yruama, November 20, 2014, 01:32:27 AM

Previous topic - Next topic
Hi,

It's me again ...  :-[

Now i want to create a menu for the items. I Dowload your package : https://www.youtube.com/watch?v=oh6I4yLUQ3E&index=28&list=PLzJ4jb-Y0ufySXw9_E-hJzmzSh-PYCyG2
I modified the file "Game_Manager" like you, but when i start the gamehttp://forum.solarus-games.org/Themes/default/images/bbc/table.gif and i press "D" i have some error :

Error: In on_started: [string "scripts/menus/pause_submenu.lua"]:19: attempt to call field 'get_dialog_font' (a nil value)
Error: In on_draw: [string "scripts/menus/pause_submenu.lua"]:96: attempt to index field 'caption_text_2' (a nil value)


Before doing that, I 've changed a line (in Pause Menu Line 78) :

   local line1, line2 = text:match("([^$]+)\$(.*)") to    local line1, line2 = text:match("([^$]+)$(.*)")

Hi!
Sorry about these outdated tutorials. I have started to make new ones with latest versions, but it takes time :)

Quote from: Yruama on November 20, 2014, 01:32:27 AM
Before doing that, I 've changed a line (in Pause Menu Line 78) :

   local line1, line2 = text:match("([^$]+)\$(.*)") to    local line1, line2 = text:match("([^$]+)$(.*)")
The correct line is
    local line1, line2 = text:match("([^$]+)%$(.*)")
The goal here is to escape the $ character in the pattern. In Lua, the escape character in patterns is % and not \. (In worked before by luck because vanilla Lua allows \ too even if it is incorrect. LuaJIT does not.)

Anyway, that should fix your second error (field 'caption_text_2' being nil).

Quote from: Yruama on November 20, 2014, 01:32:27 AM
Error: In on_started: [string "scripts/menus/pause_submenu.lua"]:19: attempt to call field 'get_dialog_font' (a nil value)


In the resources to download with the tutorial, main.lua defines two new functions sol.language.get_dialog_font() and sol.language.get_menu_font(). You probably forgot to copy them.

Oh i love you :D.

I try to find a solution in yout game, but it's ... hard. You have more files than in your tutorial :D