author kyberneticist@gmail.com Fri, 19 Oct 2012 21:00:58 +0000 changeset 255 18e1a94e1591 parent 254 a21261c77793 child 256 0b93b3ec3ebf
Edited wiki page LuaDrawing through web user interface.
 LuaDrawing.wiki file | annotate | diff | comparison | revisions
```--- a/LuaDrawing.wiki	Fri Oct 19 20:58:54 2012 +0000
+++ b/LuaDrawing.wiki	Fri Oct 19 21:00:58 2012 +0000
@@ -3,7 +3,7 @@
= Drawing Maps With Lua =

Starting in 0.9.18 it is possible to reliably use drawn map mode to draw maps with scripts.
-A simple example is given below
+A simple example is given below.  Note that Drawn maps use an area of 4096x2048

= Details =

@@ -13,22 +13,22 @@
function AddPoint(x, y, new, size, erase)
PointsBuffer = PointsBuffer .. string.char(band(x,0xff00) / 256 , band(x,0xff) , band(y,0xff00) / 256 , band(y,0xff))
if new then
-		size = bor(size,0x80)
+        size = bor(size,0x80)
if erase then
-			size = bor(size,0x40)
-		end
-		PointsBuffer = PointsBuffer .. string.char(size)
-	else
-		PointsBuffer = PointsBuffer .. string.char(0)
+            size = bor(size,0x40)
+        end
+        PointsBuffer = PointsBuffer .. string.char(size)
+    else
+        PointsBuffer = PointsBuffer .. string.char(0)
end
if #PointsBuffer > 245 then
-		ParseCommand('draw '..PointsBuffer)
+        ParseCommand('draw '..PointsBuffer)
PointsBuffer = ''
-	end
+    end
end
function FlushPoints()
if #PointsBuffer > 0 then
-		ParseCommand('draw '..PointsBuffer)
+        ParseCommand('draw '..PointsBuffer)
PointsBuffer = ''
end
end
@@ -40,31 +40,31 @@

<code lang="lua">
function onGameInit()
-	MapGen = 2
-	TemplateFilter = 0
+    MapGen = 2
+    TemplateFilter = 0

for i = 63,2,-4 do
end

for i = 1,2000,50 do
end