Posted 18 February 2014 - 03:27 PM
I have created an api that allows you to create interactive text-based guis.
to get it run
I cannot explain it very well so I will put an example usage:
to get it run
pastebin get 1XX41eZ2 textgui
I cannot explain it very well so I will put an example usage:
-- this loads the api from file (change this to where you saved it)
os.loadAPI('textgui')
--this is the function that we pass to the runGui command to execute button actions if they do not take us to another window
function buttonPressed(s)
if s == "quit" then
-- this is the command to quit the gui
textgui.endGui()
end
end
-- this is the table which tells the api how to display the guy
local mopt = {
-- each window has a separate table with an id
[0] = {
-- each item in the window has an id and inside it's table it has the text which is displayed and the y position on the item
[1] = { "Window 1",3},
-- and item with a id of ~ fills the line with -
["~"] = 5,
-- when an item is clicked it will go to the window with the id of the id of the item unless the item's id is a string in which case
-- it will be handled by the function at the top which is passed to textgui.runGui
["quit"] = { "Quit",7}
},
-- this is another window that the Window 1 button goes to because the ids are the same
[1] = {
-- and this will take you back to the original window
[0] = {"Back",2}
},
}
textgui.runGui(mopt,buttonPressed)
Screenshots:Edited on 03 June 2014 - 07:08 PM