Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- local function centerPrint(text,yPos)
- w, h = term.getSize()
- term.setCursorPos(math.floor(w - #text)/2, yPos)
- term.write(text)
- end
- local function slowcenterPrint(text,yPos,speed)
- w, h = term.getSize()
- term.setCursorPos(math.floor(w - #text)/2, yPos)
- textutils.slowWrite(text,speed)
- end
- term.setBackgroundColor(colors.white)
- term.setTextColor(colors.black)
- term.clear()
- os.pullEvent()
- slowcenterPrint("Hello",3,20)
- slowcenterPrint("This is the Mimic terminal",4,100)
- term.setTextColor(colors.red)
- centerPrint("Press any key to continue", 14)
- os.pullEvent()
- term.setBackgroundColor(colors.white)
- term.setTextColor(colors.black)
- term.clear()
- centerPrint("This is a demo of what the Mimic terminal",3)
- centerPrint("can do",4)
- sleep(0.4)
- term.setTextColor(colors.red)
- centerPrint("Press any key to continue", 14)
- os.pullEvent()
- term.setBackgroundColor(colors.white)
- term.setTextColor(colors.black)
- term.clear()
- centerPrint("To start off,",3)
- centerPrint("Mimic is a programmable website",4)
- centerPrint("that uses the coding language Lua",5)
- -- Copy this
- sleep(0.4)
- term.setTextColor(colors.red)
- centerPrint("Press any key to continue", 14)
- os.pullEvent()
- term.setBackgroundColor(colors.white)
- term.setTextColor(colors.black)
- term.clear()
- -- Copy this
- centerPrint("In Mimic, you can do things like change",3)
- term.setTextColor(colors.blue)
- centerPrint("the color of text",4)
- term.setTextColor(colors.black)
- centerPrint("You can also change",5)
- term.setBackgroundColor(colors.lime)
- centerPrint("the color of the background",6)
- sleep(0.4)
- term.setTextColor(colors.red)
- term.setBackgroundColor(colors.white)
- centerPrint("Press any key to continue", 14)
- os.pullEvent()
- term.setBackgroundColor(colors.white)
- term.setTextColor(colors.black)
- term.clear()
- centerPrint("You can also do complex mathematical functions",3)
- centerPrint("such as sine, cosine, and tangent",4)
- sleep(0.4)
- term.setTextColor(colors.red)
- term.setBackgroundColor(colors.white)
- centerPrint("Press any key to continue", 14)
- os.pullEvent()
- term.setBackgroundColor(colors.white)
- term.setTextColor(colors.black)
- term.clear()
- centerPrint("There are 5 values in Lua",3)
- centerPrint("Booleans, Strings, Numbers, Tables and Functions",4)
- centerPrint("A boolean is a true or false value",6)
- centerPrint("A string is a text value",8)
- centerPrint("A number is well a number value",10)
- centerPrint("A table is a set of values",12)
- centerPrint("A function is a keyword that runs code",14)
- sleep(0.4)
- term.setTextColor(colors.red)
- term.setBackgroundColor(colors.white)
- centerPrint("Press any key to continue", 17)
- os.pullEvent()
- term.setBackgroundColor(colors.white)
- term.setTextColor(colors.black)
- term.clear()
- centerPrint("Lets start off with some vocabulary",2)
- centerPrint("library : a large table filled with functions",4)
- centerPrint("Typically, a library is called an API",5)
- centerPrint("execute : to run one or more lines of code",7)
- centerPrint("arguments/parameters : info given to a function",9)
- centerPrint("Say you wanted a computer to write something",10)
- centerPrint("You would have to tell it what to write",11)
- centerPrint("That is what an argument or parameter is",12)
- centerPrint("It is commonly abbreviated as arg/param",13)
- sleep(0.4)
- term.setTextColor(colors.red)
- term.setBackgroundColor(colors.white)
- centerPrint("Press any key to continue", 15)
- os.pullEvent()
- term.setBackgroundColor(colors.white)
- term.setTextColor(colors.black)
- term.clear()
- centerPrint("This isn't a full lesson",3)
- centerPrint("Rather, it is a demonstration",4)
- centerPrint("So I will just get on with the demonstration",5)
- centerPrint("of what Mimic can do",6)
- sleep(0.4)
- term.setTextColor(colors.red)
- term.setBackgroundColor(colors.white)
- centerPrint("Press any key to continue", 15)
- os.pullEvent()
- term.setBackgroundColor(colors.white)
- term.setTextColor(colors.black)
- term.clear()
- paintutils.drawLine(2,3,50,3,colors.lightGray)
- term.setCursorPos(2,3)
- term.setTextColor(colors.black)
- term.setCursorPos(2,3)
- local text = read()
- repeat
- term.setCursorPos(math.random(1,51-#text),math.random(1,19))
- term.setBackgroundColor(2^math.random(1,15))
- term.setTextColor(2^math.random(1,15))
- term.write(text)
- os.startTimer(0.1)
- local event = os.pullEvent()
- until event ~= "timer"
- term.setBackgroundColor(colors.white)
- term.clear()
- term.setCursorPos(1,1)
- -- Rain prog starts here
- sleep(0.3)
- local rain = {}
- local maxX, maxY = term.getSize()
- function newrain()
- local axis = math.random(1,2) == 1 and true or false
- local template = {
- x = axis == true and math.random(1,maxX) or maxX,
- y = axis == false and math.random(1,maxY) or 1,
- color = colors.blue,
- velo = math.random(1,4) == 4 and 2 or 1
- }
- table.insert(rain,template)
- end
- function redraw(bool)
- term.setBackgroundColor(bool == true and colors.white or colors.black)
- term.clear()
- for i,v in ipairs(rain) do
- term.setCursorPos(v.x,v.y)
- term.setTextColor(v.color)
- term.write("/")
- v.x = v.x - v.velo
- v.y = v.y + v.velo
- if v.y > maxX or v.x < 1 then
- table.remove(rain,i)
- end
- end
- end
- local boolean
- local light = 0
- repeat
- for i=1,3 do
- newrain()
- end
- if boolean == true then
- light = light + 1
- if light == 5 then -- Display lightning for 5 ticks
- boolean = false
- light = 0
- end
- else
- boolean = math.random(1,100) == 1 and true or false -- If the number 1 gets chosen, it sets "boolean" to true
- if boolean == true and commands then
- commands.exec("playsound ambient.weather.thunder"..math.random(1,3).." @p")
- end
- end
- redraw(boolean)
- os.startTimer(0.01)
- if commands then
- commands.exec("playsound ambient.weather.rain @p")
- end
- local event = os.pullEvent()
- until event ~= "timer"
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement