So i followed this lil tutorial: OTClient - How to make a hud in otui (https://otland.net/threads/how-to-make-a-hud-in-otui.282980/) but i didn't succeed.
In not succeding Im talking about there's no image showing, as its suppose to show the window.png file.
This is my otui: (which otclient gives error of: ERROR: "Failed to import UI styles from 'timecheck.otui': OTML error in '/mods/game_timecheck/timecheck.otui:1': not a valid style declaration") I have no clue of why UIWidget isnt?
This is my lua script:
In not succeding Im talking about there's no image showing, as its suppose to show the window.png file.
This is my otui: (which otclient gives error of: ERROR: "Failed to import UI styles from 'timecheck.otui': OTML error in '/mods/game_timecheck/timecheck.otui:1': not a valid style declaration") I have no clue of why UIWidget isnt?
CSS:
UIWidget
id: attributesId
anchors.top: parent.top
anchors.left: parent.left
margin-top: 30
margin-left: 30
size: 100 190
visible: false
layout:
type: verticalBox
Label
id: healthImage
image-width: 60
image-height: 60
opacity: 0.4
image-source: /images/ui/window
Label
id: healthId
margin-top: 33
margin-left: 6
font: verdana-11px-rounded
This is my lua script:
Lua:
function init()
ProtocolGame.registerExtendedOpcode(110, onExtendedOpcode)
g_ui.importStyle('timecheck')
end
function terminate()
ProtocolGame.unregisterExtendedOpcode(110, onExtendedOpcode)
end
function sendMyCode()
timechecking = g_ui.createWidget('timecheck', rootWidget)
timechecking:show()
timechecking:raise()
timechecking:focus()
local myData = {
a = "string",
b = 123,
c = {
x = "string in table",
y = 456
}
}
local protocolGame = g_game.getProtocolGame()
if protocolGame then
protocolGame.sendExtendedOpCode(110, json.encode(myData))
end
end
function onExtendedOpcode(protocol, code, buffer)
local json_status, json_data =
pcall(
function()
return json.decode(buffer)
end
)
if not json_status then
g_logger.error("[My Module] JSON error: " .. json_data)
return false
end
print("hello papa")
print(json_data.foo)
print(json_data.bar)
end