⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 export pixelgene map script.lua

📁 一个symbian 冒险游戏代码
💻 LUA
字号:
--
-- Pixelgene Map Script Exporter for Mappy 1.4
-- Copyright (C) 2004-2005 Pixelgene Ltd.
--
-- Install:
-- 1) Copy to C:\Program Files\Mappy14\luascr
-- 2) Modify lua01=... line from C:\Program Files\Mappy14\MAPWIN.INI: 
--    lua01=Export Pixelgene Map Script.lua
-- 3) Test: Start Mappy, load level, select Custom -> Export Pixelgene Map Script
--

function writeProperty( out, name )
	local prop = mappy.getValue( mappy[name] )
	out:write( name .. "=" .. prop .. "\n" )
end

function writeBlockProperty( out, i, name, more )
	out:write( mappy.getBlockValue(i, mappy[name]) )
	if ( more ) then
		out:write( "," )
	end
end

function getValue( name )
	return mappy.getValue( mappy[name] )
end

function main ()
	local isok,asname = mappy.fileRequester (".", "Pixelgene Map Script (*.pms)", "*.pms", mappy.MMB_SAVE)
	if isok == mappy.MMB_OK then
	
		if (not (string.sub (string.lower (asname), -4) == ".pms")) then
			asname = asname .. ".pms"
		end
		
		out = io.open( asname, "w" )
		out:write( "VERSION=1\n" );

		writeProperty( out, "MAPWIDTH" )
		writeProperty( out, "MAPHEIGHT" )
		writeProperty( out, "BLOCKWIDTH" )
		writeProperty( out, "BLOCKHEIGHT" )
		writeProperty( out, "NUMBLOCKSTR" )
		writeProperty( out, "NUMBLOCKGFX" )
		writeProperty( out, "BLOCKGAPX" )
		writeProperty( out, "BLOCKGAPY" )
		writeProperty( out, "BLOCKSTAGGERX" )
		writeProperty( out, "BLOCKSTAGGERY" )

		out:write( "\n" )
		out:write( "BLOCKINFO={\n" )
		local i = 0
		while ( i < getValue("NUMBLOCKSTR") ) do
			out:write( "    " .. i .. ", " )
			writeBlockProperty( out, i, "BLKBG", 1 )
			writeBlockProperty( out, i, "BLKFG1", 1 )
			writeBlockProperty( out, i, "BLKFG2", 1 )
			writeBlockProperty( out, i, "BLKFG3", 1 )
			writeBlockProperty( out, i, "BLKUSER1", 1 )
			writeBlockProperty( out, i, "BLKUSER2", 1 )
			writeBlockProperty( out, i, "BLKUSER3", 1 )
			writeBlockProperty( out, i, "BLKUSER4", 1 )
			writeBlockProperty( out, i, "BLKUSER5", 1 )
			writeBlockProperty( out, i, "BLKUSER6", 1 )
			writeBlockProperty( out, i, "BLKUSER7", 1 )
			writeBlockProperty( out, i, "BLKFLAG1", 1 )
			writeBlockProperty( out, i, "BLKFLAG2", 1 )
			writeBlockProperty( out, i, "BLKFLAG3", 1 )
			writeBlockProperty( out, i, "BLKFLAG4", 1 )
			writeBlockProperty( out, i, "BLKFLAG5", 1 )
			writeBlockProperty( out, i, "BLKFLAG6", 1 )
			writeBlockProperty( out, i, "BLKFLAG7", 1 )
			writeBlockProperty( out, i, "BLKFLAG8", i+1 < getValue("NUMBLOCKSTR") )
			out:write( "\n" )
			
			i = i + 1
		end
		out:write( "}\n" )

		local blockw = getValue("BLOCKWIDTH")
		local blockh = getValue("BLOCKHEIGHT")
		local blocks = getValue("NUMBLOCKGFX")
		out:write( "\n" )
		
		local mapw = getValue("MAPWIDTH")
		local maph = getValue("MAPHEIGHT")
		out:write( "\n" )
		out:write( "MAP={\n" )
		local y = 0
		while ( y < maph ) do
			out:write( "    " )
			local x = 0
			while ( x < mapw ) do
				local ix = mappy.getBlock( x, y )
				out:write( ix )
				if ( x+1 ~= mapw or y+1 ~= maph ) then
					out:write( "," )
				end
				x = x + 1
			end
			y = y + 1
			out:write( "\n" )
		end
		out:write( "}\n" )

		out:close()
	end
	return nil
end

local errormsg = main()
if errormsg ~= nil then
	mappy.msgBox("Error ...", errormsg, mappy.MMB_OK, mappy.MMB_ICONEXCLAMATION)
end

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -