GUI Compendium

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

Moderator: Plugin Moderators

Eiyu
Settler
Reactions:
Posts: 4
Joined: Tue Jan 12, 2021 0:51

Re: GUI Compendium

#21

Post by Eiyu »

thank’s i used it for this:

Code: Select all

  local function text()
  	local iconFrame=Draft.getDraft('$pickle_kets_icon'):getFrame()
  local dialog = GUI.createDialog{
    icon = iconFrame,   -- Icon of the dialog
    title = 'Ket Options',        -- Title of the dialog
			    text = 'Here are the ket ontions{Other[*send a gift to pickle(50 kets)tiping kets(10)]Geting kets[*Buy 15 kets for 20 theos]seveces[*fire deparment28 coses 30 kets]buying rockets[*get Pmars for 5000 kets*get Trocket for 900 kets*get a shuttle for 1,000,000 kets]}On the text feld enter your command.',          
    width = 300,            
    height = 180,          
    closeable = true,       
    pause = false,           
    onUpdate = function() end,   
    onCancel = function() end,  
    onClose = function() end,
    actions = {
      
      {
        id = '$cmdOk',  
        icon = Icon.PLUS,     
        text = "Done",      
        onClick = function() end,
        golden = false
      }
    }
  }
  
local parent = dialog.controls:getFirstPart()

local textField = parent:addTextField{
  text = 'Enter Command',
  height = 30,
  width = 200
}
textField:setText('')
textField:getChild(1):setColor(255,0,255)
end


function script:buildCityGUI()
	--Debug.toast('In buildCityGUI in Kets.lua')
	--Debug.toast('Hi Charles!')
	local iconFrame=Draft.getDraft('$pickle_kets_icon'):getFrame()
	local budget = GUI.get('cmdBudget')
	local bottomBar = budget:getParent()
	local width = budget:getWidth()
	local height = budget:getHeight()
	local button=bottomBar:getCenterPart():addButton{
		width=width,
		height=height,
		icon=iconFrame,
		text='Ket options',
		golden=true,
		--frameDefault=Icon.NP_BLUE_BUTTON,
		onClick=function(self)
			-- Debug.toast('clicked')
			text()
		end
	}
end
Note from Bearbear76: You can use the code tag for code. It look prettier doesn't it? :)

Jeremiah Stephens
Inhabitant of a Megacity
Reactions:
Posts: 208
Joined: Thu Jan 30, 2020 16:56
Plugins: Show

Platform

Plugin Creator

Re: GUI Compendium

#22

Post by Jeremiah Stephens »

Lobby wrote:
Thu Dec 03, 2020 23:29
Yeah, you would have to implement your own dialog or try to add a GUI object that covers it and draws something else. An easier option would probably be to use privileged placing features to change look of dialogs in general.
What do you mean about privileged placing features?
Check out my TheoTown YouTube videos (and subscribe): https://www.youtube.com/playlist?list=P ... wCvFdgyiTk
Show
Warning: do not tap or click "Show"
Just kidding, join my discord server: http://discord.gg/hA5EVazhCC

User avatar
opschnecke
Settler
Reactions:
Posts: 2
Joined: Mon Oct 12, 2020 13:14

Plugin Creator

Platform

Re: GUI Compendium

#23

Post by opschnecke »

Can i Use own pictures as for example Button Icons? :lua:

Code: Select all    Reset

function local(lua+json) Globalvar:{ lang({"main":"German","reserve_1":"English","reserve_2":"French")} } end
Interactive Lua editor
Run

Post Reply Previous topicNext topic

Return to “Lua Scripting”