Cartographer's Map

From Redwall MUCK Wiki


Since someone asked, here’s the code I use to display the map generated by Cartographer. It (mostly) avoids function invocation limits by rendering the map in successive chunks. I copied this straight out of the file, so some things will need changing (dbrefs, mostly).


@create Cartographer's Map=me=cartomap
+reg $cartomap:laserbot=$laserbot
+reg $cartomap:laserbot=$laserbot
@act showmap=$cartomap=$cartomap:showmap=$nothing
@succ $cartomap:showmap={lexec:showmap,showmap}
lsedit $cartomap:showmap=showmap
.del ^ $
The device spins to life.\r<< Generating map... >>\rStart point: {name:{default:{prop:_map/1/100/6, #104924},{loc:#104924}}}
{null:
	{with:i,1,
	{with:stop,{count:{listprops:_map/1,#104924}},
		{if:{prop:_explore/{loc:me}/y,#104924},
			{set:i,{max:1,{subt:{tell:{lmember:{lsort:{subst:{listprops:_map/1,#104924},_map/1/,}},{prop:_explore/{loc:me}/y,#104924}}},7}}}
			{set:stop,{add:{&i},7}}}
		{while:{lt:{&i},{&stop}},
			{delay:1,\{with:start\,{&i}\,\{lexec:doshow\}\}}
			{set:i,{add:{&i},6}}}}}}
.end
lsedit $cartomap:showmap=doshow
.del ^ $
{func:repeat,str,times,
	{left:,{mult:{&times},{strlen:{&str}}},{&str}}}
{with:i,0,
{null:
		{with:plist,{lsort:{subst:{listprops:_map/1,#104924},_map/1/,}},
			{foreach:y,
				{sublist:{&plist},
					{&start},{add:{&start},5}},
				{with:pw,{&i},
				{set:i,1}
				{with:line1,,
				{with:line2,,
				{with:line3,,
					{foreach:x,{lsort:{subst:{listprops:_map/1/{&y},#104924},_map/1/{&y}/,}},
						{if:{gt:{&x},{&i}},
							{set:line1,{&line1}{repeat:+----,{subt:{&x},{&i}}}}
							{set:line2,{&line2}{repeat:|::::,{subt:{&x},{&i}}}}
							{set:line3,{&line3}{repeat:|::::,{subt:{&x},{&i}}}}}
						{null:{set:i,{add:{&x},1}}}
						{set:line1,{&line1}+----}
						{set:line2,{&line2}|  {if:{eq:{loc:#104924},{prop:_map/1/{&y}/{&x},#104924}},o, } }
						{set:line3,{&line3}|  {if:{eq:{loc:me},{prop:_map/1/{&y}/{&x},#104924}},*, } },
						\r
					}
					{tell:
						{&line1}+{if:{gt:{&pw},{&i}},
							{repeat:----+,{subt:{&pw},{&i}}}}\r
						{&line2}|\r
						{&line3}|\r
						}}}}}}}}}
.end