Please download the latest version of this plugin from the plugin store.![]()

Dummy.lua

Code: Select all Reset
-- prevent the draft loaded if the TheoTown version is not supported -- only for plugins that published outside plugin store if Runtime.getVersionCode() >= 1937 then -- create a dummy drafts -- the drafts will be added while init for i=1, 8 do Draft.append([[ [ { "id": "$dummy]]..i..[[", "type": "award", "title": "Dummy size ]]..i..[[ x ]]..i..[[", "category": "$dummyfolder00", "width": ]]..i..[[, "height": ]]..i..[[, "frames": [{"bmp": "dummy_frames.png"}], "script": "main.lua", "draw ground": true, "max count": 1, "build time": 0 } ] ]] ) end end -- dialog to select hidden draft -- the draft only can be selected with this tool local function showDraftDialog() local dialog = GUI.createDialog{ w = 256, h = 256, title = 'Select Building Size' } local listBox = dialog.content:addListBox{} for i=1, 8 do local layout = listBox:addLayout{h=26,spacing=1} local label = layout:getFirstPart():addLabel{ w = -26, text = Draft.getDraft('$dummy'..i):getTitle() } local button = layout:getLastPart():addButton{ w = 0, icon = Icon.BUILD, onClick = function() City.createDraftDrawer('$dummy'..i).select() dialog.close() end } end end -- function to close the build mode and show the dialog -- another function to prevent the dialog show -- when the draft has been built function script:event(x,y,level,event) if event == Script.EVENT_TOOL_ENTER then GUI.get'cmdCloseTool':click() -- prevent the funtion to be called and show an error message if Runtime.getVersionCode() >= 1937 then local draft = Array() for i=1, 8 do draft:add(City.countBuildings(Draft.getDraft('$dummy'..i))) end if draft:contains(1) then Debug.toast('Please remove the last building first') else showDraftDialog() end else Debug.toast('TheoTown version is not supported') end end end

Code: Select all Reset
local activeLayer = 1 local buildingId = 'buildingId' local layer = Array{Array{1,'animationId',1,1,1,1,0,0,0,1}} -- Array with contents local temp = {} -- Empty table local toDisplay = {} -- Empty table local toFile = Array() -- Empty array -- create a table to store animation id from user local function userAnimationId() return Util.optStorage(TheoTown.getStorage(), 'userAnimationId') end -- functions to facilitate access to get and set values in nested arrays -- recommended for values that is stored on child table of table local function getDirection(index) local index = index or activeLayer return layer[index][1] end local function setDirection(newState) layer[activeLayer][1] = newState end local function getAnimationId(index) local index = index or activeLayer return layer[index][2] end local function setAnimationId(newState) layer[activeLayer][2] = newState end local function getAbsX(index) local index = index or activeLayer return layer[index][3] end local function setAbsX(newState) layer[activeLayer][3] = newState end local function getAbsY(index) local index = index or activeLayer return layer[index][4] end local function setAbsY(newState) layer[activeLayer][4] = newState end local function getColumn(index) local index = index or activeLayer return layer[index][5] end local function setColumn(newState) layer[activeLayer][5] = newState end local function getRow(index) local index = index or activeLayer return layer[index][6] end local function setRow(newState) layer[activeLayer][6] = newState end local function getDiffX(index) local index = index or activeLayer return layer[index][7] end local function setDiffX(newState) layer[activeLayer][7] = newState end local function getDiffY(index) local index = index or activeLayer return layer[index][8] end local function setDiffY(newState) layer[activeLayer][8] = newState end local function getOffsetY(index) local index = index or activeLayer return layer[index][9] end local function setOffsetY(newState) layer[activeLayer][9] = newState end local function getProbability(index) local index = index or activeLayer return layer[index][10] end local function setProbability(newState) layer[activeLayer][10] = newState end
main.json

Code: Select all Reset
[ { "id": "$dummyfolder00", "type": "category", "frames": [null], "hidden": "true" }, { "id": "$dummy_generator_00", "title": "Animation Dev. Tool", "text": "Attach a night lights or animation to your plugin easily.", "author": "ian`", "type": "tool", "script": "dummy.lua" } ]