UI

  • Create a Client.lua file in the Scripts folder and add the following contents.

  • Add the test.jpg image file to the Resource Manager Pictures folder.

  • Float the image (X=10, Y=10, Width=100, Height=100)

image = Image("Pictures/test.jpg", Rect(10, 10, 100, 100))

-- Change image
-- ex1
image.image = "Icons/01.png"
--ex2
image.SetImage("Icons/05.png")
  • Float the button and click to display a message popup (X=200, Y=200, width=100, height=100)

button = Button("Hello", Rect(200, 200, 100, 100))
button.onClick.Add(function()
  Client.ShowAlert("Hello")
end)
  • Create a panel and place text inside it

panel = Panel()
panel.rect = Rect(300, 200, 50, 50)
text = Text("Yahoo", Rect(0, 0, 40, 20))
panel.AddChild(text)
  • Delete the button that appears after clicking the button

button = Button("Hello", Rect(200, 200, 100, 100))
button.onClick.Add(function()
  button.Destroy()
end)
  • Change button color

button = Button("Hello", Rect(200, 200, 100, 100))
button.color = Color(r, g, b, transparency)
  • Pop up a button and click to post a message to the entire server

button = Button("Hello", Rect(200, 200, 100, 100))
button.onClick.Add(function()
  Client.FireEvent("HELLO", "Hey guys! Can you hear me?")
end)
  • Create a Server.lua file in the Scripts/Servers folder and put the following content in it.

  • Process when an event called HELLO arrives

Server.GetTopic("HELLO").Add(function(text)
  Server.SendCenterLabel(text)
end)
  • Adjusting with basic UI scripts

function DefaultUI()
-- Controller Settings
controller = Client.controller
-- Change background image
controller.backgroundImage = "Icons/01.png";
-- Change the ball image
controller.ballImage = "Icons/05.png";
-- Change the first path background image and the second path ball image
controller.SetControllerImage("Icons/01.png","Icons/05.png");

-- For more property values, see ScriptBaseControl (for default position values, see Layout Manager).
controller.x = 300 -- Set background position
controller.y = -100
controller.width = 100 -- Change size
controller.height = 200

--Adjustable ball position (see ScriptBaseControl for more properties)
controller.ball.x = 100
-- Setting up a quick slot (the example only covers one, but there are four quick slots)
slot1 = Client.quickSlots[1]

--Change image
-- ex1
slot1.slotImage = "Icons/01.png"
-- ex2
slot1.SetSlotImage("Icons/05.png")

-- For more property values, see ScriptBaseControl (for default position values, see Layout Manager).
slot1.x = -297
slot1.y = -176
slot1.width = 50
slot1.height = 50

-- You can change the position, size, etc. of the icon in the skill slot (see ScriptBaseControl for more properties)
slot1.icon.x = -297

-- Set replacement slot
changeSlot = Client.changeSlot;

-- Change the replacement slot image
-- ex1
changeSlot.slotImage = "Icons/01.png"
-- ex2
changeSlot.SetSlotImage("Icons/05.png")

-- For more property values, see ScriptBaseControl (for default position values, see Layout Manager).
changeSlot.x = -297
changeSlot.y = -105
changeSlot.width = 70
changeSlot.height = 70

-- Change the position, size, etc. of the icon in the replacement slot (see ScriptBaseControl for more properties)
changeSlot.icon.x = -297
end
  • Adjusting the basic ScreenUI

-- If you set all values ​​to true or false, the values ​​will disappear from the screen.
ScreenUI.visible = false;

ScreenUI.hpBarVisible = false
ScreenUI.mpBarVisible = false
ScreenUI.levelVisible = false
ScreenUI.gameMoneyVisible = false
ScreenUI.bagVisible = false
ScreenUI.expBarVisible = false
ScreenUI.chatViewVisible = false
ScreenUI.chatInputVisible = false
ScreenUI.buffPanelVisible = false;
  • Output image file name

print(Client.GetImageName(Client.GetItem(0).imageID))

Last updated