Hi all!
Help make a light menu for ComputerCraft please. />
1
Help from the menu
Started by Ka6a400kg, Mar 18 2012 11:14 AM
7 replies to this topic
#1
Posted 18 March 2012 - 11:14 AM
#2
Posted 18 March 2012 - 11:49 AM
See this for some help on making a menu http://www.computerc...ua-cc-menu-how/
#3
Posted 18 March 2012 - 12:03 PM
i think i am going to write a tutorial about it. there certainly is a need for it />
#4
Posted 18 March 2012 - 01:13 PM
You can write the menu at least 6-choice? />
If you can please write. />
If you can please write. />
#5
Posted 18 March 2012 - 01:20 PM
function CUI(m) n=1 l=#m while true do term.clear() term.setCursorPos(1,2) for i=1, l, 1 do if i==n then print(i, " ["..m[i].."]") else print(i, " ", m[i]) end end print("Select a number[arrow up/arrow down]") a, b= os.pullEventRaw() if a == "key" then if b==200 and n>1 then n=n-1 end if b==208 and n<=l then n=n+1 end if b==28 then break end end end term.clear() term.setCursorPos(1,1) return n endsupply this code with a table (e.g. {"a","b"}) of options and it returns the number of the chosen one. I will feature it in a tutorial later on.
#6
Posted 18 March 2012 - 01:30 PM
/
#7
Posted 18 March 2012 - 10:50 PM
To give you something simple to start with you can make a simple menu like using print and if elseif statements..
print ("1) Option 1") print ("2) Option 2") print ("3) Option 3") print ("4) Option 4") print ("5) Option 5") print ("6) Option 6") print() write ("Enter your selection: ") local input = read() if read == 1 then -- do option 1 stuffs elseif read == 2 then -- do option 2 stuffs -- and so on.. else print ("invalid option selected") end
#8
Posted 19 March 2012 - 01:35 PM
Menu created liraal better because you choose the arrow up / down. />
1 user(s) are reading this topic
0 members, 1 guests, 0 anonymous users