Replace uses of the moved interface functions
This commit is contained in:
parent
bfa7e918e4
commit
f145dc2bba
13 changed files with 28 additions and 28 deletions
|
@ -5,7 +5,7 @@ return {
|
|||
init = function(ai)
|
||||
|
||||
if (not wesnoth.game_config.debug) then
|
||||
wesnoth.message("LuaAI Error", "The LuaAI debug library is only available in debug mode")
|
||||
wesnoth.interface.add_chat_message("LuaAI Error", "The LuaAI debug library is only available in debug mode")
|
||||
return
|
||||
end
|
||||
|
||||
|
|
|
@ -3,13 +3,13 @@
|
|||
local example_ca = {}
|
||||
|
||||
function example_ca:evaluation()
|
||||
wesnoth.message("External CA evaluation says hi.")
|
||||
wesnoth.interface.add_chat_message("External CA evaluation says hi.")
|
||||
|
||||
return 10000
|
||||
end
|
||||
|
||||
function example_ca:execution()
|
||||
wesnoth.message("External CA execution attacks.")
|
||||
wesnoth.interface.add_chat_message("External CA execution attacks.")
|
||||
|
||||
-- Note that there is no check whether these attacks are possible.
|
||||
-- The CA will therefore be blacklisted the second time it gets called.
|
||||
|
|
|
@ -114,31 +114,31 @@ local my_ai = { }
|
|||
|
||||
|
||||
function my_ai:stage_hello()
|
||||
wesnoth.message('Lua AI stage says hello.')
|
||||
wesnoth.interface.add_chat_message('Lua AI stage says hello.')
|
||||
std_print('Lua AI stage says hello.')
|
||||
end
|
||||
|
||||
function my_ai:candidate_action_evaluation_hello()
|
||||
wesnoth.message('Hello from candidate action evaluation!')
|
||||
wesnoth.interface.add_chat_message('Hello from candidate action evaluation!')
|
||||
std_print('Hello from candidate action evaluation!')
|
||||
|
||||
return 42
|
||||
end
|
||||
|
||||
function my_ai:candidate_action_execution_hello(cfg)
|
||||
wesnoth.message('Hello from candidate action execution!')
|
||||
wesnoth.interface.add_chat_message('Hello from candidate action execution!')
|
||||
std_print('Hello from candidate action execution!')
|
||||
end
|
||||
|
||||
function my_ai:candidate_action_evaluation_hello2()
|
||||
wesnoth.message('Hello from second candidate action evaluation!')
|
||||
wesnoth.interface.add_chat_message('Hello from second candidate action evaluation!')
|
||||
std_print('Hello from second candidate action evaluation!')
|
||||
|
||||
return 99
|
||||
end
|
||||
|
||||
function my_ai:candidate_action_execution_hello2()
|
||||
wesnoth.message('Hello from second candidate action execution!')
|
||||
wesnoth.interface.add_chat_message('Hello from second candidate action execution!')
|
||||
std_print('Hello from second candidate action execution!')
|
||||
|
||||
self:do_moves()
|
||||
|
|
|
@ -74,7 +74,7 @@ function enemy.do_commander(cfg, group_id, loc)
|
|||
return
|
||||
end
|
||||
local scenario = wc2_scenario.scenario_num()
|
||||
--wesnoth.message("do_commander", wml.variables[("wc2_enemy_army.group[%d].allies_available"):format(group_id)])
|
||||
--wesnoth.interface.add_chat_message("do_commander", wml.variables[("wc2_enemy_army.group[%d].allies_available"):format(group_id)])
|
||||
local ally_i = wc2_utils.pick_random(("wc2_enemy_army.group[%d].allies_available"):format(group_id)) - 1
|
||||
local leader_index = mathx.random(wml.variables[("wc2_enemy_army.group[%d].leader.length"):format(ally_i)]) - 1
|
||||
local new_recruits = wml.variables[("wc2_enemy_army.group[%d].leader[%d].recruit"):format(ally_i, leader_index)]
|
||||
|
|
|
@ -255,7 +255,7 @@ function wc2_era.expand_hero_types(types_str)
|
|||
table.insert(types_new, type)
|
||||
end
|
||||
else
|
||||
wesnoth.message("WCII ERROR", "unknown deserter group: '" .. v .. "'")
|
||||
wesnoth.interface.add_chat_message("WCII ERROR", "unknown deserter group: '" .. v .. "'")
|
||||
end
|
||||
end
|
||||
types = types_new
|
||||
|
|
|
@ -113,7 +113,7 @@ function wesnoth.effects.wc2_update_aura(u, cfg)
|
|||
local forcefield = wesnoth.units.matches(u, { ability = "forcefield" } )
|
||||
local halo = ""
|
||||
if illuminates and darkens then
|
||||
wesnoth.message("WC2", "Warning illuminates and darkens discovered on a unit")
|
||||
wesnoth.interface.add_chat_message("WC2", "Warning illuminates and darkens discovered on a unit")
|
||||
end
|
||||
if forcefield and illuminates then
|
||||
halo = "halo/illuminates-aura.png~R(50)"
|
||||
|
|
|
@ -21,7 +21,7 @@ function mathx.random_choice(possible_values, random_func)
|
|||
local high = tonumber(word:sub(dots_end+1))
|
||||
-- perhaps someone passed a string as part of the range, intercept the issue
|
||||
if not (low and high) then
|
||||
wesnoth.message("Malformed range: " .. word)
|
||||
wesnoth.interface.add_chat_message("Malformed range: " .. word)
|
||||
table.insert(items, word)
|
||||
num_choices = num_choices + 1
|
||||
else
|
||||
|
|
|
@ -65,7 +65,7 @@ function wml_actions.chat(cfg)
|
|||
|
||||
for index, side in ipairs(side_list) do
|
||||
if side.controller == "human" and side.is_local then
|
||||
wesnoth.message(speaker, message)
|
||||
wesnoth.interface.add_chat_message(speaker, message)
|
||||
break
|
||||
end
|
||||
end
|
||||
|
@ -83,7 +83,7 @@ function wml_actions.chat(cfg)
|
|||
end
|
||||
|
||||
if not has_human_side then
|
||||
wesnoth.message(speaker, message)
|
||||
wesnoth.interface.add_chat_message(speaker, message)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
@ -651,11 +651,11 @@ function wml_actions.allow_undo(cfg)
|
|||
end
|
||||
|
||||
function wml_actions.allow_end_turn(cfg)
|
||||
wesnoth.allow_end_turn(true)
|
||||
wesnoth.interface.allow_end_turn(true)
|
||||
end
|
||||
|
||||
function wml_actions.disallow_end_turn(cfg)
|
||||
wesnoth.allow_end_turn(cfg.reason or false)
|
||||
wesnoth.interface.allow_end_turn(cfg.reason or false)
|
||||
end
|
||||
|
||||
function wml_actions.clear_menu_item(cfg)
|
||||
|
@ -720,7 +720,7 @@ function wml_actions.color_adjust(cfg)
|
|||
end
|
||||
|
||||
function wml_actions.end_turn(cfg)
|
||||
wesnoth.end_turn()
|
||||
wesnoth.interface.end_turn()
|
||||
end
|
||||
|
||||
function wml_actions.event(cfg)
|
||||
|
|
|
@ -3,7 +3,7 @@ local already_ended = false
|
|||
function wesnoth.wml_actions.endlevel(cfg)
|
||||
local parsed = wml.parsed(cfg)
|
||||
if already_ended then
|
||||
wesnoth.message("Repeated [endlevel] execution, ignoring")
|
||||
wesnoth.interface.add_chat_message("Repeated [endlevel] execution, ignoring")
|
||||
return
|
||||
end
|
||||
already_ended = true
|
||||
|
|
|
@ -93,7 +93,7 @@ function wesnoth.wml_actions.find_path(cfg)
|
|||
if current_location == nil then
|
||||
-- either no matching locations, or only inaccessible matching locations (maybe enemy units are there)
|
||||
if #locations == 0 then
|
||||
wesnoth.message("WML warning","[find_path]'s filter didn't match any location")
|
||||
wesnoth.interface.add_chat_message("WML warning","[find_path]'s filter didn't match any location")
|
||||
end
|
||||
wml.variables[tostring(variable)] = { hexes = 0 } -- set only hexes, nil all other values
|
||||
else
|
||||
|
|
|
@ -14,7 +14,7 @@ function wesnoth.wml_actions.micro_ai(cfg)
|
|||
if (not cfg.ai_type) then wml.error("[micro_ai] is missing required ai_type= key") end
|
||||
if (not cfg.side) then wml.error("[micro_ai] is missing required side= key") end
|
||||
if (not wesnoth.sides[cfg.side]) then
|
||||
wesnoth.message("Warning", "[micro_ai] uses side=" .. cfg.side .. ": side does not exist")
|
||||
wesnoth.interface.add_chat_message("Warning", "[micro_ai] uses side=" .. cfg.side .. ": side does not exist")
|
||||
return
|
||||
end
|
||||
if (not cfg.action) then wml.error("[micro_ai] is missing required action= key") end
|
||||
|
|
|
@ -87,7 +87,7 @@ local function generate_objectives(cfg)
|
|||
.. color_prefix(r, g, b) .. objective_bullet.. description
|
||||
.. turn_counter .. "</span>" .. "\n"
|
||||
else
|
||||
wesnoth.message "Unknown condition, ignoring."
|
||||
wesnoth.interface.add_chat_message "Unknown condition, ignoring."
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
|
@ -1444,7 +1444,7 @@ end
|
|||
function wml_actions.check_substitution(t)
|
||||
wml.variables["substitution_variable"] = 1
|
||||
if t.value ~= "Number 2" then
|
||||
wesnoth.message("Substitution is not delayed! " .. tostring(t.value))
|
||||
wesnoth.interface.add_chat_message("Substitution is not delayed! " .. tostring(t.value))
|
||||
end
|
||||
end
|
||||
local function get_child(cfg, name)
|
||||
|
@ -1739,7 +1739,7 @@ My best advancement costs $next_cost gold and I’m $experience|% there."
|
|||
#
|
||||
# local code = {}
|
||||
# function code.main()
|
||||
# wesnoth.message("hello world")
|
||||
# wesnoth.interface.add_chat_message("hello world")
|
||||
# end
|
||||
# return code
|
||||
#
|
||||
|
@ -1753,10 +1753,10 @@ My best advancement costs $next_cost gold and I’m $experience|% there."
|
|||
if type(code) == "table" and type(code.main) == "function" then
|
||||
code.main()
|
||||
else
|
||||
wesnoth.message(codeFile.." must return a table with a 'main' function.")
|
||||
wesnoth.interface.add_chat_message(codeFile.." must return a table with a 'main' function.")
|
||||
end
|
||||
else
|
||||
wesnoth.message("To use this command, create a file 'data/lua/code.lua' in the wesnoth source directory that returns a table with a 'main' function.")
|
||||
wesnoth.interface.add_chat_message("To use this command, create a file 'data/lua/code.lua' in the wesnoth source directory that returns a table with a 'main' function.")
|
||||
end
|
||||
>>
|
||||
[/lua]
|
||||
|
@ -2577,7 +2577,7 @@ Also, 0..9 = $below_ten, one,two,three = $ascii and the bonus answer is $mixed."
|
|||
# On 800x480 a scrollbar should appear.
|
||||
code = <<
|
||||
local ec = wesnoth.current.event_context
|
||||
wesnoth.message(string.format("Unit moved from %d,%d to %d,%d", ec.x2, ec.y2, ec.x1, ec.y1))
|
||||
wesnoth.interface.add_chat_message(string.format("Unit moved from %d,%d to %d,%d", ec.x2, ec.y2, ec.x1, ec.y1))
|
||||
local result = gui.get_user_choice(
|
||||
{ speaker = "unit", message = "Pick your poison" },
|
||||
{ "&items/potion-red.png=Something red=Take a sip and enjoy",
|
||||
|
@ -2587,7 +2587,7 @@ Also, 0..9 = $below_ten, one,two,three = $ascii and the bonus answer is $mixed."
|
|||
"&items/holy-water.png=Oh nice bottle=Feel the divinity",
|
||||
-- Should have an empty first column and a second column on two lines.
|
||||
"=Well a nice and black drink.\nToo dark too see?=Take a sip and pass the bottle along" })
|
||||
wesnoth.message(string.format("User selected choice %d.", result))
|
||||
wesnoth.interface.add_chat_message(string.format("User selected choice %d.", result))
|
||||
>>
|
||||
[/lua]
|
||||
#wmlindent: stop ignoring
|
||||
|
@ -3392,7 +3392,7 @@ For game purposes, the races group into factions; for example, orcs often cooper
|
|||
local ul = wesnoth.units.find_on_recall()
|
||||
local t = {}
|
||||
for i,u in ipairs(ul) do table.insert(t, u.type) end
|
||||
wesnoth.message(string.format("Recall list: %s", table.concat(t, ',')))
|
||||
wesnoth.interface.add_chat_message(string.format("Recall list: %s", table.concat(t, ',')))
|
||||
>>
|
||||
[/lua]
|
||||
[/event]
|
||||
|
|
Loading…
Add table
Reference in a new issue