One of the easiest ways to have a more descriptive (and unique) room for each location of your map is to associate a Passage with each of those locations, and one simple method for doing that is by giving each of those passages a generic name based on the X & Y coordinates of the location.
eg. The room at the map location 1:1 (row:column) could be called "Room 1:1", the one at 3:2 is "Room 3:2" as so forth.
The following TWEE Notation is a modified version of Dan's original example, I have renamed some of the variables & passages and changed it to use PassageHeader & PassageFooter special passages to contain the drawn map & direction links respectively. I have also moved the player's current X & Y position variables into a new $player object, as it was likely you would need one if you are building a RPG like game.
warning: I have only created "Room Y:X" related passages for the first four locations in the map array!
:: StoryTitle
Moving through a descriptive dungeon for SugarCube
:: UserStylesheet[stylesheet]
#map {
font-family: monospace;
}
:: StoryInit
/*
Initialise the map.
0 - A wall; 1 - A Room; 2 - The Exit.
*/
<<set $map to [
[0,0,0,0,0,0,0,0,0,0,0],
[0,1,1,1,0,1,1,1,1,1,0],
[0,0,0,1,0,0,0,0,0,1,0],
[0,1,0,1,1,1,1,1,0,1,0],
[0,1,0,0,0,0,0,1,0,1,0],
[0,1,1,1,1,1,1,1,0,1,0],
[0,0,0,0,0,0,0,1,0,1,0],
[0,1,0,1,1,1,1,1,1,1,0],
[0,1,0,1,0,0,0,1,0,0,0],
[0,1,1,1,0,1,1,1,1,2,0],
[0,0,0,0,0,0,0,0,0,0,0]
]>>
<<set $player to {
name : "Jane",
X : 1,
Y : 1
}>>
:: PassageHeader [nobr]
<<if not tags().includes('no-map')>>
<<include "Draw Map">>
<br>
<</if>>
:: PassageFooter [nobr]
<<if not tags().includes('no-map')>>
<br><br>
<<include "Show Directions">>
<</if>>
:: Start [no-map]
Introduction to story.
[[Continue|Room 1:1]]
:: Draw Map [nobr]
<span id="map">
<<for $i to 0; $i lt $map.length; $i++>>
<<for $k to 0; $k lt $map[$i].length; $k++>>
<<if $k eq $player.X and $i eq $player.Y>>
<<print "P">>
<<elseif $map[$i][$k] eq 1>>
<<print ".">>
<<elseif $map[$i][$k] eq 0>>
<<print "#">>
<<elseif $map[$i][$k] eq 2>>
<<print "E">>
<</if>>
<</for>>
<<print "<br>">>
<</for>>
</span>
:: Show Directions [nobr]
<<silently>>
<<set _exits to []>>
/* Check North. */
<<set _type to $map[$player.Y - 1][$player.X]>>
<<if _type eq 1>>
<<set _room to "Room " + ($player.Y - 1) + ":" + $player.X>>
<<set _exits.push("[[North|" + _room + "][$player.Y -= 1]]")>>
<<elseif _type eq 2>>
<<set _exits.push("[[Exit]]")>>
<</if>>
/* Check East. */
<<set _type to $map[$player.Y][$player.X + 1]>>
<<if _type eq 1>>
<<set _room to "Room " + $player.Y + ":" + ($player.X + 1)>>
<<set _exits.push("[[East|" + _room + "][$player.X += 1]]")>>
<<elseif _type eq 2>>
<<set _exits.push("[[Exit]]")>>
<</if>>
/* Check South. */
<<set _type to $map[$player.Y + 1][$player.X]>>
<<if _type eq 1>>
<<set _room to "Room " + ($player.Y + 1) + ":" + $player.X>>
<<set _exits.push("[[South|" + _room + "][$player.Y += 1]]")>>
<<elseif _type eq 2>>
<<set _exits.push("[[Exit]]")>>
<</if>>
/* Check West. */
<<set _type to $map[$player.Y][$player.X - 1]>>
<<if _type eq 1>>
<<set _room to "Room " + $player.Y + ":" + ($player.X - 1)>>
<<set _exits.push("[[West|" + _room + "][$player.X -= 1]]")>>
<<elseif _type eq 2>>
<<set _exits.push("[[Exit]]")>>
<</if>>
<</silently>>
<span id="directions"><<print _exits.join(" | ")>></span>
:: Exit
You made it to the exit.
:: Room 1:1
Description for <<= passage()>>.
:: Room 1:2
Description for <<= passage()>>.
:: Room 1:3
Description for <<= passage()>>.
:: Room 2:3
Description for <<= passage()>>.
Let me know If you need a further explanation of any of the above functionality.