Trying out these dialog boxes
Moderator: Forum Moderators
Trying out these dialog boxes
Hello everyone. I'm trying to use the dialog building stuff. I'm trying to turn a series of [message]s with [option]s into one dialog with two lists and a set of sliders (much more user friendly).
Here's what I have so far:
It gives me the following error which doesn't really tell me much:
I'm guessing that I'm using toggle_panel improperly, but I'm not really sure about the proper way. The documentation kind of sucks.
Any help would be appreciated.
Also, I note that the error contains my exact structure in a WML-like way. Is it possible for me to build this dialog using [set_variables] and then feed the dialog to lua with wesnoth.get_variable()? WML is much more comfortable to me than the mess I have.
Here's what I have so far:
Code: Select all
[lua]
code = <<
local helper = wesnoth.require "lua/helper.lua"
local T = helper.set_wml_tag_metatable {}
local _ = wesnoth.textdomain "wesnoth"
local dialog = {
T.tooltip { id = "tooltip_large" },
T.helptip { id = "tooltip_large" },
T.grid {
T.row { --Main row
T.column { T.grid { -- Seasons column
T.row { T.column { T.label { label = _ "Enable Seasons?" }}},
T.row { T.column { T.toggel_panel { T.grid {
T.row { -- Yes
T.column { T.image { id = "misc/blank-hex.png~BLIT(terrain/grass/green.png~RC(000000>red)~SCALE(36,36),0,0)~BLIT(terrain/grass/dry.png~RC(000000>blue)~SCALE(36,36),0,36)~BLIT(terrain/frozen/snow.png~RC(000000>green)~SCALE(36,36),27,18)~SCALE(36,36)" }},
T.column { T.label { label = _ "Yes" }}
},
T.row { -- No
T.column { T.image { id = "terrain/grass/green.png~SCALE(36,36)" }},
T.column { T.label { label = _ "No" }}
}
}}}}
}},
T.column { T.grid { -- Bonuses column
}},
T.column { T.grid { -- Rules column
}}
}
}
}
local function preshow()
end
local function postshow()
end
local r = wesnoth.show_dialog(dialog, preshow, postshow)
>>
[/lua]
Code: Select all
[toggel_panel]
[grid]
[row]
[column]
[image]
id = misc/blank-hex.png~BLIT(terrain/grass/green.png~RC(000000>red)~SCALE(36,36),0,0)~BLIT(terrain/grass/dry.png~RC(000000>blue)~SCALE(36,36),0,36)~BLIT(terrain/frozen/snow.png~RC(000000>green)~SCALE(36,36),27,18)~SCALE(36,36)
[/image]
[/column]
[column]
[label]
label = Yes
[/label]
[/column]
[/row]
[row]
[column]
[image]
id = terrain/grass/green.png~SCALE(36,36)
[/image]
[/column]
[column]
[label]
label = No
[/label]
[/column]
[/row]
[/grid]
[/toggel_panel]
src/gui/auxiliary/window_builder.cpp:119 ASSSERTION FAILED: 0
Trace/breakpoint trap
Any help would be appreciated.
Also, I note that the error contains my exact structure in a WML-like way. Is it possible for me to build this dialog using [set_variables] and then feed the dialog to lua with wesnoth.get_variable()? WML is much more comfortable to me than the mess I have.
Re: Trying out these dialog boxes
toggel != toggle?
-
- Inactive Developer
- Posts: 2461
- Joined: August 15th, 2008, 8:46 pm
- Location: Germany
Re: Trying out these dialog boxes
Should work well. However, it has the disadvantage that you cannot change the dialog definition and test the change without the end scenario + mainscreen F5 + restart procedure. But you could for instance put the dialog definition into an own file, preprocessor-file-include that file into [set_variables] and load that variable from lua.Gambit wrote:Also, I note that the error contains my exact structure in a WML-like way. Is it possible for me to build this dialog using [set_variables] and then feed the dialog to lua with wesnoth.get_variable()? WML is much more comfortable to me than the mess I have.
projects (BfW 1.12):
A Simple Campaign: campaign draft for wml starters • Plan Your Advancements: mp mod
The Earth's Gut: sp campaign • Settlers of Wesnoth: mp scenario • Wesnoth Lua Pack: lua tags and utils
updated to 1.8 and handed over: A Gryphon's Tale: sp campaign
A Simple Campaign: campaign draft for wml starters • Plan Your Advancements: mp mod
The Earth's Gut: sp campaign • Settlers of Wesnoth: mp scenario • Wesnoth Lua Pack: lua tags and utils
updated to 1.8 and handed over: A Gryphon's Tale: sp campaign
Re: Trying out these dialog boxes
GAH!Max wrote:toggel != toggle?
Thanks.