Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- --[[ /--- | /--\ /---- | | AAA PPPP III
- | | | | \_____ |____| A A P P I
- |-- | |--/ / | | AAAAA PPPP I
- | \---- \--- ---/ | | A A P III
- ]]--
- --Variables
- local answer = 0
- local result = true
- --Alias
- function calc(a1,a2,a3)
- calculator(a1,a2,a3)
- end
- function verCheck(a1)
- versionCheck(a1)
- end
- --Help
- function help( api )
- print("Usage:")
- result = "help"
- if api == nil then
- printError("flesh.help( api )")
- shell.exit()
- end
- if api == "openDoor" then
- printError("flesh.openDoor( side door is on or redstone is present. )")
- shell.exit()
- end
- if api == "close Door" then
- printError("flesh.closeDoor( side door is on or redstone is present. )")
- shell.exit()
- end
- if api == "killMe" then
- printError("flesh.killMe( screenX , screenY )")
- shell.exit()
- end
- if api == "calculator" or api == "calc" then
- printError("flesh.calc( first number , operator ( +,-,*,/; @ ) , second number")
- print("@: These are the only operators that you can use right now; I will be adding more in the future.")
- end
- return reslut
- end
- --APIs
- function pause( )
- print("Press enter to contunie")
- read()
- return result
- end
- function openDoor( side ) --Open door on a chosen side.
- if side ~= nil then
- result = side .. "rs.on"
- redstone.setOutput( side , true)
- return result
- else
- help("openDoor")
- end
- end
- function closeDoor( side ) --Close door on chosen side.
- if side ~= nil then
- result = side .. "rs.off"
- redstone.setOutput( side , false)
- return result
- else
- help("closeDoor")
- end
- end
- function killMe( screenX , screenY ) --Displays message saying "I'm gona kill you!" on the screen. You must define the screen placement, and it is up to you to clear the screen.
- if screenX ~= nil and screenY ~= nil then
- while scrtPass ~= "liar" do
- result = false
- term.setCursorPos( screenX , screenY )
- printError("I'm gona kill you!")
- scrtPass = read("")
- end
- result = true
- return result
- else
- help("killMe")
- end
- end
- function calculator( num_1 , operator , num_2 )
- if operator == "+" then
- answer = num_1 + num_2
- elseif operator == "-" then
- answer = num_1 - num_2
- elseif operator == "*" then
- answer = num_1 * num_2
- elseif operator == "/" then
- answer = num_1 / num_2
- elseif operator == nil or num_1 == nil or num_2 == nil then
- help("calculator")
- end
- if num_1 ~= nil and num_2 ~= nil and operator ~= nil then
- print( num_1 .. " " .. operator .. " " .. num_2 .. " = " .. answer )
- return answer
- end
- end
- function wrap(name,side)
- _G[name] = peripheral.wrap(side)
- end
- function getMethods(side)
- meths = peripheral.getMethods(side)
- for k,v in pairs(meths) do
- print(k..":"..v)
- end
- end
- function getTime()
- time = textutils.formatTime(os.time())
- return time
- end
- function versionCheck(required)
- version = tonumber(string.sub(os.version(),9))
- if version < required then
- return false
- end
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement