Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- -- PasteRooms --
- -- Original Created by Just Does Games --
- -- !!!! WARNING !!! --
- -- TO BE ABLE TO RUN THIS MULTIPLE TIMES, TYPE PASTEBIN GET * * --
- -- IDK WHAT WILL HAPPEN IF YOU USE PASTEBIN RUN * --
- -- WISHLIST:
- -- Downloadable Rooms
- -- Collision Detection
- -- Map list and select Custom Background
- -- Multiplayer over Rednet
- -- No Display Shuttering
- -- Main Menu Centered to Screen
- -- Multiple Screen Support (Mobile and Monitors)
- -- Feel free to copy the code to work on it, or create your own. I just threw this code together just for the fun of it.
- -- Probably better off creating from scratch
- screenx,screeny = term.getSize() if screenx ~= 51 and screeny ~= 19 then error("51 by 19 only") end
- -- [ VARIABLES ] --
- player_x, player_y = 1,1
- menu_0 = {"Load My Room", "Edit my Room", "Exit App"}
- ctrl_menu = {"Exit Room", "Relocate"}
- c_menu = menu_0
- running = true menu = false selected = 1 currently = "MM"
- -- [ VARIABLES ] --
- -- [ FUNCTIONS ] --
- -- \/\/ Just Functions I already created previously \/\/ just ignore --
- using = function(a) shell.run(a) end use = function(a) shell.run(a) end s = function(a) sleep(a) end cls = function() shell.run("clear") end local console = function(a) print("CONSOLE : "..a) sleep(.001) end p = function(a) print(a) end w = function(a) write(a) end
- sw = function(a) textutils.slowWrite(a) end sp = function(a) textutils.slowPrint(a) end
- c = function(a) if term.isColor() == true then if a == 0 then term.setTextColor(colours.white) elseif a == 1 then term.setTextColor(colours.orange) elseif a == 2 then term.setTextColor(colours.magenta) elseif a == 3 then term.setTextColor(colours.lightBlue) elseif a == 4 then term.setTextColor(colours.yellow) elseif a == 5 then term.setTextColor(colours.lime) elseif a == 6 then term.setTextColor(colours.pink) elseif a == 7 then term.setTextColor(colours.grey) elseif a == 8 then term.setTextColor(colours.lightGrey) elseif a == 9 then term.setTextColor(colours.cyan) elseif a == "a" then term.setTextColor(colours.purple) elseif a == "b" then term.setTextColor(colours.blue) elseif a == "c" then term.setTextColor(colours.brown) elseif a == "d" then term.setTextColor(colours.green) elseif a == "e" then term.setTextColor(colours.red) elseif a == "f" then term.setTextColor(colours.black) elseif a == "red" then c("e") elseif a == "orange" then c(1) elseif a == "yellow" then c(4) elseif a == "green" then c("d") elseif a == "blue" then c("b") elseif a == "purple" then c("a") elseif a == "black" then c("f") elseif a == "white" then c(0) end end end tc = function() term.clear() end
- b = function(a) if term.isColor() == true then if a == 0 then term.setBackgroundColor(colours.white) elseif a == 1 then term.setBackgroundColor(colours.orange) elseif a == 2 then term.setBackgroundColor(colours.magenta) elseif a == 3 then term.setBackgroundColor(colours.lightBlue) elseif a == 4 then term.setBackgroundColor(colours.yellow) elseif a == 5 then term.setBackgroundColor(colours.lime) elseif a == 6 then term.setBackgroundColor(colours.pink) elseif a == 7 then term.setBackgroundColor(colours.grey) elseif a == 8 then term.setBackgroundColor(colours.lightGrey) elseif a == 9 then term.setBackgroundColor(colours.cyan) elseif a == "a" then term.setBackgroundColor(colours.purple) elseif a == "b" then term.setBackgroundColor(colours.blue) elseif a == "c" then term.setBackgroundColor(colours.brown) elseif a == "d" then term.setBackgroundColor(colours.green) elseif a == "e" then term.setBackgroundColor(colours.red) elseif a == "f" then term.setBackgroundColor(colours.black) elseif a == "red" then b("e") elseif a == "orange" then b(1) elseif a == "yellow" then b(4) elseif a == "green" then b("d") elseif a == "blue" then b("b") elseif a == "purple" then b("a") elseif a == "black" then b("f") elseif a == "white" then b(0) end end end cp = function(a,b) term.setCursorPos(a,b) end
- -- /\ Directions and Uses for Above /\
- -- cls() > shell.run("clear")
- -- s(a) > sleep(a)
- -- tc() > term.clear()
- -- p("example") > print("example")
- -- w("example") > write("example")
- -- sp("example") > texturils.slowPrint("example")
- -- sw("example") > textutils.slowWrite("example")
- -- c(a) > term.setTextColor(colours.a)
- -- b(a) > term.setBackgroundColor(colours.a)
- -- cp(a,b) > term.setCursorPos(a,b)
- -- use(a) > shell.run(a)
- -- its just a shout way of doing simple commands, like clearing the screen --
- loadroom = function(code, location) -- loads a room from pastebin or local files (your room most likely)
- if code == "local" then
- if fs.exists(location) == true and fs.getSize(location) <= 918 then
- loaded_room_name = location
- loaded_room = paintutils.loadImage(location)
- paintutils.drawImage(loaded_room, 1,1)
- end
- end
- end
- screen_update = function()
- cls()
- loadroom("local", loaded_room_name)
- cp(player_x,player_y)
- b("purple") write(" ")
- b("black") cp(1,19)
- if menu == true then
- for i=1, #ctrl_menu do
- if selected == i then
- c("yellow") w(ctrl_menu[i]) c("grey")
- else
- c(7) w(ctrl_menu[i]) c("grey")
- end
- w(" ")
- end
- else
- c("white") w("CRTL for MENU")
- end
- c("white") cp(player_x,19) w("^")
- cp(51,player_y) w("<")
- end
- -- [ FUNCTIONS ] --
- -- [ MISC ] --
- -- [ MISC ] --
- -- [ MAIN ] --
- use("cd /")
- if fs.exists("PasteRooms/mps/mp_1.nfp") == false then
- cls()
- c("white")
- b("black")
- w("Welcome to ")
- c("red") w("P") c("orange") w("a") c("yellow") w("s") c("green") w("t") c("blue") w("e") c("purple") w("R") c("red") w("o") c("orange") w("o") c("yellow") w("m") c("green") w("s") c("white") p("!")
- p("=========================")
- p("You will be put into the paint room to create your very first room!")
- p("")
- w("Rooms will be located here: ") c("yellow") p("Pasterooms/mps/mp_#.nfp") c("white")
- p("")
- p("Press Any key to Deny and Exit Application")
- p("Press 'ENTER' to confrim")
- s(2)
- cp(1,18)
- p("Awaiting Input...")
- a,i = os.pullEvent("key")
- if i ~= keys.enter then shell.run("clear") running = false else shell.run("paint PasteRooms/mps/mp_1.nfp") end
- end
- loadroom("local", "PasteRooms/mps/mp_1.nfp")
- if running == true then
- while running do
- if currently == "RM" then
- screen_update()
- a,i = os.pullEvent("key")
- if i == keys.w then
- --Go UP
- if player_y ~= 1 then
- player_y = player_y - 1
- end
- elseif i == keys.a then
- --Go LEFT
- if player_x ~= 1 then
- player_x = player_x - 1
- end
- elseif i == keys.s then
- --Go DOWN
- if player_y ~= 18 then
- player_y = player_y + 1
- end
- elseif i == keys.d then
- --Go RIGHT
- if player_x ~= 50 then
- player_x = player_x + 1
- end
- elseif i == keys.leftCtrl or i == keys.rightCtrl then
- if menu == true then
- menu = false
- else
- menu = true
- end
- elseif i == keys.left or i == keys.right or i == keys.enter or i == keys.e then
- if menu == true then
- if i == keys.left then
- if selected ~= 1 then selected = selected - 1 end
- elseif i == keys.right then
- if selected ~= #ctrl_menu then selected = selected + 1 end
- elseif i == keys.enter or i == keys.e then
- if selected == 1 then
- currently = "MM" selected = 1
- elseif selected == 2 then
- player_x,player_y = 1,1
- end
- menu = false selected = 1
- end
- end
- end
- elseif currently == "MM" then
- cls()
- loadroom("local", "PasteRooms/mps/mp_1.nfp")
- cp(1,1) b("black")
- for i=1, #c_menu do
- if selected == i then
- c("white") w("> ") c("yellow") w(c_menu[i]) c("white") p(" <")
- else
- c(7) p(c_menu[i])
- end c("white")
- end
- a,i = os.pullEvent("key")
- if i == keys.w or i == keys.up then
- if selected ~= 1 then selected = selected - 1 end
- elseif i == keys.s or i == keys.down then
- if selected ~= #c_menu then selected = selected + 1 end
- elseif i == keys.e or i == keys.enter then
- if selected == 1 then
- currently = "RM" selected = 1
- elseif selected == 2 then
- use("paint PasteRooms/mps/mp_1.nfp") selected = 1
- elseif selected == 3 then
- cls() running = false
- end
- end
- end
- end
- end
- -- [ MAIN ] --
Advertisement
Add Comment
Please, Sign In to add comment