I put it in a preload event:
- Code: Select all • Expand
[event]
name=preload
first_time_only=no
[lua]
code=<<
local _ = wesnoth.textdomain "wesnoth-Bad_Moon_Rising"
local old_unit_status = wesnoth.theme_items.unit_status
function wesnoth.theme_items.unit_status()
local u = wesnoth.get_displayed_unit()
if not u then return {} end
local s = old_unit_status()
if u.status.freezing then
table.insert(s, { "element", {
image = "misc/icy.png",
tooltip = _"freezing: This unit will die if it stays in frost terrain."
} })
end
return s
end
>>
[/lua]
[set_variable]
name=bmr_lua_tooltip
value=fired
[/set_variable]
[/event]
It did work, a few times. Mostly, it doesn't - it just doesn't show up. I have no idea why it worked when it did, I used the same WML and same save-file, and got different results.
I'm attaching what I think is the relevant WML(EDIT:no need, see below), but the nickel summary is: All the other status handling does work, the intended effects happen, so this isn't a vanilla WML problem, I don't think. I put that [set_variable] "bmr_lua_tooltip" thing in the preload event so that I could check if the event fired with :inspect, but I never see it (I also haven't gotten the status icon to show up since then).
Does a variable set in preload just get thrown out? Does it mean the event isn't firing (which would explain things)? When does preload event fire? At the moment, I do not believe what the wiki says.
I'm using 1.9.9, linux, source, if that matters
---------------------------------
EDIT: not long after posting, I figured it out (isn't that the way it goes...) Reloading the cache with F5 causes the preload event to not fire. If I kill wesnoth and restart, the event fires -> the variable is visible in :inspect, the status icon shows up. If I go back to title screen, press F5, then load the same save-file, and go through the same motions, the status icon and "bmr_lua_tooltip" variable are MIA. Re-loading the save-file has no effect.
I'll visit the bug tracker...
