Twine Version: 2.5.1
Story Format: Sugarcube 2.36.1
I was watching Twine 2.0: Creating a Dungeon Crawler -- Part 1 (SugarCube 1.0) - YouTube Dan Cox’s video on YouTube on how to build a Dungeon Crawler in Sugarcube. I have been trying to replicate his method in my own game, but his “MapArray” code does not function for me the way it does for him.
When I tried to write his exact code, using my own Variables, it came back with a <<set error at first. I chalked it up to me having to have done something wrong and started over. (NOTE: I don’t have the code handy to replicate it for you.)
In his video, he has his $MapArray written like this:
<<set $mapArray to
[[0, 0, 0, 0, 0, 0, 0, 0],
[0, 1, 0, 0, 0, 0, 0, 0],
[0, 0, 0, 0, 0, 0, 0, 0]
...(rest of the map)
]>> /* The "1" represents where the player starts out, or Coordinates ($positionX = 1, $positionY = 1) */
In his video, 0’s create a border, or walls, to the dungeon, and 1’s are valid moves the player can make. In my example above, only the players Starting Location is a 1.
He has the $mapArray in its own passage, and displayed in the header of every passage of his dungeon using the (<>) macro.
When his array is displayed, it Linebreaks after every string and has no " , " at all displayed, but when I use the same code structure, it prints every string consecutively, all separated by commas.
What am I doing wrong? I know that he was using Sugarcube 1, but some codes work between the two, and some don’t. This one just doesn’t work the way it used to.
<<set $trenchMapArray to [
[0, 0, 0, 0, 0, 0, 0],
[0, 1, 1, 1, 0, 1, 0]
]>>
I need an array, not a property ($object.property) which will contain multiple numerical strings and will display each string on a newline when printed and without commas.
And please, if you can, explain it to me as if I were a child.
Too often, when searching for answers, I end up with more questions, or just totally overwhelmed and confused, than when I started. Such as “_i”. I have researched plenty of functions and I continually see “_i” in the solution, what does the “_i” variable usually represent??? It’s never explicitly addressed, and I know it means something different in every bit of code, that’s just one example of how the answers are not always so easy to use. It’s difficult to learn how a code works if I am continually introduced to extra concepts and functions that are increasingly more complicated, and the documentation for Sugarcube offers little to no answers for questions like that.
Thank you in advance for any help you can offer.