Oct 19, 2004 12:48
alexm wrote:ianbanks wrote:The boats were done using a Lua script in Cartographer. The script copied the contents of the top left corner of the map (where the boats were originally) and applied the "sketching" effect and enlarged them.
Can you post the lua script you used to make that map? If not, that's fine, just curius on how you did that.
Alex,
Sure, here it is (with a few comments):
[code:1:2abed8b68c]-- The width and height of the original tiles:
width = 44
height = 44
-- The scaling of the new tiles:
scale = 4
-- The length of each random stroke:
stroke_length = 5
stroke_variation = 5
for n = 1, 100 do
-- Pick a random original tile and stroke length.
x = math.random() * width
y = math.random() * height
l = math.random() * stroke_variation + stroke_length
-- Get the "colour" of the randomly chosen tile.
-- Even though x and y are not integers, getpoint
-- will floor() them.
colour = getpoint(10 + x, 10 + y)
-- Calculate the location of the stroke. The
-- non-integer part of x and y multiply out
-- to different tiles giving the randomly
-- located strokes.
big_x = width + 15 + x * scale
big_y = height + 15 + y * scale
line(big_x, big_y, big_x + l, big_y + l, colour)
end[/code:1:2abed8b68c]
If you create a "Filters" directory under the directory that Cartographer (0.4) is in and save that as "Line Drawing.lua" you should get a new filter.
Lua filters aren't particularly well tested or documented yet, but I hope to do both soon and ship the next version with a bunch of scripts.