EdMignari
Veteran OT User
- Joined
- Jan 8, 2011
- Messages
- 193
- Reaction score
- 347
OT world has a lot of skilled Lua programmers. This will enable them to implement new features like procedural map generation, custom area selection and move, custom item replacement, etc.
Already implemented functions:
Examples:
Discussion:
https://github.com/hjnilsson/rme/issues/131
Follow the development:
https://github.com/hjnilsson/rme/tree/lua_scripting
Nightly builder (Win):
https://www.dropbox.com/sh/auqhbsiqdk33gm8/AACKIsP_Z5ZeCPdWkh8ougPTa?dl=0
NOTE: this is a development version! Use it only for testing and exploring new features.
Already implemented functions:
Code:
g_gui.newMap()
g_gui.loadMap(path)
g_gui.shouldSaveCurrentMap()
g_gui.saveCurrentMap()
g_gui.canUndo()
g_gui.canRedo()
g_gui.doUndo()
g_gui.doRedo()
g_gui.getEditorAt(index)
g_gui.getCurrentEditor()
g_gui.setCurrentEditor(editor)
g_gui.setCurrentEditor(index)
g_gui.getCurrentFloor()
g_gui.setCurrentFloor(z)
g_gui.getCenterPosition()
g_gui.setCenterPosition(position)
g_gui.setSelectionMode()
g_gui.setDrawingMode()
g_gui.setStatusText(text)
g_gui.showTextBox(title, text)
g_gui.getExecDirectory()
g_gui.getDataDirectory()
g_gui.getLocalDataDirectory()
g_gui.getLocalDirectory()
g_gui.getExtensionsDirectory()
Editor(index)
editor:getMapDescription()
editor:setMapDescription(newDescription)
editor:getMapWidth()
editor:setMapWidth(newWidth)
editor:getMapHeight()
editor:setMapHeight(newHeight)
editor:getTile(x, y, z)
editor:getTile(position)
editor:createSelection(start, end)
editor:selectTiles(tiles)
editor:getSelection()
Tile(x, y, z)
Tile(position)
tile:getPosition()
tile:isHouse()
tile:isHouseExit()
tile:isPvP()
tile:isNoPvP()
tile:isNoLogout()
tile:isPZ()
tile:isBlocking()
tile:isSelected()
tile:isModified()
tile:setPvP(enable)
tile:setNoPvP(enable)
tile:setNoLogout(enable)
tile:setPZ(enable)
Selection(editor, start, end)
selection:getTiles()
selection:getTileCount()
selection:getMinPosition()
selection:getMaxPosition()
selection:move(position)
selection:offset(x[, y = 0[, z = 0]])
selection:borderize()
selection:randomize()
selection:saveAsMinimap(directory, fileName)
selection:destroy()
Examples:
Code:
local startPos = {x = 231, y = 215, z = 7}
local endPos = {x = 252, y = 227, z = 7}
local editor = Editor(0) -- Gets the editor at tab 0.
if editor then
local selection = editor:createSelection(startPos, endPos) -- Creates a rectangular selection.
if selection then
local tiles = selection:getTiles()
for _,tile in pairs(tiles) do
tile:setPZ(false)
end
end
end
Code:
local startPos = {x = 231, y = 215, z = 7}
local endPos = {x = 252, y = 227, z = 7}
local destination = {x = 1000, y = 1035, z = 7}
local editor = Editor(0) -- Gets the editor at tab 0.
if editor then
local selection = editor:createSelection(startPos, endPos) -- Creates a rectangular selection.
if selection then
selection:move(destination)
end
end
Code:
local startPos = {x = 199, y = 187, z = 7}
local endPos = {x = 278, y = 237, z = 0}
local directory = "C:/Users/Mignari/Documents/output"
local filename = "test"
local editor = Editor(0) -- Gets the editor at tab 0.
if editor then
local selection = editor:createSelection(startPos, endPos) -- Creates a rectangular selection.
if selection then
selection:saveAsMinimap(directory, filename)
end
end
Discussion:
https://github.com/hjnilsson/rme/issues/131
Follow the development:
https://github.com/hjnilsson/rme/tree/lua_scripting
Nightly builder (Win):
https://www.dropbox.com/sh/auqhbsiqdk33gm8/AACKIsP_Z5ZeCPdWkh8ougPTa?dl=0
NOTE: this is a development version! Use it only for testing and exploring new features.
Last edited: