Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- --[[
- 2016 08 28 - Image Menu
- Visual interface for mice to choose an image.
- Commands
- =========================================================================
- msg Send a public chat message as [Funcorp] in orange text
- next Starts the next round
- Controls
- =========================================================================
- -
- Settings
- =========================================================================
- -
- ]]
- admins = {Yuir=true}
- imgList = {
- {"Normal Mouse", "153d331c6b9", 50, 48};
- {"Pink Cat", "153ec4eef26", 23, 30, "153ec4ec77d", 26, 30};
- {"Nekoburger", "153ec7e82d6", 23, 26, "153ec7e664b", 26, 26};
- {"Tabby", "154c592261e", 30, 32, "154c5925a15", 27, 32};
- {"Squirrel", "156d73b5b13", 21, 24, "156d738d5b1", 20, 24};
- {"Mouse", "155ca47030c", 36, 22, "155ca47179a", 37, 22};
- {"Toilet", "1507c256bcc", 23, 41, "1507c258fe8", 23, 41};
- {"Forto 01", "156d7850e4a", 35, 52, "156d785220e", 38, 52};
- {"Forto 02", "156d79470fe", 35, 52, "156d79489a6", 38, 52};
- {"Mario", "156d7dafb2d", 23, 30, "156d7db1184", 23, 30};
- {"Luigi", "156d7db2971", 23, 30, "156d7db3b85", 23, 30};
- {"Samus", "156d7c67e7b", 23, 30, "156d7c6c7d7", 23, 30};
- {"Mins", "156d76d5156", 23, 30, "156d76db6e3", 23, 30};
- {"troll2", "1507b1adc13", 25, 25};
- {"areyouserious", "1507b1b73d8", 25, 25};
- {"bplease", "1507b1b94f9", 25, 25};
- {"youdontsay", "1507b1b314f", 25, 25};
- {"ohno", "1507b1d17ef", 25, 25};
- {"itsnotok", "1507b1c5e8e", 25, 25};
- {"epicrage", "1507b1bfa13", 25, 25};
- {"challengeaccepted", "1507b1bb693", 25, 25};
- {"truestory", "1507b1aee88", 25, 25};
- {"lol", "1507b1ca194", 25, 25};
- {"what", "1507b1b20c3", 25, 25};
- {"betterthanexpected", "1507b1c0a9d", 25, 25};
- {"pffftch", "1507b1a6609", 25, 25};
- {"epic", "1507b1be8c3", 25, 25};
- {"foreveralone", "1507b1c1b6e", 25, 25};
- {"unimpressed", "1507b1aff31", 25, 25};
- {"okay", "1507b1d289c", 25, 25};
- {"areyoukiddingme", "1507b1b6340", 25, 25};
- {"notsureifmegusta", "1507b1cf647", 25, 25};
- {"derp", "1507b1bd80d", 25, 25};
- {"ilied", "1507b1c5e8e", 25, 25};
- {"sweetjesus", "1507b1acab8", 25, 25};
- {"nothingtodohere", "1507b1ce598", 25, 25};
- {"sadface", "1507b1aa996", 25, 25};
- {"pokerface2", "1507b1a8772", 25, 25};
- {"notbad", "1507b1cd4f2", 25, 25};
- {"yuno", "1507b1b4200", 25, 25};
- {"doge", "1507b1a432a", 30, 43, "1507b1a54a9", 30, 43};
- {"rage", "1507b1a98c7", 25, 25};
- {"motherofgod", "1507b1cc438", 25, 25};
- {"badass", "1507b1b0ffb", 25, 25};
- {"megusta", "1507b1cb245", 25, 25};
- {"listening", "1507b1c90c8", 25, 25};
- {"confident", "1507b1bc76c", 25, 25};
- {"suspicious", "1507b1aba24", 25, 25};
- {"likeasir", "1507b1c803d", 25, 25};
- {"cereal", "1507b1ba583", 25, 25};
- {"ohgodwhy", "1507b1d0768", 25, 25};
- {"happytroll", "1507b1c3d31", 25, 25};
- {"herp", "1507b1c4dcb", 25, 25};
- {"awwyeah", "1507b1b8475", 25, 25};
- {"pokerface", "1507b1a76d7", 25, 25};
- {"happyderp", "1507b1c2c6a", 25, 25};
- {"actually", "1507b1b52a7", 25, 25};
- }
- menuPages = math.ceil(#imgList/6)
- text = {}
- text.en = {
- welcome = "\n<VP>Welcome to the FunCorp room! Stats don't count here.\n"
- }
- text.es = {
- welcome = "\n<VP>¡Bienvenido a la sala FunCorp! Aquí no cuentan los stats.\n"
- }
- commands = {"msg","next"}
- keys = {0,2}
- _left = 0
- _right = 2
- imgData = {}
- facingLeft = {}
- imgId = {}
- mice = {}
- lang = text[tfm.get.room.community] or text.en
- function main()
- for _,c in pairs(commands) do
- system.disableChatCommandDisplay(c)
- end
- for name in pairs(tfm.get.room.playerList) do
- eventNewPlayer(name)
- tfm.exec.killPlayer(name)
- end
- end
- function eventNewGame()
- for n,mouse in pairs(mice) do
- facingLeft[n] = false
- updateImg(n)
- end
- end
- function eventNewPlayer(name)
- mice[name] = {
- menuPage = 1
- }
- for _,k in pairs(keys) do
- tfm.exec.bindKeyboard(name, k, true)
- end
- facingLeft[name] = false
- updateImg(name)
- tfm.exec.chatMessage(lang.welcome, name)
- --ui.addTextArea(0, "<p align='center'><font color='#010101'><a href='event:openMenu'>O</a></font></p>", nil, 780, 380, 16, 16, 0xff5880, 0xff00cc, 0.8, true)
- ui.addTextArea(0, "<p align='center'><font color='#010101'><a href='event:openMenu'>CLICK HERE</a></font></p>", nil, 714, 380, 82, 16, 0xff5880, 0xff00cc, 0.8, true)
- end
- function eventPlayerRespawn(name)
- facingLeft[name] = false
- updateImg(name)
- end
- function eventKeyboard(name, key, down, px, py)
- if key == _left then
- facingLeft[name] = true
- updateImg(name, true)
- elseif key == _right then
- facingLeft[name] = false
- updateImg(name, true)
- end
- end
- function updateImg(name, turning)
- local d = imgData[name]
- if not d then return end
- if not d[5] then
- if turning then return
- else
- facingLeft[name] = true
- end
- end
- if imgId[name] then tfm.exec.removeImage(imgId[name]) end
- local img,x,y
- if facingLeft[name] then
- img,x,y = d[2],d[3],d[4]
- else
- img,x,y = d[5],d[6],d[7]
- end
- imgId[name] = tfm.exec.addImage(img..".png", "%"..name, -x, -y, nil)
- end
- function eventChatCommand(name, mes)
- if admins[name] then
- if mes:sub(1,3) == "msg" then
- tfm.exec.chatMessage("<font color='#ff8547'>[FunCorp] "..mes:sub(5).."</font>", nil)
- elseif mes == "next" then
- tfm.exec.newGame()
- end
- end
- end
- function eventTextAreaCallback(id, name, cb)
- local mouse = mice[name]
- if id == 0 then
- if mouse.menuOpen then
- mouse.menuOpen = false
- closeMenu(name)
- else
- mouse.menuOpen = true
- openMenu(name)
- end
- elseif id == 2 and mouse.menuPage > 1 then
- mouse.menuPage = mouse.menuPage - 1
- openMenu(name)
- elseif id == 3 and mouse.menuPage < menuPages then
- mouse.menuPage = mouse.menuPage + 1
- openMenu(name)
- elseif id >= 10 and id <= 15 then
- local k = cb:sub(12) + 0
- if k == 1 then
- imgData[name] = nil
- tfm.exec.killPlayer(name)
- else
- imgData[name] = imgList[k]
- end
- updateImg(name)
- end
- end
- function openMenu(name)
- ui.addTextArea(1, "", name, 58, 44, 687, 110, 0x324650, 0x0, 0.4, true)
- ui.addTextArea(16, "<p align='center'><font color='#010101' size='32'> < </font></p>", name, 8, 80, 50, 50, 0x324650, 0x0, 0, true)
- ui.addTextArea(17, "<p align='center'><font color='#010101' size='32'> > </font></p>", name, 737, 80, 50, 50, 0x324650, 0x0, 0, true)
- ui.addTextArea(2, "<p align='center'><font size='32'><a href='event:prevPage'> < </a></font></p>", name, 6, 78, 50, 50, 0x324650, 0x0, 0, true)
- ui.addTextArea(3, "<p align='center'><font size='32'><a href='event:nextPage'> > </a></font></p>", name, 735, 78, 50, 50, 0x324650, 0x0, 0, true)
- local mouse = mice[name]
- local page = mouse.menuPage
- local menuImg = mouse.menuImg
- if menuImg then
- for i=1,6 do
- if menuImg[i] then tfm.exec.removeImage(menuImg[i]) end
- ui.removeTextArea(9+i, name)
- end
- else
- mouse.menuImg = {}
- menuImg = mouse.menuImg
- end
- for i=1,6 do
- local id = (page-1)*6 + i
- local data = imgList[id]
- if not data then break end
- local x1 = 63 + 115 * (i-1)
- ui.addTextArea(3+i, "", name, x1, 50, 100, 100, 0x324650, 0x0, 0.1, true)
- ui.addTextArea(9+i, "<p align='center'><a href='event:chooseImage"..id.."'>" .. data[1] .. "</a></p>\"", name, x1, 168, 100, 24, 0x324650, 0x0, 0.6, true)
- menuImg[i] = tfm.exec.addImage(data[2]..".png", "&10000", x1+50 - data[3], 100 - data[4], name)
- end
- end
- function closeMenu(name)
- local menuImg = mice[name].menuImg
- for i=1,6 do
- if menuImg[i] then tfm.exec.removeImage(menuImg[i]) end
- end
- for i=1,17 do
- ui.removeTextArea(i, name)
- end
- end
- main()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement