0 votes
by (300 points)

I watched Dan Cox on youtube on how to create a Dungeon Crawler and copied his code from the link he provided but it doesn't work..first the (array: code was red but I found out that I have to only write (a:

Every link gives me an error even though I triple checked it..I couldn't have made an error because I copied it and didn't change anything

|map>[(display: "Map")]
|=
(link-repeat: "Up")[{
(set: _row to $dungeon's ($positionX) )
(if: _row's ($positionY - 1) is not 1)[
    	(set: $positionY to it - 1)
		]
			(replace: ?map)[(display: "Map")]
			}]
this is the code for the passage "Start"
=|=
(link-repeat: "Left")[{
    (set: _row to $dungeon's ($positionX) )
    (if: _row's ($positionX - 1) is not 1)[
        (set: $positionX to it - 1)
]
(replace: ?map)[(display: "Map")]
}]
=|=
(link-repeat: "Right")[{
(set: _row to $dungeon's ($positionX) )
	(if: _row's ($positionX + 1) is not 1)[
		(set: $positionX to it + 1)
     ]
	 	(replace: ?map)[(display: "Map")]
}]
=|=
(link-repeat: "Down")[{
	(set: _row to $dungeon's ($positionX) )
		(if: _row's ($positionY + 1) is not 1)[
			(set: $positionY to it + 1)
			]
				(replace: ?map)[(display: "Map")]
}]
|==|
this is the code for passage "Map"
{ 
(set: $dungeonTable to "<table>") 
(set: $i to 0) 
(for: each _row, ...$dungeon) [ 
(set: $i to it + 1) 
(set: $dungeonTable to it + "<tr>") 
(set: $j to 0)
(for: each _col, ..._row) [ 
     (set: $j to it + 1) 
(if: $i is $positionY and $j is $positionX)[ 
     (set: $dungeonTable to it + "<td>P</td>") 
] 
(else:) [  
(if: _col is 0) [ 
(set: $dungeonTable to it + "<td>.</td>") 
        ]
] 
(if: _col is 1)[ 
(set: $dungeonTable to it + "<td>#</td>")
        ] 
] 
(set: $dungeonTable to it + "</tr>") 
] 
(set: $dungeonTable to it + "</table>") 
$dungeonTable

}
and finally the passage "Startup"
{ 
      (set: $dungeon to (a:     (a: 1,1,1,1,1),
	                        (a: 1,0,0,0,1), 
				(a: 1,0,0,0,1), 
				(a: 1,0,0,0,1), 
				(a: 1,1,1,1,1) ) ) 
	 (set: $positionX to 2) 
	 (set: $positionY to 2) 
}

Please help

1 Answer

+1 vote
by (154k points)
selected by
 
Best answer

When referencing videos / code found on other sites within your question it helps the people answering it if you include a link to that video / code within your question, that way they don't need to go hunting the internet for said video / code.

I believe the video associated with your code example is the Twine 2.1: Harlowe 2.0: Moving through "Dungeons"  video found on YouTube (and not one of the Dungeon Crawler related ones).

The related code example consists of three sections named StartMap, and Startup and you will need to copy the code from each of those section into a Passage with the same name as the section. You will also need to assign a startup tag to the Passage named Startup.

(alternatively you could download a copy the linked MovingthroughDungeons.html file and then use the Twine 2 application's Import From File option to add that demonstration story project to your Story List. If you decided to use this method you will need to later open the new story project and change the story format to whichever version Harlowe 2.x you have installed.)

Welcome to Twine Q&A, where you can ask questions and receive answers from other members of the community.

You can also find hints and information on Twine on the official wiki and the old forums archive.

See a spam question? Flag it instead of downvoting. A question flagged enough times will automatically be hidden while moderators review it.
...