<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en">
	<id>https://wiki.runerealm.org/index.php?action=history&amp;feed=atom&amp;title=Module%3AMusic_map</id>
	<title>Module:Music map - Revision history</title>
	<link rel="self" type="application/atom+xml" href="https://wiki.runerealm.org/index.php?action=history&amp;feed=atom&amp;title=Module%3AMusic_map"/>
	<link rel="alternate" type="text/html" href="https://wiki.runerealm.org/index.php?title=Module:Music_map&amp;action=history"/>
	<updated>2026-05-03T04:33:06Z</updated>
	<subtitle>Revision history for this page on the wiki</subtitle>
	<generator>MediaWiki 1.41.1</generator>
	<entry>
		<id>https://wiki.runerealm.org/index.php?title=Module:Music_map&amp;diff=38401&amp;oldid=prev</id>
		<title>Alex at 10:23, 17 October 2024</title>
		<link rel="alternate" type="text/html" href="https://wiki.runerealm.org/index.php?title=Module:Music_map&amp;diff=38401&amp;oldid=prev"/>
		<updated>2024-10-17T10:23:26Z</updated>

		<summary type="html">&lt;p&gt;&lt;/p&gt;
&lt;table style=&quot;background-color: #fff; color: #202122;&quot; data-mw=&quot;interface&quot;&gt;
				&lt;col class=&quot;diff-marker&quot; /&gt;
				&lt;col class=&quot;diff-content&quot; /&gt;
				&lt;col class=&quot;diff-marker&quot; /&gt;
				&lt;col class=&quot;diff-content&quot; /&gt;
				&lt;tr class=&quot;diff-title&quot; lang=&quot;en&quot;&gt;
				&lt;td colspan=&quot;2&quot; style=&quot;background-color: #fff; color: #202122; text-align: center;&quot;&gt;← Older revision&lt;/td&gt;
				&lt;td colspan=&quot;2&quot; style=&quot;background-color: #fff; color: #202122; text-align: center;&quot;&gt;Revision as of 12:23, 17 October 2024&lt;/td&gt;
				&lt;/tr&gt;&lt;tr&gt;
  &lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot;&gt;Line 3:&lt;/td&gt;
  &lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot;&gt;Line 3:&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
  &lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;
  &lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;local p = {}&lt;/div&gt;&lt;/td&gt;
  &lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;
  &lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;local p = {}&lt;/div&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
  &lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;
  &lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;br /&gt;&lt;/td&gt;
  &lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;
  &lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;br /&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
  &lt;td class=&quot;diff-marker&quot; data-marker=&quot;−&quot;&gt;&lt;/td&gt;
  &lt;td style=&quot;color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #ffe49c; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;-- Property:Name for Map: &lt;del style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;mw.&lt;/del&gt;pages that should be in/excluded in the smw=&#039;hist&#039; map.&lt;/div&gt;&lt;/td&gt;
  &lt;td class=&quot;diff-marker&quot; data-marker=&quot;+&quot;&gt;&lt;/td&gt;
  &lt;td style=&quot;color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;-- Property:Name for Map: pages that should be in/excluded in the smw=&#039;hist&#039; map.&lt;/div&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
  &lt;td class=&quot;diff-marker&quot; data-marker=&quot;−&quot;&gt;&lt;/td&gt;
  &lt;td style=&quot;color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #ffe49c; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;-- By default, excluded are all Map: &lt;del style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;mw.&lt;/del&gt;pages with multiple music tracks,&lt;/div&gt;&lt;/td&gt;
  &lt;td class=&quot;diff-marker&quot; data-marker=&quot;+&quot;&gt;&lt;/td&gt;
  &lt;td style=&quot;color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;-- By default, excluded are all Map: pages with multiple music tracks,&lt;/div&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
  &lt;td class=&quot;diff-marker&quot; data-marker=&quot;−&quot;&gt;&lt;/td&gt;
  &lt;td style=&quot;color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #ffe49c; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;-- and included are all Map: &lt;del style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;mw.&lt;/del&gt;pages with a single music track.&lt;/div&gt;&lt;/td&gt;
  &lt;td class=&quot;diff-marker&quot; data-marker=&quot;+&quot;&gt;&lt;/td&gt;
  &lt;td style=&quot;color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;-- and included are all Map: pages with a single music track.&lt;/div&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
  &lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;
  &lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;local include_historic = {&lt;/div&gt;&lt;/td&gt;
  &lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;
  &lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;local include_historic = {&lt;/div&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
  &lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;
  &lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;	[&#039;Prifddinas&#039;] = true,&lt;/div&gt;&lt;/td&gt;
  &lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;
  &lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;	[&#039;Prifddinas&#039;] = true,&lt;/div&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;/table&gt;</summary>
		<author><name>Alex</name></author>
	</entry>
	<entry>
		<id>https://wiki.runerealm.org/index.php?title=Module:Music_map&amp;diff=35060&amp;oldid=prev</id>
		<title>Alex: Created page with &quot;local var = mw.ext.VariablesLua  local p = {}  -- Property:Name for Map: mw.pages that should be in/excluded in the smw=&#039;hist&#039; map. -- By default, excluded are all Map: mw.pages with multiple music tracks, -- and included are all Map: mw.pages with a single music track. local include_historic = { 	[&#039;Prifddinas&#039;] = true, } local exclude_historic = { 	[&#039;Alone&#039;] = true, }  -- Convert a link to a &quot;Play track&quot; link -- Use text=&#039;%1&#039; to use the music file&#039;s filename without the...&quot;</title>
		<link rel="alternate" type="text/html" href="https://wiki.runerealm.org/index.php?title=Module:Music_map&amp;diff=35060&amp;oldid=prev"/>
		<updated>2024-10-16T23:12:43Z</updated>

		<summary type="html">&lt;p&gt;Created page with &amp;quot;local var = mw.ext.VariablesLua  local p = {}  -- Property:Name for Map: mw.pages that should be in/excluded in the smw=&amp;#039;hist&amp;#039; map. -- By default, excluded are all Map: mw.pages with multiple music tracks, -- and included are all Map: mw.pages with a single music track. local include_historic = { 	[&amp;#039;Prifddinas&amp;#039;] = true, } local exclude_historic = { 	[&amp;#039;Alone&amp;#039;] = true, }  -- Convert a link to a &amp;quot;Play track&amp;quot; link -- Use text=&amp;#039;%1&amp;#039; to use the music file&amp;#039;s filename without the...&amp;quot;&lt;/p&gt;
&lt;p&gt;&lt;b&gt;New page&lt;/b&gt;&lt;/p&gt;&lt;div&gt;local var = mw.ext.VariablesLua&lt;br /&gt;
&lt;br /&gt;
local p = {}&lt;br /&gt;
&lt;br /&gt;
-- Property:Name for Map: mw.pages that should be in/excluded in the smw=&amp;#039;hist&amp;#039; map.&lt;br /&gt;
-- By default, excluded are all Map: mw.pages with multiple music tracks,&lt;br /&gt;
-- and included are all Map: mw.pages with a single music track.&lt;br /&gt;
local include_historic = {&lt;br /&gt;
	[&amp;#039;Prifddinas&amp;#039;] = true,&lt;br /&gt;
}&lt;br /&gt;
local exclude_historic = {&lt;br /&gt;
	[&amp;#039;Alone&amp;#039;] = true,&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
-- Convert a link to a &amp;quot;Play track&amp;quot; link&lt;br /&gt;
-- Use text=&amp;#039;%1&amp;#039; to use the music file&amp;#039;s filename without the .ogg extension.&lt;br /&gt;
function playTrack(link, text)&lt;br /&gt;
	if link == nil then&lt;br /&gt;
		return &amp;#039;&amp;#039;&lt;br /&gt;
	end&lt;br /&gt;
	if type(link) ~= &amp;#039;table&amp;#039; then&lt;br /&gt;
		link = {link}&lt;br /&gt;
	end&lt;br /&gt;
	local ret = &amp;#039;&amp;#039;&lt;br /&gt;
	for _, l in ipairs(link) do&lt;br /&gt;
		ret = ret .. l:gsub(&amp;#039;%[%[:?File:([^%|%]]+)%.ogg%|?.*%]%]&amp;#039;, &amp;#039;&amp;lt;div&amp;gt;[[:File:%1.ogg|&amp;#039;..text..&amp;#039;]]&amp;#039;)..&amp;#039;&amp;lt;/div&amp;gt;&amp;#039;&lt;br /&gt;
	end&lt;br /&gt;
	return ret&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
function p.main( frame )&lt;br /&gt;
    return p._main( frame:getParent().args )&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
function p._main( args )&lt;br /&gt;
	local nopreprocess = args[&amp;#039;nopreprocess&amp;#039;]&lt;br /&gt;
	local jsonObj = {&lt;br /&gt;
		type = &amp;quot;FeatureCollection&amp;quot;,&lt;br /&gt;
		features = {},&lt;br /&gt;
	}&lt;br /&gt;
	local feat = jsonObj[&amp;#039;features&amp;#039;]&lt;br /&gt;
	local cgs = args[&amp;#039;categories&amp;#039;] or &amp;#039;&amp;#039;&lt;br /&gt;
	if args.smw == &amp;#039;hist&amp;#039; then&lt;br /&gt;
		cgs = cgs .. &amp;#039;[[Category:%s]][[Location JSON::+]] OR [[Category:%s]][[Historic Location JSON::+]]&amp;#039; .. cgs&lt;br /&gt;
	elseif args.smw == &amp;#039;onlyhist&amp;#039; then&lt;br /&gt;
		cgs = &amp;#039;[[Category:%s]][[Historic Location JSON::+]]&amp;#039; .. cgs&lt;br /&gt;
	else&lt;br /&gt;
		cgs = &amp;#039;[[Category:%s]][[Location JSON::+]]&amp;#039; .. cgs&lt;br /&gt;
	end&lt;br /&gt;
	local query = {&lt;br /&gt;
		string.format(cgs, &amp;quot;Music tracks&amp;quot;, &amp;quot;Music tracks&amp;quot;),&lt;br /&gt;
		&amp;#039;?=#&amp;#039;,&lt;br /&gt;
		&amp;#039;?Music number&amp;#039;,&lt;br /&gt;
		&amp;#039;?Music track&amp;#039;,&lt;br /&gt;
		&amp;#039;limit=5000&amp;#039;&lt;br /&gt;
	}&lt;br /&gt;
	local query2 = {&lt;br /&gt;
		string.format(cgs, &amp;quot;Music track maps&amp;quot;, &amp;quot;Music track maps&amp;quot;),&lt;br /&gt;
		&amp;#039;?=#&amp;#039;,&lt;br /&gt;
		&amp;#039;?Music track&amp;#039;,&lt;br /&gt;
		&amp;#039;?Plays music&amp;#039;,&lt;br /&gt;
		&amp;#039;?Name&amp;#039;,&lt;br /&gt;
		&amp;#039;limit=5000&amp;#039;&lt;br /&gt;
	}&lt;br /&gt;
	if args.smw ~= &amp;#039;onlyhist&amp;#039; then&lt;br /&gt;
		table.insert(query, &amp;#039;?Location JSON&amp;#039;)&lt;br /&gt;
		table.insert(query2, &amp;#039;?Location JSON&amp;#039;)&lt;br /&gt;
	end&lt;br /&gt;
	if args.smw == &amp;#039;hist&amp;#039; or args.smw == &amp;#039;onlyhist&amp;#039; then&lt;br /&gt;
		table.insert(query, &amp;#039;?Historic Location JSON&amp;#039;)&lt;br /&gt;
		table.insert(query2, &amp;#039;?Historic Location JSON&amp;#039;)&lt;br /&gt;
	end&lt;br /&gt;
	local songs = mw.smw.ask(query)&lt;br /&gt;
	local clusters = mw.smw.ask(query2)&lt;br /&gt;
	local polys = songs or {}&lt;br /&gt;
	if type(clusters) == &amp;#039;table&amp;#039; then&lt;br /&gt;
		for _,c in ipairs(clusters) do&lt;br /&gt;
			table.insert(polys, c)&lt;br /&gt;
		end&lt;br /&gt;
	end&lt;br /&gt;
	math.randomseed(args[&amp;#039;randomseed&amp;#039;] or 1)&lt;br /&gt;
	local i = 0&lt;br /&gt;
	local noid = -1&lt;br /&gt;
	local tracklist = {}&lt;br /&gt;
	if polys then&lt;br /&gt;
		for _, coords in ipairs(polys) do&lt;br /&gt;
			local track = coords[1]&lt;br /&gt;
			local name = coords[&amp;#039;Name&amp;#039;]&lt;br /&gt;
			local musicID = coords[&amp;#039;Music number&amp;#039;]&lt;br /&gt;
			-- replace |foo]] with |Play track]], or ]] with |Play track:&lt;br /&gt;
			local tracklink&lt;br /&gt;
			if type(coords[&amp;#039;Music track&amp;#039;]) == &amp;#039;table&amp;#039; then&lt;br /&gt;
				tracklink = playTrack(coords[&amp;#039;Music track&amp;#039;], &amp;#039;%1&amp;#039;)&lt;br /&gt;
			else&lt;br /&gt;
				tracklink = playTrack(coords[&amp;#039;Music track&amp;#039;], &amp;#039;Play track&amp;#039;)&lt;br /&gt;
			end&lt;br /&gt;
			if musicID then&lt;br /&gt;
				musicID = tonumber(musicID)&lt;br /&gt;
				tracklist[musicID] = {}&lt;br /&gt;
			else&lt;br /&gt;
				musicID = noid&lt;br /&gt;
				tracklist[musicID] = {}&lt;br /&gt;
				noid = noid - 1&lt;br /&gt;
			end&lt;br /&gt;
			local json = coords[&amp;#039;Location JSON&amp;#039;]&lt;br /&gt;
			if args.smw == &amp;#039;onlyhist&amp;#039; then&lt;br /&gt;
				json = coords[&amp;#039;Historic Location JSON&amp;#039;]&lt;br /&gt;
			elseif args.smw == &amp;#039;hist&amp;#039; then&lt;br /&gt;
				if coords[&amp;#039;Historic Location JSON&amp;#039;] then&lt;br /&gt;
					json = coords[&amp;#039;Historic Location JSON&amp;#039;]&lt;br /&gt;
				elseif exclude_historic[name] or (type(coords[&amp;#039;Music track&amp;#039;]) == &amp;#039;table&amp;#039; and not include_historic[name]) then&lt;br /&gt;
					-- multiple music tracks means that the coords are for a combined music track area.&lt;br /&gt;
					json = nil&lt;br /&gt;
				end -- else: keep json = coord[&amp;#039;Location JSON&amp;#039;]; i.e. do nothing&lt;br /&gt;
			end&lt;br /&gt;
			if type(json) == &amp;#039;string&amp;#039; then&lt;br /&gt;
				json = {json}&lt;br /&gt;
			end&lt;br /&gt;
			local paren = track:find(&amp;#039; %(music track%)&amp;#039;)&lt;br /&gt;
			local colon = track:find(&amp;#039;:&amp;#039;) or 0&lt;br /&gt;
			local link&lt;br /&gt;
			if paren then&lt;br /&gt;
				base = track:sub(colon, paren)&lt;br /&gt;
				link = string.format(&amp;#039;[[%s (music track)|%s]]&amp;#039;, base, name and &amp;#039;(?)&amp;#039; or base)&lt;br /&gt;
			else&lt;br /&gt;
				link = string.format(&amp;#039;[[%s|%s]]&amp;#039;, track, name and &amp;#039;(?)&amp;#039; or track)&lt;br /&gt;
			end&lt;br /&gt;
			if name then&lt;br /&gt;
				link = string.format(&amp;#039;[[%s]] &amp;lt;sup&amp;gt;%s&amp;lt;/sup&amp;gt;&amp;#039;, name, link)&lt;br /&gt;
			end&lt;br /&gt;
			--colors = {&amp;#039;#3388ff&amp;#039;, &amp;#039;#ff3333&amp;#039;, &amp;#039;#88ff33&amp;#039;, &amp;#039;#ffff33&amp;#039;}&lt;br /&gt;
			--colors[math.random(4)]&lt;br /&gt;
			if json then&lt;br /&gt;
				for _, jsonstr in ipairs(json) do&lt;br /&gt;
					mw.logObject({name, jsonstr})&lt;br /&gt;
					local obj = mw.text.jsonDecode(jsonstr)&lt;br /&gt;
					local prop = obj[&amp;#039;properties&amp;#039;]&lt;br /&gt;
					&lt;br /&gt;
					if prop then&lt;br /&gt;
						prop[&amp;#039;title&amp;#039;] = link&lt;br /&gt;
						prop[&amp;#039;description&amp;#039;] = tracklink&lt;br /&gt;
						prop[&amp;#039;mapID&amp;#039;] = &amp;quot;-1&amp;quot;&lt;br /&gt;
						prop[&amp;#039;plane&amp;#039;] = 0&lt;br /&gt;
						table.insert(feat, obj)&lt;br /&gt;
						table.insert(tracklist[musicID], i)&lt;br /&gt;
					end&lt;br /&gt;
					&lt;br /&gt;
					i = i + 1&lt;br /&gt;
				end&lt;br /&gt;
			end&lt;br /&gt;
		end&lt;br /&gt;
	end&lt;br /&gt;
	var.vardefine(&amp;#039;tracklist&amp;#039;, trackdata(tracklist))&lt;br /&gt;
	local jsonstr = mw.text.jsonEncode(jsonObj)&lt;br /&gt;
	jsonstr = jsonstr:gsub(&amp;#039;}}&amp;#039;, &amp;#039;} }&amp;#039;):gsub(&amp;#039;}}&amp;#039;, &amp;#039;} }&amp;#039;)&lt;br /&gt;
	return jsonstr&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
function trackdata(tracklist)&lt;br /&gt;
	if tracklist == nil then&lt;br /&gt;
		return &amp;#039;&amp;#039;&lt;br /&gt;
	end&lt;br /&gt;
	local div = mw.html.create(&amp;#039;div&amp;#039;):css(&amp;#039;display&amp;#039;, &amp;#039;none&amp;#039;)&lt;br /&gt;
	for track, ids in pairs(tracklist) do&lt;br /&gt;
		div:tag(&amp;#039;data&amp;#039;):attr(&amp;#039;value&amp;#039;, table.concat(ids, &amp;#039; &amp;#039;)):wikitext(track)&lt;br /&gt;
	end&lt;br /&gt;
	return tostring(div)&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
return p&lt;br /&gt;
&lt;br /&gt;
--[[Debug copypaste:&lt;br /&gt;
=&amp;quot;{{#tag:mapframe|&amp;quot;..p._main({width=1000, height=850, zoom=0, smw=&amp;quot;onlyhist&amp;quot;})..&amp;quot;|width=500|height=500|mapid=-1}}&amp;quot;&lt;br /&gt;
--]]&lt;/div&gt;</summary>
		<author><name>Alex</name></author>
	</entry>
</feed>