Explain ctrl-key combos in tutorial
When tutorializing a command that uses a ^X notation, show Ctrl-X instead. Also show an explanation of the ^X nearby. The only ctrl-key combination that can currently happen in the tutorial, without rebinding keys, is the kick-command. Fixes #1327
This commit is contained in:
@@ -1,4 +1,31 @@
|
||||
|
||||
local tut_ctrl_key = nil;
|
||||
local tut_alt_key = nil;
|
||||
|
||||
function tut_key(command)
|
||||
local s = nh.eckey(command);
|
||||
local m = s:match("^^([A-Z])$"); -- ^X is Ctrl-X
|
||||
if (m ~= nil) then
|
||||
tut_ctrl_key = m;
|
||||
return "Ctrl-" .. m;
|
||||
end
|
||||
|
||||
m = s:match("^M-([A-Z])$"); -- M-X is Alt-X
|
||||
if (m ~= nil) then
|
||||
tut_alt_key = m;
|
||||
return "Alt-" .. m;
|
||||
end
|
||||
|
||||
return s;
|
||||
end
|
||||
|
||||
function tut_key_help(x, y)
|
||||
if (tut_ctrl_key ~= nil) then
|
||||
des.engraving({ coord = { x,y }, type = "engrave", text = "Note: Outside the tutorial, Ctrl-key combinations are shown prefixed with a caret, like '^" .. tut_ctrl_key .. "'", degrade = false });
|
||||
tut_ctrl_key = nil;
|
||||
end
|
||||
end
|
||||
|
||||
des.level_init({ style = "solidfill", fg = " " });
|
||||
des.level_flags("mazelevel", "noflip",
|
||||
"nomongen", "nodeathdrops", "noautosearch");
|
||||
@@ -40,15 +67,15 @@ nh.parse_config("OPTIONS=mention_walls");
|
||||
nh.parse_config("OPTIONS=mention_decor");
|
||||
nh.parse_config("OPTIONS=lit_corridor");
|
||||
|
||||
local movekeys = nh.eckey("movewest") .. " " ..
|
||||
nh.eckey("movesouth") .. " " ..
|
||||
nh.eckey("movenorth") .. " " ..
|
||||
nh.eckey("moveeast");
|
||||
local movekeys = tut_key("movewest") .. " " ..
|
||||
tut_key("movesouth") .. " " ..
|
||||
tut_key("movenorth") .. " " ..
|
||||
tut_key("moveeast");
|
||||
|
||||
local diagmovekeys = nh.eckey("movesouthwest") .. " " ..
|
||||
nh.eckey("movenortheast") .. " " ..
|
||||
nh.eckey("movesoutheast") .. " " ..
|
||||
nh.eckey("movenorthwest");
|
||||
local diagmovekeys = tut_key("movesouthwest") .. " " ..
|
||||
tut_key("movenortheast") .. " " ..
|
||||
tut_key("movesoutheast") .. " " ..
|
||||
tut_key("movenorthwest");
|
||||
|
||||
des.engraving({ coord = { 9,3 }, type = "engrave", text = "Move around with " .. movekeys, degrade = false });
|
||||
des.engraving({ coord = { 5,2 }, type = "engrave", text = "Move diagonally with " .. diagmovekeys, degrade = false });
|
||||
@@ -59,7 +86,7 @@ des.engraving({ coord = { 2,4 }, type = "engrave", text = "Some actions may requ
|
||||
des.engraving({ coord = { 2,5 }, type = "engrave", text = "Open the door by moving into it", degrade = false });
|
||||
des.door({ coord = { 2,6 }, state = "closed" });
|
||||
|
||||
des.engraving({ coord = { 2,7 }, type = "engrave", text = "Close the door with '" .. nh.eckey("close") .. "'", degrade = false });
|
||||
des.engraving({ coord = { 2,7 }, type = "engrave", text = "Close the door with '" .. tut_key("close") .. "'", degrade = false });
|
||||
|
||||
|
||||
--
|
||||
@@ -69,14 +96,18 @@ des.trap({ type = "magic portal", coord = { 4,4 }, seen = true });
|
||||
|
||||
--
|
||||
|
||||
des.engraving({ coord = { 5,9 }, type = "engrave", text = "This door is locked. Kick it with '" .. nh.eckey("kick") .. "'", degrade = false });
|
||||
des.engraving({ coord = { 5,9 }, type = "engrave", text = "This door is locked. Kick it with '" .. tut_key("kick") .. "'", degrade = false });
|
||||
des.door({ coord = { 5,10 }, state = "locked" });
|
||||
|
||||
des.engraving({ coord = { 5,12 }, type = "engrave", text = "Look around the map with '" .. nh.eckey("glance") .. "'", degrade = false });
|
||||
-- by default, kick is the first command that can be a ctrl-key combo
|
||||
tut_key_help(6, 8);
|
||||
|
||||
|
||||
des.engraving({ coord = { 5,12 }, type = "engrave", text = "Look around the map with '" .. tut_key("glance") .. "'", degrade = false });
|
||||
|
||||
--
|
||||
|
||||
des.engraving({ coord = { 10,13 }, type = "engrave", text = "Use '" .. nh.eckey("search") .. "' to search for secret doors", degrade = false });
|
||||
des.engraving({ coord = { 10,13 }, type = "engrave", text = "Use '" .. tut_key("search") .. "' to search for secret doors", degrade = false });
|
||||
|
||||
--
|
||||
|
||||
@@ -100,17 +131,17 @@ end
|
||||
|
||||
des.door({ coord = { 18,13 }, state = "closed" });
|
||||
|
||||
des.engraving({ coord = { 19,13 }, type = "engrave", text = "Pick up items with '" .. nh.eckey("pickup") .. "'", degrade = false });
|
||||
des.engraving({ coord = { 19,13 }, type = "engrave", text = "Pick up items with '" .. tut_key("pickup") .. "'", degrade = false });
|
||||
|
||||
local armor = (u.role == "Monk") and "leather gloves" or "leather armor";
|
||||
|
||||
des.object({ id = armor, spe = 0, buc = "cursed", coord = { 19,14} });
|
||||
|
||||
des.engraving({ coord = { 19,15 }, type = "engrave", text = "Wear armor with '" .. nh.eckey("wear") .. "'", degrade = false });
|
||||
des.engraving({ coord = { 19,15 }, type = "engrave", text = "Wear armor with '" .. tut_key("wear") .. "'", degrade = false });
|
||||
|
||||
des.object({ id = "dagger", spe = 0, buc = "not-cursed", coord = { 21,15} });
|
||||
|
||||
des.engraving({ coord = { 21,14 }, type = "engrave", text = "Wield weapons with '" .. nh.eckey("wield") .. "'", degrade = false });
|
||||
des.engraving({ coord = { 21,14 }, type = "engrave", text = "Wield weapons with '" .. tut_key("wield") .. "'", degrade = false });
|
||||
|
||||
|
||||
des.engraving({ coord = { 22,13 }, type = "engrave", text = "Hit monsters by walking into them.", degrade = false });
|
||||
@@ -131,13 +162,13 @@ des.object({ id = "boulder", coord = {25,12} });
|
||||
|
||||
--
|
||||
|
||||
des.engraving({ coord = { 27,9 }, type = "engrave", text = "Take off armor with '" .. nh.eckey("takeoff") .. "'", degrade = false });
|
||||
des.engraving({ coord = { 27,9 }, type = "engrave", text = "Take off armor with '" .. tut_key("takeoff") .. "'", degrade = false });
|
||||
|
||||
--
|
||||
|
||||
des.object({ class = "?", id = "remove curse", buc = "blessed", coord = {23,11} })
|
||||
des.engraving({ coord = { 22,11 }, type = "engrave", text = "Some items have shuffled descriptions, different each game", degrade = false });
|
||||
des.engraving({ coord = { 23,11 }, type = "engrave", text = "Pick up this scroll, read it with '" .. nh.eckey("read") .. "', and try to remove the armor again", degrade = false });
|
||||
des.engraving({ coord = { 23,11 }, type = "engrave", text = "Pick up this scroll, read it with '" .. tut_key("read") .. "', and try to remove the armor again", degrade = false });
|
||||
|
||||
--
|
||||
|
||||
@@ -157,14 +188,14 @@ des.object({ coord = {14, 6}, id = "boulder" });
|
||||
des.door({ coord = { 20,3 }, state = percent(50) and "open" or "closed" });
|
||||
|
||||
des.engraving({ coord = { 21,3 }, type = "engrave", text = "Avoid being burdened, it slows you down", degrade = false });
|
||||
des.engraving({ coord = { 22,3 }, type = "engrave", text = "Drop items with '" .. nh.eckey("drop") .. "'", degrade = false });
|
||||
des.engraving({ coord = { 22,3 }, type = "engrave", text = "Drop items with '" .. tut_key("drop") .. "'", degrade = false });
|
||||
des.engraving({ coord = { 22,4 }, type = "engrave", text = "You can drop partial stacks by prefixing the item slot letter with a number", degrade = false });
|
||||
|
||||
--
|
||||
|
||||
des.monster({ id = "yellow mold", coord = { 26,2 }, waiting = true, countbirth = false });
|
||||
|
||||
des.engraving({ coord = { 25,5 }, type = "engrave", text = "Throw items with '" .. nh.eckey("throw") .. "'", degrade = false });
|
||||
des.engraving({ coord = { 25,5 }, type = "engrave", text = "Throw items with '" .. tut_key("throw") .. "'", degrade = false });
|
||||
|
||||
des.trap({ type = "magic portal", coord = { 21,1 }, seen = true });
|
||||
|
||||
@@ -176,35 +207,35 @@ des.engraving({ coord = { 37,4 }, type = "engrave", text = "Missiles, such as ro
|
||||
|
||||
des.object({ coord = { 37,3 }, id = "sling", buc = "not-cursed", spe = 9 });
|
||||
des.engraving({ coord = { 37,3 }, type = "engrave", text = "Wield the sling", degrade = false });
|
||||
des.engraving({ coord = { 36,1 }, type = "engrave", text = "Use '" .. nh.eckey("fire") .. "' to fire missiles with the wielded launcher", degrade = false });
|
||||
des.engraving({ coord = { 36,1 }, type = "engrave", text = "Use '" .. tut_key("fire") .. "' to fire missiles with the wielded launcher", degrade = false });
|
||||
|
||||
des.engraving({ coord = { 35,4 }, type = "engrave", text = "Firing launches items from your quiver; Use '" .. nh.eckey("quiver") .. "' to put items in it", degrade = false });
|
||||
des.engraving({ coord = { 35,4 }, type = "engrave", text = "Firing launches items from your quiver; Use '" .. tut_key("quiver") .. "' to put items in it", degrade = false });
|
||||
|
||||
des.engraving({ coord = { 33,4 }, type = "engrave", text = "You can wait a turn with '" .. nh.eckey("wait") .. "'", degrade = false });
|
||||
des.engraving({ coord = { 33,4 }, type = "engrave", text = "You can wait a turn with '" .. tut_key("wait") .. "'", degrade = false });
|
||||
|
||||
|
||||
--
|
||||
|
||||
des.door({ coord = { 38,6 }, state = "closed" });
|
||||
|
||||
des.engraving({ coord = { 39,6 }, type = "engrave", text = "You loot containers with '" .. nh.eckey("loot") .. "'", degrade = false });
|
||||
des.engraving({ coord = { 39,6 }, type = "engrave", text = "You loot containers with '" .. tut_key("loot") .. "'", degrade = false });
|
||||
|
||||
des.object({ coord = { 42,6 }, id = "large box", broken = true,
|
||||
contents = function(obj)
|
||||
des.object({ id = "secret door detection", class = "/", spe = 30 }); end
|
||||
});
|
||||
|
||||
des.engraving({ coord = { 45,6 }, type = "engrave", text = "Magic wands are used with '" .. nh.eckey("zap") .. "'", degrade = false });
|
||||
des.engraving({ coord = { 45,6 }, type = "engrave", text = "Magic wands are used with '" .. tut_key("zap") .. "'", degrade = false });
|
||||
|
||||
--
|
||||
|
||||
des.door({ coord = { 35,9 }, state = "nodoor" });
|
||||
des.engraving({ coord = { 34,9 }, type = "engrave", text = "You can run by prefixing a movement key with '" .. nh.eckey("run") .. "'", degrade = false });
|
||||
des.engraving({ coord = { 34,9 }, type = "engrave", text = "You can run by prefixing a movement key with '" .. tut_key("run") .. "'", degrade = false });
|
||||
|
||||
--
|
||||
|
||||
des.door({ coord = { 33,16 }, state = "nodoor" });
|
||||
des.engraving({ coord = { 35,15 }, type = "engrave", text = "Travel across the level with '" .. nh.eckey("travel") .. "'", degrade = false });
|
||||
des.engraving({ coord = { 35,15 }, type = "engrave", text = "Travel across the level with '" .. tut_key("travel") .. "'", degrade = false });
|
||||
|
||||
--
|
||||
|
||||
@@ -212,7 +243,7 @@ des.trap({ type = "magic portal", coord = { 27,14 }, seen = true });
|
||||
|
||||
--
|
||||
|
||||
des.engraving({ coord = { 48,1 }, type = "burn", text = "Use '" .. nh.eckey("eat") .. "' to eat edible things", degrade = false });
|
||||
des.engraving({ coord = { 48,1 }, type = "burn", text = "Use '" .. tut_key("eat") .. "' to eat edible things", degrade = false });
|
||||
|
||||
des.object({ coord = { 50,3 }, id = "apple", buc = "not-cursed" });
|
||||
des.object({ coord = { 50,3 }, id = "candy bar", buc = "not-cursed" });
|
||||
@@ -224,11 +255,11 @@ otmp:stop_timer("rot-corpse");
|
||||
|
||||
des.door({ coord = { 46,11 }, state = "closed" });
|
||||
|
||||
des.engraving({ coord = { 43,11 }, type = "burn", text = "Use '" .. nh.eckey("twoweapon") .. "' to use two weapons at once", degrade = false });
|
||||
des.engraving({ coord = { 43,11 }, type = "burn", text = "Use '" .. tut_key("twoweapon") .. "' to use two weapons at once", degrade = false });
|
||||
des.object({ coord = { 43,13 }, id = "knife", buc = "uncursed" });
|
||||
des.object({ coord = { 43,14 }, id = "dagger", buc = "blessed" });
|
||||
|
||||
des.engraving({ coord = { 43,16 }, type = "burn", text = "Swap weapons quickly with '" .. nh.eckey("swap") .. "'", degrade = false });
|
||||
des.engraving({ coord = { 43,16 }, type = "burn", text = "Swap weapons quickly with '" .. tut_key("swap") .. "'", degrade = false });
|
||||
|
||||
des.door({ coord = { 40,15 }, state = "random" });
|
||||
|
||||
@@ -236,20 +267,23 @@ des.door({ coord = { 40,15 }, state = "random" });
|
||||
|
||||
des.object({ coord = { 48,7 }, id = "ring of levitation", buc = "not-cursed" });
|
||||
|
||||
des.engraving({ coord = { 48,10 }, type = "burn", text = "Put on accessories with '" .. nh.eckey("puton") .. "'", degrade = false });
|
||||
des.engraving({ coord = { 48,10 }, type = "burn", text = "Put on accessories with '" .. tut_key("puton") .. "'", degrade = false });
|
||||
|
||||
des.engraving({ coord = { 48,16 }, type = "burn", text = "Remove accessories with '" .. nh.eckey("remove") .. "'", degrade = false });
|
||||
des.engraving({ coord = { 48,16 }, type = "burn", text = "Remove accessories with '" .. tut_key("remove") .. "'", degrade = false });
|
||||
|
||||
des.door({ coord = { 50,16 }, state = "closed" });
|
||||
|
||||
|
||||
--
|
||||
|
||||
des.engraving({ coord = { 58,9 }, type = "burn", text = "Use '" .. nh.eckey("down") .. "' to go down the stairs", degrade = false });
|
||||
des.engraving({ coord = { 58,9 }, type = "burn", text = "Use '" .. tut_key("down") .. "' to go down the stairs", degrade = false });
|
||||
des.stair({ dir = "down", coord = { 58,10 } });
|
||||
|
||||
--
|
||||
|
||||
-- one more ctrl-key help, if needed
|
||||
tut_key_help(64, 4);
|
||||
|
||||
des.engraving({ coord = { 65,3 }, type = "burn", text = "UNDER CONSTRUCTION", degrade = false });
|
||||
|
||||
des.trap({ type = "magic portal", coord = { 66,2 }, seen = true });
|
||||
|
||||
Reference in New Issue
Block a user