Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- --[[
- Made by Kolten Viera aka "Spongy141"
- only may user edit "local passw"
- if modified, you mist give me credit.
- --]]
- --Game function
- local passw = ("password")
- function game()
- print("* Guess a Number Game *")
- math.randomseed( os.time() )
- repeat
- Trial = 1
- Number = math.random(100)
- print("Guess a Number 1-100")
- while true do
- print("Trial " .. Trial .. "?")
- Guess = io.read("*n")
- -- check end
- if Guess == Number then
- print("Correct")
- print("You Won!")
- break
- elseif Trial == 10 then
- print("You Lose!")
- print("The Number is "..Number)
- break
- end
- -- give hint
- if Guess < Number then
- print("Wrong")
- print("Try Larger Number")
- elseif Guess > Number then
- print("Wrong")
- print("Try Smaller Number")
- end
- Trial = Trial + 1
- end
- print("Do you want to Play again (y/n)?")
- more = io.read()
- until more ~= "y"
- main()
- end
- -- Commands are entered here.
- function main()
- while true do
- print("Command: ")
- local cmd = io.read()
- if cmd == "help" then
- print("Commands are: help, calculator, exit, date, game (WIP)")
- end
- if cmd == "calculator" then
- print("OK")
- calculate()
- end
- if cmd == "exit" then
- print("Bye master!")
- print(" ")
- print(" ")
- print(" ")
- print(" ")
- os.exit(0)
- end
- if cmd == "game" then
- game()
- end
- if cmd == "date" then
- print(os.date())
- end
- if cmd == "" then
- print("Not a command")
- end
- if cmd == " " then
- print("Not a command")
- end
- local gift = math.random(1000000000000)
- if cmd == gift then
- print("Holy crap... you are the worlds luckiest person.... well sadly there is no price")
- end
- end
- end
- -- The calculator
- function calculate()
- local x = io.read()
- print("math")
- local var = io.read()
- if var == "+" then
- if n == nil then
- local n = io.read()
- print(x.."+"..n.."="..x+n)
- main()
- end
- end
- if var == "*" then
- if n == nil then
- local n = io.read()
- print(x.."*"..n.."="..x*n)
- main()
- end
- end
- if var == "^" then
- if n == nil then
- local n = io.read()
- print(x.."^"..n.."="..x^n)
- main()
- end
- end
- if var == "-" then
- if n == nil then
- local n = io.read()
- print(x.."-"..n.."="..x-n)
- main()
- end
- end
- if var == "/" then
- if n == nil then
- local n = io.read()
- print(x.."/"..n.."="..x/n)
- main()
- end
- end
- if var == "of" then
- if n == nil then
- local n = io.read()
- print(n.." is "..n/x.." of "..x)
- main()
- end
- end
- if var == "compare" then
- if n == nil then
- local n = io.read()
- if n>x then
- print(x.." is less than "..n)
- elseif n<x then
- print(x.." is greater than "..n)
- end
- end
- end
- end
- -- Password section
- print("Personal Assistant v1.1")
- print("===================")
- print("Password")
- local pass = io.read()
- if pass == passw then
- print(" ")
- print(" ")
- print(" ")
- print(" ")
- print(" ")
- print(" ")
- print(" ")
- print(" ")
- print(" ")
- print(" ")
- print(" ")
- print(" ")
- print(" ")
- print(" ")
- print(" ")
- print("For help type help")
- main()
- else -- if the password is wrong.
- print("Inncorrect password!")
- print(" ")
- print(" ")
- os.exit()
- end
Advertisement
Add Comment
Please, Sign In to add comment