mirror of
https://github.com/edubart/otclient.git
synced 2025-11-30 07:26:49 +01:00
add option custom user script, otclientrc.lua
This commit is contained in:
Binary file not shown.
@@ -70,10 +70,18 @@ end
|
||||
|
||||
function resolvepath(filePath, depth)
|
||||
depth = depth or 1
|
||||
if filePath:sub(0, 1) ~= '/' then
|
||||
return getfsrcpath(depth+1) .. '/' .. filePath
|
||||
if filePath then
|
||||
if filePath:sub(0, 1) ~= '/' then
|
||||
local basepath = getfsrcpath(depth+1)
|
||||
if basepath:sub(#basepath) ~= '/' then basepath = basepath .. '/' end
|
||||
return basepath .. filePath
|
||||
else
|
||||
return filePath
|
||||
end
|
||||
else
|
||||
return filePath
|
||||
local basepath = getfsrcpath(depth+1)
|
||||
if basepath:sub(#basepath) ~= '/' then basepath = basepath .. '/' end
|
||||
return basepath
|
||||
end
|
||||
end
|
||||
|
||||
@@ -90,3 +98,7 @@ function tonumber(v)
|
||||
if v == nil then return 0 end
|
||||
return oldtonumber(v)
|
||||
end
|
||||
|
||||
function runscript(file)
|
||||
g_lua.runScript(resolvepath(file, 2))
|
||||
end
|
||||
@@ -27,7 +27,7 @@ InterfacePanel2 < Panel
|
||||
source: /core_styles/images/interface_panel2.png
|
||||
border: 4
|
||||
|
||||
MapPanel < UIMap
|
||||
Map< UIMap
|
||||
map margin: 4
|
||||
border-image:
|
||||
source: /core_styles/images/map_panel.png
|
||||
|
||||
@@ -18,7 +18,7 @@ UIGame
|
||||
anchors.right: rightPanel.left
|
||||
anchors.bottom: parent.bottom
|
||||
|
||||
MapPanel
|
||||
Map
|
||||
id: mapPanel
|
||||
anchors.left: parent.left
|
||||
anchors.right: rightPanel.left
|
||||
|
||||
12
modules/otclientrc.lua
Normal file
12
modules/otclientrc.lua
Normal file
@@ -0,0 +1,12 @@
|
||||
-- this file use loaded after everything is loaded and initialized
|
||||
-- you can place any custom user code here
|
||||
|
||||
Hotkeys.bind('F1', function() Game.talk('exura gran') end)
|
||||
Hotkeys.bind('F2', function() Game.talk('exori flam') end)
|
||||
Hotkeys.bind('F3', function() Game.talk('exevo flam hur') end)
|
||||
Hotkeys.bind('Ctrl+R', function() runscript('otclientrc.lua') end)
|
||||
|
||||
if rcloaded then
|
||||
print('otclient.rc lua reloaded')
|
||||
end
|
||||
rcloaded = true
|
||||
Reference in New Issue
Block a user