GUI example in Plugin Creator Tools

The Lua scripting language allows you to give your plugin more advanced features.

Moderators: Plugin Moderators, Scenario Moderators

User avatar
Lobby
Developer
Posts: 3719
Joined: 26 Oct 2008, 12:34
Plugins: Showcase Store
Version: Beta

Platform

GUI example in Plugin Creator Tools

#1

Post by Lobby »

image.png
The Plugin Creator Tool contains an example to present the GUI creation possibilities of using Lua in plugins.


image.png
Actually useful is this window that shows the Icon, Font and NinePatch resources that are available within the game. A tap on the "copy" button copies the code used to access something into the clipboard, e.g. "Icon.OK" for the ok icon.



Here you can see how various aspects of this tool were implemented :lua: :

Code: Select all    Reset

-- Show the menu with the close action closing the provided dialog
local function showMenu(dialog)
local parent = GUI.get'$menuparent'
GUI.createMenu{
source = parent,
actions = {
{icon = Icon.OK, text = 'A', onClick = function() Debug.toast('yo') end},
{icon = Icon.CANCEL, text = 'B', enabled = false},
{},
{icon = Icon.CLOSE, text = 'Close', onClick = dialog.close}
}
}
end
-- Show the dialog window that contains various GUI object usage examples
local function showObjectsDialog()
local dialog = GUI.createDialog{
icon = Icon.REGION_SPLIT,
title = 'Objects',
height = 240
}
local layout = dialog.content:addLayout{
vertical = true
}
local function addLine(label, height)
local line = layout:addLayout{height = height}
line:addLabel{text = label, w = 60}
return line:addLayout{ x = 62 }
end
local sliderValue = 0.5
 
הההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההה
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
Lua editor

Output: Select all

...


Here the plugin is of type tool and uses real-time scripting for testing purposes :json :

Code: Select all    Reset

[{
"once":true,
"id":"$devtool_showguiexample00",
"type":"tool",
"category":"$devtool_category00",
"preview frames":[{"bmp":"guiicon.png"}],
"title":"GUI preview",
"text":"This tool provides an example for what can be done in regard to UI using Lua.",
"script":"#LuaWrapper",
"meta":{
"luawrapper":{
"script":"GUIExample.lua",
"dev":true
}
}
}]
הההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההה
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
JSON checker

Output: Select all

...

User avatar
MarioBitMap
Villager
Posts: 16
Joined: 31 Jul 2020, 22:54
Location: Spain
Plugins: Showcase Store
Version: Beta

Plugin Creator

Platform

Re: GUI example in Plugin Creator Tools

#2

Post by MarioBitMap »

AMAZING!! I'd love trying to do a plug-in with some menus when I learn a little bit of complex Lua. :teach

User avatar
Hadestia
Inhabitant of a Megalopolis
Posts: 727
Joined: 17 Jul 2017, 16:16
Location: Philippines
Plugins: Showcase Store
Contact:

Plugin Creator

Platform

Re: GUI example in Plugin Creator Tools

#3

Post by Hadestia »

Can we use gui on building taps? As substitute to the onClick notif or its info itself

Post Reply Previous topicNext topic

Return to “Lua Scripting”