Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- local function explode(div,str)
- if (div=='') then return false end
- local pos,arr = 0,{}
- for st,sp in function() return string.find(str,div,pos,true) end do
- table.insert(arr,string.sub(str,pos,st-1))
- pos = sp + 1
- end
- table.insert(arr,string.sub(str,pos))
- return arr
- end
- game = {
- maxscore = 180,
- write = function(txt)
- local cx,cy = term.getCursorPos()
- local text = explode(" ",txt)
- for a = 1, #text do
- if cx+#text[a] > scr_x then
- term.setCursorPos(1,cy+1)
- end
- for b = 1, #text[a] do
- term.write(text[a]:sub(b,b))
- end
- cx, cy = term.getCursorPos()
- end
- end,
- print = function(txt)
- return game.write(txt.."\n")
- end,
- }
- funcread = function(repchar,rHistory,doFunc,noNewLine)
- local scr_x,scr_y = term.getSize()
- local sx,sy = term.getCursorPos()
- local cursor = 1
- local rCursor = #rHistory+1
- local output = ""
- term.setCursorBlink(true)
- while true do
- local evt,key = os.pullEvent()
- local cx,cy = term.getCursorPos()
- if evt == "key" then
- if key == keys.enter then
- if not noNewLine then
- write("\n")
- end
- term.setCursorBlink(false)
- return output
- elseif key == keys.left then
- if cursor-1 >= 1 then
- cursor = cursor - 1
- end
- elseif key == keys.right then
- if cursor <= #output then
- cursor = cursor + 1
- end
- elseif key == keys.up then
- if rCursor > 1 then
- rCursor = rCursor - 1
- term.setCursorPos(sx,sy)
- term.write((" "):rep(#output))
- output = rHistory[rCursor] or ""
- cursor = #output+1
- pleaseDoFunc = true
- end
- elseif key == keys.down then
- term.setCursorPos(sx,sy)
- term.write((" "):rep(#output))
- if rCursor < #rHistory then
- rCursor = rCursor + 1
- output = rHistory[rCursor] or ""
- cursor = #output+1
- pleaseDoFunc = true
- else
- rCursor = #rHistory+1
- output = ""
- cursor = 1
- end
- elseif key == keys.backspace then
- if cursor > 1 and #output > 0 then
- output = output:sub(1,cursor-2)..output:sub(cursor)
- cursor = cursor - 1
- pleaseDoFunc = true
- end
- elseif key == keys.delete then
- if #output:sub(cursor,cursor) == 1 then
- output = output:sub(1,cursor-1)..output:sub(cursor+1)
- pleaseDoFunc = true
- end
- end
- elseif evt == "char" or evt == "paste" then
- output = output:sub(1,cursor-1)..key..output:sub(cursor+(#key-1))
- cursor = cursor + #key
- pleaseDoFunc = true
- end
- if pleaseDoFunc then
- pleaseDoFunc = false
- if type(doFunc) == "function" then
- doFunc(output)
- end
- term.setCursorPos(sx,sy)
- local pOut = output
- if #output >= scr_x-(sx-2) then
- pOut = output:sub((#output+(sx))-scr_x)
- end
- if repchar then
- term.write(repchar:sub(1,1):rep(#pOut).." ")
- else
- term.write(pOut.." ")
- end
- local cx,cy = term.getCursorPos()
- end
- term.setCursorPos(sx+cursor-1,cy)
- end
- end
- gameoverflavor = {
- nopoints = "I can't believe you. On account of being clinically insane, you are hereby BANNED before you can kill anyone else with a club. How'd you even figure out how to start the game??",
- somepoints = "You had your chance, but you had to go and blow it. Newbie mistakes are allowed, but you're starting to become a nuisance, and I have no choice but to BAN you. Good day sir.",
- }
- cmdAlias = {
- sniff = {
- "sniff",
- "smell",
- "snuff",
- "nose",
- "snort",
- },
- eat = {
- "eat"
- "consume",
- "scarf",
- "nom",
- "bite",
- "dine",
- "sample",
- "taste",
- },
- lick = {
- "lick",
- "tongue",
- },
- touch = {
- "touch",
- "tap",
- "feel",
- },
- look = {
- "look",
- "see",
- "observe",
- "sight",
- "lookit",
- "where",
- },
- talk = {
- "talk",
- "speak",
- "blather",
- "blabber",
- "tell",
- "gab",
- "drawl",
- },
- yell = {
- "yell",
- "shout",
- "holler",
- "screech",
- "shriek",
- "hoopla",
- "hooplah",
- },
- kill = {
- "kill",
- "murder",
- "assassinate",
- "beat",
- "attack",
- "assault",
- "hit",
- "brutalize",
- "killinate",
- },
- punch = {
- "punch",
- "uppercut",
- "jab",
- "hook",
- "clobber",
- "deck",
- "bagoom",
- },
- kick = {
- "kick",
- "dropkick",
- "roundhousekick",
- "boot",
- "punt",
- },
- cut = {
- "cut",
- "slash",
- "slice",
- "slit",
- "cleave",
- },
- use = {
- "use",
- "activate",
- "utilize",
- "employ",
- "wield",
- },
- take = {
- "take",
- "steal",
- "get",
- "acquire",
- "obtain",
- "procure",
- },
- burn = {
- "burn",
- "burninate",
- "ignite",
- "combust",
- "inflame",
- "char",
- "blaze",
- "scorch",
- },
- me = {
- "me",
- "I",
- "myself",
- "self",
- "meself",
- "127.0.0.1",
- },
- sex = {
- "sex",
- "fornicate",
- "sodomize",
- "fuck",
- "do",
- "smex",
- "smexify",
- "rape",
- "grape",
- },
- }
- player = {
- points = 0,
- lives = 5,
- act = {
- die = function(condition)
- game.print(condition or "It didn't work out.")
- game.print(" YOU HAVE DIED.")
- game.print("Score: "..tostring(player.score).." out of a possible "..tostring(game.maxscore).." points.")
- if player.lives > 0 then
- game.print("Don't worry. Everyone makes mistakes. I'll give you another shot! Don't waste it.")
- player.lives = player.lives - 1
- else
- if player.points == 0 then
- game.print(gameoverflavors.nopoints)
- else
- game.print(gameoverflavors.somepoints)
- end
- stopgame()
- end
- end,
- },
- }
- items = {
- ["flower"] = {
- type = "item",
- licked = false,
- act = {
- sniff = function()
- game.logadd("It smells like sadness, which kinda smells like brine and cry'n.")
- end,
- eat = function()
- game.logadd("No, don't.")
- end,
- look = function()
- game.logadd("A red, thorny flower taken from your mother's grave. Stealing her flowers was probably what she would have wanted you to do.")
- end,
- lick = function()
- if items["flower"].licked then
- game.logadd("You're a sick fuck, you know that?")
- else
- game.logadd("What do you want me to say? It tastes like rosewater?")
- end
- items["flower"].licked = true
- end,
- touch = function()
- game.logadd("The flower feels like a flower. That's nice.")
- end
- talk = function()
- game.logadd("You know, talking to plants is a sign of insanity.")
- end,
- yell = function()
- game.logadd("Please don't shout at the plants. It's rude.")
- end,
- kill = function()
- game.logadd("This plant was already picked from the ground, you bastard.")
- end,
- punch = function()
- game.logadd("Who the hell goes around punching flowers?")
- end,
- kick = function()
- game.logadd("Don't step on the plant life.")
- end,
- cut = function()
- game.logadd("It's amazing you managed to keep this flower for so many years without shiving everybody you meet.")
- end,
- take = function()
- game.logadd("You already have the flower.")
- end,
- burn = function()
- game.logadd("The flower sees the light. But you decide against it.")
- end,
- fuck = function()
- game.logadd("Hands off the flower, Oedipus.")
- end,
- }
- },
- }
- rooms = {
- lyncks = {
- desc = "You stand in a boring-as-shit command prompt that seems to be a web browser...? It has full access to javascript, PHP, HTML, CSS, and more! Unlike this game.",
- exec = function() end, --executed upon entering a room
- paths = {
- {
- path = rooms.google,
- desc = "Right up north is Google.com.",
- look = "It shines brightly from your lowly fully-graphical shell that you totally have."
- },
- {
- path = rooms.spikeydeath,
- desc = "A horrible room of spikes is to your west.",
- look = "You don't even want to think about going in there.",
- },
- }
- items = {
- {
- obj = items.flower,
- desc = {
- name = "There is a flower", --there is a banana
- prepos = " on the floor.", -- in the washing machine.
- },
- cmd = { --special text when on a surface.
- look = function() game.logadd("What's the flower doing there? It has some deep sentimental value, so you must feel like an asshole leaving it on the crusty, text-based floor.") end
- eat = function() game.logadd("Stop grazing, you cow.") end
- lick = function() game.logadd("It's too far away for you to defile it.") end
- }
- reachable = true,
- },
- },
- },
- }
- logroom = function(room)
- local msg = room.desc or "This room is an enigma."
- for a = 1, #(room.items or {}) do
- msg = msg.." "..(room.items[a].desc.name)..(room.items[a].desc.prepos)
- end
- game.logadd(msg)
- if room.exec then room.exec() end
- end
- parser = function()
- while true do
- term.setCursorPos(1,scr_y-1)
- local message = explode(" ",read())
- end
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement