mirror of
https://github.com/SquidDev-CC/CC-Tweaked
synced 2025-04-25 20:23:22 +00:00
parent
f194f4fa3a
commit
d2a1a00dc4
@ -1 +1,6 @@
|
|||||||
clear clears the screen.
|
clear clears the screen and/or resets the palette.
|
||||||
|
ex:
|
||||||
|
"clear" clears the screen, but keeps the palette.
|
||||||
|
"clear screen" does the same as "clear"
|
||||||
|
"clear palette" resets the palette, but doesn't clear the screen
|
||||||
|
"clear all" clears the screen and resets the palette
|
||||||
|
@ -1,2 +1,33 @@
|
|||||||
term.clear()
|
local tArgs = { ... }
|
||||||
term.setCursorPos(1, 1)
|
|
||||||
|
local function printUsage()
|
||||||
|
local programName = arg[0] or fs.getName(shell.getRunningProgram())
|
||||||
|
print("Usages:")
|
||||||
|
print(programName)
|
||||||
|
print(programName .. " screen")
|
||||||
|
print(programName .. " palette")
|
||||||
|
print(programName .. " all")
|
||||||
|
end
|
||||||
|
|
||||||
|
local function clear()
|
||||||
|
term.clear()
|
||||||
|
term.setCursorPos(1, 1)
|
||||||
|
end
|
||||||
|
|
||||||
|
local function resetPalette()
|
||||||
|
for i = 0, 15 do
|
||||||
|
term.setPaletteColour(math.pow(2, i), term.nativePaletteColour(math.pow(2, i)))
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
local sCommand = tArgs[1] or "screen"
|
||||||
|
if sCommand == "screen" then
|
||||||
|
clear()
|
||||||
|
elseif sCommand == "palette" then
|
||||||
|
resetPalette()
|
||||||
|
elseif sCommand == "all" then
|
||||||
|
clear()
|
||||||
|
resetPalette()
|
||||||
|
else
|
||||||
|
printUsage()
|
||||||
|
end
|
||||||
|
@ -49,6 +49,7 @@ end
|
|||||||
|
|
||||||
shell.setCompletionFunction("rom/programs/alias.lua", completion.build(nil, completion.program))
|
shell.setCompletionFunction("rom/programs/alias.lua", completion.build(nil, completion.program))
|
||||||
shell.setCompletionFunction("rom/programs/cd.lua", completion.build(completion.dir))
|
shell.setCompletionFunction("rom/programs/cd.lua", completion.build(completion.dir))
|
||||||
|
shell.setCompletionFunction("rom/programs/clear.lua", completion.build({ completion.choice, { "screen", "palette", "all" } }))
|
||||||
shell.setCompletionFunction("rom/programs/copy.lua", completion.build(
|
shell.setCompletionFunction("rom/programs/copy.lua", completion.build(
|
||||||
{ completion.dirOrFile, true },
|
{ completion.dirOrFile, true },
|
||||||
completion.dirOrFile
|
completion.dirOrFile
|
||||||
|
Loading…
x
Reference in New Issue
Block a user