This is a read-only snapshot of the ComputerCraft forums, taken in April 2020.
Kristopher_Jones's profile picture

Scoreboard.

Started by Kristopher_Jones, 29 October 2015 - 09:20 AM
Kristopher_Jones #1
Posted 29 October 2015 - 10:20 AM
Hello, i made scoreboard for sport games. Check photos:

Spoiler
Spoiler
Spoiler

Spoiler
Spoilerhttp://www.bildites....gqlrlerdr00.png
Spoilerhttp://www.bildites....5d3ckjektrb.png


Ok, now you understand what i talking about. System are very simple, connect wired modem to bottom of computer and right side of monitor, connect with networking cable. Change in script monitor_2 to your monitor name. ( Change in 2 files: startup and m)
==Codes==
startup:
Spoilerlocal mon = peripheral.wrap('monitor_2')
mon.clear()
mon.setCursorPos(1,1)
mon.write("CA 70")
term.clear()
print("CA700 scoreboard system.")
sleep(2)
print("Loading data.")
sleep(2)
print("Reseting time lamp.")
rs.setOutput("right",true)
sleep(2)
print("Launching scoreboard.")
mon.clear()
mon.setTextColor(colors.black)
mon.setCursorPos(1,2)
mon.setTextScale(5)

rs.setOutput("right",false)
sleep(3)
rs.setOutput("right",false)
rs.setOutput("right",true)
term.clear()
term.setCursorPos(1,1)
print("CA700") –only need minutes
print("1-nos 2- t 3-p 4- arez 5- brez")
local mon = peripheral.wrap('monitor_2')
mon.clear()
mon.setCursorPos(1,1)
mon.setTextScale(3)
mon.write("VEF INZENIERU CENTRS")
mon.setBackgroundColor(colors.black)
mon.setTextColor(colors.white)
mon.setTextScale(5)

mon.setCursorPos(1,1)
mon.write("CA70")
mon.setCursorPos(8,3)

mon.write("1")

mon.setCursorPos(1,1)
mon.setTextScale(5)
mon.setCursorPos(7,5)
mon.write("–")
mon.setCursorPos(8,5)
mon.write(":")
mon.setCursorPos(9,5)
mon.write("–")

mon.setCursorPos(4,3)
mon.write("0")

mon.setCursorPos(13,3)
mon.write("0")
term.clear()

sleep(2)
shell.run("m")

And command m
Spoilerlocal mon = peripheral.wrap('monitor_2')
print("Tablo izveles iespējas")
local tSelections = {
"Default team names(HOME-GUEST)",
"Own team names",
"Home score",
"Guest score",
"Period",
"Scoreclock - time",
"Turn off scoreboard",
"Restart",
"FAQ",

}
local startYPos = 3
local startXPos = 5
local function startMenu( tMenu, sTitle )
– This function just prints the menu
local function printMenu( tMenu, sTitle, nSelected )
for index, text in pairs( tMenu ) do
term.setCursorPos( startXPos, startYPos + index - 1 )
write( (nSelected == index and '[' or ' ') .. text .. (nSelected == index and ']' or ' ') )
end
end


local selection = 1

while true do

printMenu( tMenu, sTitle, selection )
event, but = os.pullEvent("key")
if but == keys.up then
– Up
selection = selection - 1
elseif but == keys.down then
– Down
selection = selection + 1
elseif but == keys.enter then
– Enter
return tMenu[selection], selection – returns the text AND the number
end
selection = selection < 1 and #tMenu or selection > #tMenu and 1 or selection
end
end

term.clear()

sOption, nNumb = startMenu( tSelections ) – start the function … 'sOption' and 'nNumb'

term.clear()
term.setCursorPos(1, 1)

print(sOption)
print(nNumb)


if sOption == "Selection 1" then

shell.run("m")

mon.setCursorPos(1,1)
mon.write("HOME")
mon.setCursorPos(9,1)
mon.write("-")
mon.setCursorPos(11,1)
mon.write("GUEST")
elseif nNumb == 1 then


print("Done, returning to menu.")
mon.setCursorPos(1,1)
mon.write("HOME")
mon.setCursorPos(9,1)
mon.write("-")
mon.setCursorPos(11,1)
mon.write("GUEST")
sleep(2)
shell.run("m")
end



if sOption == "Selection 1" then

mon.write(input)
elseif nNumb == 2 then


print("Home team name")
write("-> ")
input = read()

mon.setCursorPos(1,1)
mon.write(input)
mon.setCursorPos(9,1)
mon.write("-")
print("Guest team name")
write("-> ")
input = read()

mon.setCursorPos(11,1)
mon.write(input)
print("Done, returning to menu.")
sleep(2)
shell.run("m")
end





if sOption == "Selection 1" then

elseif nNumb == 3 then

print("Home team score") –only need minutes
write("-> ")
input = read()
mon.setTextColor(colors.white)
mon.setCursorPos(4,3)
mon.write(input)
print("Done, returning to menu.")
sleep(2)
shell.run("m")
end


if sOption == "Selection 1" then

elseif nNumb == 4 then

print("Guest team score") –only need minutes
write("-> ")
input = read()
mon.setTextColor(colors.white)
mon.setCursorPos(13,3)
mon.write(input)
print("Done, returning to menu.")
sleep(2)
shell.run("m")
end

if sOption == "Selection 1" then

elseif nNumb == 5 then


print("Period") –only need minutes
write("-> ")
input = read()
mon.setTextColor(colors.white)
mon.setCursorPos(8,3)
mon.write(input)
print("Done, returning to menu.")

sleep(2)
shell.run("m")

end
if sOption == "Selection 1" then

elseif nNumb == 6 then

print("Set game time") –only need minutes
print("Minutes?") –only need minutes
write("-> ")
minute = tonumber(read()) –input directly as number(avoid string)
print("Seconds") –only need minutes
write("-> ")
sec = tonumber(read()) –input directly as number(avoid string)
local mon = peripheral.wrap('monitor_2')
local j = sec –declare seconds variable
local i = minute —declare minutes variable
min = i
sleep(1)
–Returning Results
mon.setTextScale(5)

mon.setCursorPos(7,5)
mon.write(min..":"..sec)

os.pullEvent("redstone")
if rs.getInput("left") then
rs.setOutput("right",false)
repeat
if i > 0 then
if j > 0 then
j = j - 1
else
j = 59
i = i - 1
end
else
if j > 0 then
j = j - 1
else
done = true
end
end
if j > 9 then
sec = j
else
sec = "0"..j
end
min = i
sleep(1)
if i < 10 then
mon.setCursorPos(11,5)
mon.write(".")
end
–Returning Results
mon.setTextScale(5)

mon.setCursorPos(7,5)
mon.write(min..":"..sec)

until j == 0 and i == 0

rs.setOutput("right",true) – trigger redstone output
sleep(1)

end
if i < 10 then
mon.setCursorPos(12,5)
mon.write(".")
end
































shell.run("m")
end
if sOption == "Selection 1" then

elseif nNumb == 7 then

mon.clear()
rs.setOutput("right",false)
term.clear()
mon.clear()
os.shutdown()
mon.clear()
end

if sOption == "Selection 1" then

elseif nNumb == 8 then

os.reboot()

end

if sOption == "Selection 1" then

elseif nNumb == 9 then
print("=== Time ===")
print("If you run a time, you can stop it only terminating program (ctrl + t) than run command m for menu.")
print("Time have input format: mm:ss")
print("Max time for scoreboard are: 9:59")
print("If you have .nil. error than restart your scoreboard.")

print("=== TEAM NAMES ===")
print("Number of letters: Home:8 Guest:6")
print("Number of letters: Home:8 Guest:6")

sleep(4)

shell.run("m")
end

If you have questions fell free to ask. This scoreboard are made by myself but used internet for examples.P.S. Redstone ar for green lamps, from hockey if time stands(not running) green lamp works, when goes lamp not working( still making).
Have nice day

Latvians can!
Edited on 29 October 2015 - 07:21 PM
Rougeminner #2
Posted 11 November 2015 - 08:43 AM
this could be a helpful tool it could be even better if mixed in the the /scoreboard system using the Command computer, do you mind if i do so? i have been looking for an easier project then learning how to use creators AI.
Kristopher_Jones #3
Posted 13 November 2015 - 10:17 PM
this could be a helpful tool it could be even better if mixed in the the /scoreboard system using the Command computer, do you mind if i do so? i have been looking for an easier project then learning how to use creators AI.
Good suggestion I will keep in mind.
AcidFlux #4
Posted 05 February 2016 - 02:09 PM
Hi there!

I really like the mod so far, however, I've run into some issues.

I'd really like to put it up on multiple monitors, and have implemented some code that I have found connected with your own questions in reference to the same. It seems to work for the Scoreboard initial sequence, but not the "m" command sequence.

Also, the timer just hangs whenever I enter in digits, after the "Seconds" entry. It will not respond, nor does the timer count down, and I have to terminate the program.

Edit : Figured out the countdown activation with the button on the side of the computer, but the program still freezes at that… can't back out to add score, or stop the timer!

Other than that, it works very well. I've got it in my own hockey rink. ^_^/>
Edited on 05 February 2016 - 11:15 PM
Kristopher_Jones #5
Posted 11 April 2016 - 06:32 PM
———————-Update v2.0 ————————


Changelog:
  • Added realization, like 88:88 on switch on.
  • Period not showing on turn-on, you can add manually period or
  • Add countdown to game. - While countdown are going on you period not appearing.
  • If you add game time you period will show up as default - 1.
  • For time stop still manuall - > ctrl + t then command: m
  • Added horn, redstone output ONLY on game time end, but not on game countdown.
  • Other functions.
Script: STARTUP
Spoiler

--Scoreboard system by Kristopher Jones
local monitors = {peripheral.find("monitor")} --# finding all of the monitors and putting them in a table
local mon = {} --# defining a table to store the functions we are about to create
for k,v in pairs(monitors[1]) do --# looping through the functions of the first monitor
  mon[k] = function(...) --# creates a new function in the mon table with the name k.  k is the name of one of the functions from the monitor we are looping through
	    for i = 1, #monitors do --# looping through all of the monitors in the monitors table
		  monitors[i][k](...) --# executing the original function for each monitor with the original arguments
	    end
  end
end
mon.setCursorPos(1,1)
mon.write("Home - Guest")
mon.setCursorPos(8,3)
mon.write(" ")
mon.setCursorPos(1,1)
mon.setTextScale(5)
mon.setCursorPos(7,5)
mon.setTextScale(5)
mon.write("88")													
mon.setCursorPos(8,5) 
mon.setTextScale(5)				
mon.write(":")											   
mon.setCursorPos(9,5)
mon.setTextScale(5)
mon.write("88")
mon.setCursorPos(4,3)
mon.setTextScale(5)
mon.write("88")
mon.setCursorPos(13,3)
mon.setTextScale(5)
mon.write("88")
rs.setOutput("top",true)
sleep(0.3)
rs.setOutput("top",false)
term.setCursorBlink(true)
term.setCursorBlink(false)
mon.setCursorPos(1,1)
term.clear()
print("CA700 scoreboard system.")
sleep(2)
print("Loading data.")
sleep(1)
print("Reseting time lamp.")
rs.setOutput("right",true)
sleep(1)
print("Launching scoreboard.")
mon.clear()
mon.setTextColor(colors.black)
mon.setCursorPos(1,2)
mon.setTextScale(5)
rs.setOutput("right",false)
sleep(3)
rs.setOutput("right",false)
rs.setOutput("right",true)
term.clear()
term.setCursorPos(1,1)
print("CA700") --only need minutes
print("1-nos 2- t 3-p 4- arez 5- brez")

mon.clear()
mon.setCursorPos(1,1)
mon.setTextScale(3)
mon.write("VEF INZENIERU CENTRS")
mon.setBackgroundColor(colors.black)
mon.setTextColor(colors.white)
mon.setTextScale(5)
sleep(1)
mon.setCursorPos(1,1)
mon.write("CA70")
mon.setCursorPos(8,3)
mon.write("")
mon.setCursorPos(4,3)
mon.setTextScale(5)
mon.write("0")
mon.setCursorPos(13,3)
mon.setTextScale(5)
mon.write("0")
term.clear()
rs.setOutput("right",true)
sleep(1)
shell.run("m")








COMMAND M

--Scoreboard system by Kristopher Jones

rs.setOutput("right",true)
local monitors = {peripheral.find("monitor")} --# finding all of the monitors and putting them in a table
local mon = {} --# defining a table to store the functions we are about to create
for k,v in pairs(monitors[1]) do --# looping through the functions of the first monitor
  mon[k] = function(...) --# creates a new function in the mon table with the name k.  k is the name of one of the functions from the monitor we are looping through
	    for i = 1, #monitors do --# looping through all of the monitors in the monitors table
		  monitors[i][k](...) --# executing the original function for each monitor with the original arguments
	    end
  end
end
print("Tablo izveles iespējas")
local tSelections = {
	    "Default team names(HOME-GUEST)",
	    "Own team names",
	    "Home score",
	    "Guest score",
	    "Period",
	    "Scoreclock - time",
	    "Countodown to game",
	    "Restart",
	    "FAQ",
	    "Clear all data from board",
	    "Changes",
	    "Turn off system",

}
local startYPos = 3
local startXPos = 5
local function startMenu( tMenu, sTitle )
	   
	    local function printMenu( tMenu, sTitle, nSelected )
			    for index, text in pairs( tMenu ) do
					    term.setCursorPos( startXPos, startYPos + index - 1 )
					    write( (nSelected == index and '[' or ' ') .. text .. (nSelected == index and ']' or ' ')  )
			    end
	    end
	   
	  
	    local selection = 1
	 
	    while true do
		 
			    printMenu( tMenu, sTitle, selection )
			    event, but = os.pullEvent("key")
			    if but == keys.up then
					    -- Up
					    selection = selection - 1
			    elseif but == keys.down then
					    -- Down
					    selection = selection + 1
			    elseif but == keys.enter then
					    -- Enter
					    return tMenu[selection], selection -- returns the text AND the number
			    end
			    selection = selection < 1 and #tMenu or selection > #tMenu and 1 or selection
	    end
end
term.clear()
sOption, nNumb = startMenu( tSelections ) -- start the function ... 'sOption' and 'nNumb'
term.clear()
term.setCursorPos(1, 1)
print(sOption)
print(nNumb)

if sOption == "Selection 1" then
shell.run("m")
mon.setCursorPos(1,1)
mon.write("HOME")
mon.setCursorPos(9,1)
mon.write("-")	
mon.setCursorPos(11,1)
mon.write("GUEST")
elseif nNumb == 1 then

print("Done, returning to menu.")
mon.setCursorPos(1,1)
mon.write("HOME")
mon.setCursorPos(9,1)
mon.write("-")	
mon.setCursorPos(11,1)
mon.write("GUEST")
sleep(1)
shell.run("m")
end

if sOption == "Selection 1" then
mon.write(input) 
elseif nNumb == 2 then

print("Home team name")
write("-> ")
input = read()
mon.setCursorPos(1,1)
mon.write(input)
mon.setCursorPos(9,1)
mon.write("-")	
print("Guest team name")
write("-> ")
input = read()
mon.setCursorPos(11,1)
mon.write(input) 
print("Done, returning to menu.")
sleep(2)
shell.run("m")
end

if sOption == "Selection 1" then
elseif nNumb == 3 then
print("Home team score") --only need minutes
write("-> ")
input = read()
mon.setTextColor(colors.white)
mon.setCursorPos(4,3)
mon.write(input)
print("Done, returning to menu.")
  sleep(2)
shell.run("m")				   
end

if sOption == "Selection 1" then
elseif nNumb == 4 then
print("Guest team score") --only need minutes
write("-> ")
input = read()
mon.setTextColor(colors.white)
mon.setCursorPos(13,3)
mon.write(input)   
print("Done, returning to menu.")					 
  sleep(2)
shell.run("m")				   
end
if sOption == "Selection 1" then
elseif nNumb == 5 then

print("Period") --only need minutes
write("-> ")
input = read()
mon.setTextColor(colors.white)
mon.setCursorPos(8,3)
mon.write(input)   
print("Done, returning to menu.")										

   sleep(2)
shell.run("m")					
					 
end

if sOption == "Selection 1" then
elseif nNumb == 7 then
rs.setOutput("right",true)
print("Set countdown to game") --only need minutes
print("Minutes?") --only need minutes
write("-> ")
minute = tonumber(read()) --input directly as number(avoid string)
print("Seconds") --only need minutes
write("-> ")
sec = tonumber(read()) --input directly as number(avoid string)
print("TIme added, press button to start countdown")

local j = sec   --declare seconds variable
local i = minute   ---declare minutes variable
min = i
	    sleep(2)
	    --Returning Results
	    mon.setTextScale(5)
	  
	    mon.setCursorPos(7,5)
	    mon.write(min..":"..sec)

    os.pullEvent("redstone")
    if rs.getInput("left") then
    rs.setOutput("right",true)  
repeat
	    if i > 0 then
			    if j > 0 then
					    j = j - 1
			    else
					    j = 59
					    i = i - 1
			    end
	    else
			    if j > 0 then
					    j = j - 1
			    else
					    done = true
			    end
	    end
	    if j > 9 then
			    sec = j
	    else
			    sec = "0"..j
	    end
	    min = i
	    sleep(1)

	    --Returning Results
	    mon.setTextScale(5)
	 
		 mon.setCursorPos(6,5)

	    mon.write(min..":"..sec.." ")
	    until j == 0 and  i == 0
mon.setCursorPos(8,3)
mon.write("1")
rs.setOutput("right",true)			 
sleep(1)
end

shell.run("m")				   
end






if sOption == "Selection 1" then
elseif nNumb == 6 then
rs.setOutput("right",true)
print("Set game time") --only need minutes
print("Minutes?") --only need minutes
write("-> ")
minute = tonumber(read()) --input directly as number(avoid string)
print("Seconds") --only need minutes
write("-> ")
sec = tonumber(read()) --input directly as number(avoid string)
print("Time added, press button to start countdown")
print("STOP TIME- ctrl + t then m ")
mon.setCursorPos(8,3)
mon.write("1") 
local j = sec   --declare seconds variable
local i = minute   ---declare minutes variable
min = i
	    sleep(1)
	    --Returning Results
	    mon.setTextScale(5)
	  
	    mon.setCursorPos(7,5)
	    mon.write(min..":"..sec)

    os.pullEvent("redstone")
    if rs.getInput("left") then
    rs.setOutput("right",false)
repeat
	   
	    if i > 0 then
			    if j > 0 then
					    j = j - 1
			    else
					    j = 59
					    i = i - 1
			    end
	    else
			    if j > 0 then
					    j = j - 1
			    else
					    done = true
			    end
	    end
	    if j > 9 then
			    sec = j
	    else
			    sec = "0"..j
	    end
	    min = i
	    sleep(1)
  if i < 10 then
mon.setCursorPos(11,5)
	    mon.write(".")
end
	    --Returning Results
	    mon.setTextScale(5)
	 
		 mon.setCursorPos(6,5)
	   
	    mon.write(min..":"..sec.." ")
	    until j == 0 and  i == 0
rs.setOutput("top",true)
rs.setOutput("right",true)  
sleep(2)
rs.setOutput("top",false) 
			 -- trigger redstone output
sleep(1)
end









			
   shell.run("m")				
end
if sOption == "Selection 1" then
elseif nNumb == 12 then

rs.setOutput("right",false)
sleep(2)
print("Finishing game...")
sleep(2)
term.clear()
sleep(3)
mon.clear()
os.shutdown()
mon.clear()				  
end
if sOption == "Selection 1" then
elseif nNumb == 8 then
os.reboot()
				  
end
if sOption == "Selection 1" then
elseif nNumb == 9 then
print("=== Time ===")
print("If you run a time, you can stop it only terminating program (ctrl + t) than run command m for menu.")
print("Time have input format: mm:ss")
print("Max time for scoreboard are: 9:59")
print("If you have .nil. error than restart your scoreboard.")
print("=== TEAM NAMES ===")
print("Number of letters: Home:8 Guest:6")
print("Number of letters: Home:8 Guest:6")
  sleep(4)
shell.run("m")				
end

if sOption == "Selection 1" then
elseif nNumb == 10 then
print("Data cleared!")
mon.clear()
sleep(2)
shell.run("m")				   
end
if sOption == "Selection 1" then
elseif nNumb == 11 then
print("CHANGES v1.2")
print("1) Fixed time counting")
print("2) Added countdown to game")
print("3) Added horn")
sleep(3)
shell.run("m")				   
end


Some photos of installations :


Edited on 12 June 2016 - 12:19 AM
Kristopher_Jones #6
Posted 12 April 2016 - 09:13 AM
Scoreboard sistem v2.1


Finally time can be stopped, if you stop the time computer goes to main menu, than if you need to set up time what are on board just tipe in.


Spoiler
--Scoreboard system by Kristopher Jones


rs.setOutput("right",true)

local monitors = {peripheral.find("monitor")} --# finding all of the monitors and putting them in a table
local mon = {} --# defining a table to store the functions we are about to create

for k,v in pairs(monitors[1]) do --# looping through the functions of the first monitor
  mon[k] = function(...) --# creates a new function in the mon table with the name k.  k is the name of one of the functions from the monitor we are looping through
        for i = 1, #monitors do --# looping through all of the monitors in the monitors table
          monitors[i][k](...) --# executing the original function for each monitor with the original arguments
        end
  end
end
print("Tablo izveles iespējas")
local tSelections = {
        "Default team names(HOME-GUEST)",
        "Own team names",
        "Home score",
        "Guest score",
        "Period",
        "Scoreclock - time",
        "Countodown to game",
        "Restart",
        "FAQ",
        "Clear all data from board",
        "Changes",
        "Turn off system",

}
local startYPos = 3
local startXPos = 5

local function startMenu( tMenu, sTitle )

        local function printMenu( tMenu, sTitle, nSelected )
                for index, text in pairs( tMenu ) do
                        term.setCursorPos( startXPos, startYPos + index - 1 )
                        write( (nSelected == index and '[' or ' ') .. text .. (nSelected == index and ']' or ' ')  )
                end
        end


        local selection = 1

        while true do

                printMenu( tMenu, sTitle, selection )
                event, but = os.pullEvent("key")
                if but == keys.up then
                        -- Up
                        selection = selection - 1
                elseif but == keys.down then
                        -- Down
                        selection = selection + 1
                elseif but == keys.enter then
                        -- Enter
                        return tMenu[selection], selection -- returns the text AND the number
                end
                selection = selection < 1 and #tMenu or selection > #tMenu and 1 or selection
        end
end

term.clear()

sOption, nNumb = startMenu( tSelections ) -- start the function ... 'sOption' and 'nNumb'

term.clear()
term.setCursorPos(1, 1)

print(sOption)
print(nNumb)


if sOption == "Selection 1" then

shell.run("m")

mon.setCursorPos(1,1)
mon.write("HOME") 
mon.setCursorPos(9,1)
mon.write("-")     
mon.setCursorPos(11,1)
mon.write("GUEST") 
elseif nNumb == 1 then


print("Done, returning to menu.")
mon.setCursorPos(1,1)
mon.write("HOME") 
mon.setCursorPos(9,1)
mon.write("-")     
mon.setCursorPos(11,1)
mon.write("GUEST") 
sleep(1)
shell.run("m") 
end



if sOption == "Selection 1" then

mon.write(input)  
elseif nNumb == 2 then


print("Home team name")
write("-> ")
input = read()

mon.setCursorPos(1,1)
mon.write(input)
mon.setCursorPos(9,1)
mon.write("-")     
print("Guest team name") 
write("-> ")
input = read()

mon.setCursorPos(11,1)
mon.write(input)  
print("Done, returning to menu.")
sleep(2)
shell.run("m")
end





if sOption == "Selection 1" then

elseif nNumb == 3 then

print("Home team score") --only need minutes
write("-> ")
input = read()
mon.setTextColor(colors.white)
mon.setCursorPos(4,3)
mon.write(input)
print("Done, returning to menu.") 
  sleep(2)
shell.run("m")                    
end


if sOption == "Selection 1" then

elseif nNumb == 4 then

print("Guest team score") --only need minutes
write("-> ")
input = read()
mon.setTextColor(colors.white)
mon.setCursorPos(13,3)
mon.write(input)    
print("Done, returning to menu.")                      
  sleep(2)
shell.run("m")                    
end

if sOption == "Selection 1" then

elseif nNumb == 5 then


print("Period") --only need minutes
write("-> ")
input = read()
mon.setTextColor(colors.white)
mon.setCursorPos(8,3)
mon.write(input)    
print("Done, returning to menu.")                                         

   sleep(2)
shell.run("m")                     

end


if sOption == "Selection 1" then

elseif nNumb == 7 then
    rs.setOutput("right",true) 
print("Set countdown time to  game") --only need minutes
print("Minutes?") --only need minutes
write("-> ")
minute = tonumber(read()) --input directly as number(avoid string)
print("Seconds") --only need minutes
write("-> ")
sec = tonumber(read()) --input directly as number(avoid string)
print("Time added, press button to start countdown")
print("For stop time press button  ")

local j = sec   --declare seconds variable
local i = minute   ---declare minutes variable
min = i
sleep(1)
--Returning Results
mon.setTextScale(5)

mon.setCursorPos(7,5)
mon.write(min..":"..sec)

while true do
    os.pullEvent("redstone")
    if rs.getInput("left") == true then
    repeat

        if i > 0 then
            if j > 0 then
                j = j - 1
            else
                j = 59
                i = i - 1
            end
        else
            if j > 0 then
                j = j - 1
            else
                done = true
            end
        end
        if j > 9 then
            sec = j
        else
            sec = "0"..j
        end
        min = i
        sleep(1)

        --Returning Results
        mon.setTextScale(5)
 if rs.getInput("left") == true then

 mon.setCursorPos(8,3)
mon.write("1")
mon.setCursorPos(6,5)

       mon.write("00:00")
   shell.run("m")
 end
        mon.setCursorPos(6,5)

       mon.write(min..":"..sec.." ")

until    j == 0 and  i == 0
mon.setCursorPos(8,3)
mon.write("1")
          shell.run("m") 
end







    rs.setOutput("top",true)
    rs.setOutput("right",true) 
    sleep(2)
    rs.setOutput("top",false)
    -- trigger redstone output
    sleep(1)

end



shell.run("m")                    
end

























if sOption == "Selection 1" then

elseif nNumb == 6 then





rs.setOutput("right",true)
 rs.setOutput("right",true) 
print("Set GAME time") --only need minutes
 mon.setCursorPos(8,3)
mon.write("1")
print("Minutes?") --only need minutes
write("-> ")
minute = tonumber(read()) --input directly as number(avoid string)
print("Seconds") --only need minutes
write("-> ")
sec = tonumber(read()) --input directly as number(avoid string)
print("Time added, press button to start countdown")
print("For stop time press button  ")

local j = sec   --declare seconds variable
local i = minute   ---declare minutes variable
min = i
sleep(1)
--Returning Results
mon.setTextScale(5)

mon.setCursorPos(7,5)
mon.write(min..":"..sec)

while true do
    os.pullEvent("redstone")
    if rs.getInput("left") == true then
    repeat

        if i > 0 then
            if j > 0 then
                j = j - 1
            else
                j = 59
                i = i - 1
            end
        else
            if j > 0 then
                j = j - 1
            else
                done = true
            end
        end
        if j > 9 then
            sec = j
        else
            sec = "0"..j
        end
        min = i
        sleep(1)

        --Returning Results
        mon.setTextScale(5)
 if rs.getInput("left") == true then



    rs.setOutput("right",true) 
    shell.run("m")
 end



mon.setCursorPos(7,5)
       mon.write(min..":"..sec.." ")

until    j == 0 and  i == 0

    rs.setOutput("right",true) 
   rs.setOutput("top",true) 
sleep(1)
rs.setOutput("top",false) 
          shell.run("m") 
end



end








shell.run("m")                    
end






























if sOption == "Selection 1" then

elseif nNumb == 12 then


rs.setOutput("right",false)
 sleep(2)
 print("Finishing game...")
 sleep(2)
term.clear()
sleep(3)
mon.clear()
os.shutdown()
mon.clear()                   
end

if sOption == "Selection 1" then

elseif nNumb == 8 then

os.reboot()

end

if sOption == "Selection 1" then

elseif nNumb == 9 then
print("=== Time ===")
print("If you run a time, you can stop it only terminating program (ctrl + t) than run command m for menu.")
print("Time have input format: mm:ss")
print("Max time for scoreboard are: 9:59")
print("If you have .nil. error than restart your scoreboard.")

print("=== TEAM NAMES ===")
print("Number of letters: Home:8 Guest:6")
print("Number of letters: Home:8 Guest:6")

  sleep(4)

shell.run("m")                 
end


if sOption == "Selection 1" then

elseif nNumb == 10 then
print("Data cleared!")
mon.clear()
 sleep(2)
shell.run("m")                    
end

if sOption == "Selection 1" then

elseif nNumb == 11 then
print("CHANGES v1.2")
print("1) Fixed time counting")
print("2) Added countdown to game")
print("3) Added horn")

 sleep(3)

shell.run("m")                    
end
Edited on 12 June 2016 - 12:19 AM
TNT_Nolan #7
Posted 03 June 2016 - 01:05 PM
Nobody likes fake loading times, it might look cool at first but its really stupid. Get rid of them, otherwise I like it.
unnamedcoder #8
Posted 11 June 2016 - 11:11 PM
This could be made so much more efficient, but I still like it, keep it up