--[[ 2018 09 16 - 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 = {Peanut_butter=true} imgList = { {"Normal Mouse", "153d331c6b9", 50, 48}; {"Pixel 1", "165965055b2", 25, 34, "165965055b2", 25, 34}; {"Pixel 2", "1659658dc8f", 25, 30, "1659658dc8f", 25, 30}; {"Pixel 3", "165966b6346", 25, 30, "165966b6346", 25, 30}; {"Pixel 4", "165966cc2db", 25, 30, "165966cc2db", 25, 30}; {"Pixel 5", "165966d9a68", 25, 30, "165966d9a68", 25, 30}; {"Pixel 6", "165966f86f6", 25, 30, "165966f86f6", 25, 30}; {"Pixel 7", "16596700568", 25, 30, "16596700568", 25, 33}; {"Pixel 8", "165967088be", 25, 30, "165967088be", 25, 30}; {"Pixel 9", "1659671b6fb", 25, 30, "1659671b6fb", 25, 30}; {"Pixel 10", "16596720dd2", 25, 34, "16596720dd2", 25, 34}; {"Pixel 11", "1659672d821", 25, 30, "1659672d821", 25, 30}; {"Pixel 12", "16596736237", 25, 30, "16596736237", 25, 30}; {"Pixel 13", " 1659673b8d5", 25, 30}; {"Pixel 14", "16596740a8f", 25, 34}; {"Pixel 15", "16596746e71", 25, 34}; {"Stripper Horse", "165df07c053", 36, 70, "165df038d30", 36, 70}; {"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}; {"Peppa Pig", "155777ce1ab", 30, 40, "155777cc660", 30, 40}; {"Waddles", "155c51325da", 25, 30, "155c5133917", 25, 30}; {"Dora", "155c4d1de05", 25, 40, "155c4d1f100", 25, 40}; {"Mouse", "155ca47030c", 36, 22, "155ca47179a", 37, 22}; {"Toilet", "1507c256bcc", 23, 41, "1507c258fe8", 23, 41}; {"Forto 1", "156d7850e4a", 35, 52, "156d785220e", 38, 52}; {"Forto 2", "156d79470fe", 35, 52, "156d79489a6", 38, 52}; {"Mario", "156d7dafb2d", 23, 34, "156d7db1184", 23, 34}; {"Luigi", "156d7db2971", 23, 34, "156d7db3b85", 23, 34}; {"Samus", "156d7c67e7b", 23, 33, "156d7c6c7d7", 23, 33}; {"Mins", "156d76d5156", 23, 33, "156d76db6e3", 23, 33}; {"Doge", "1507b1a432a", 30, 43, "1507b1a54a9", 30, 43}; {"WOAH CAT", "15565dbc655", 25, 25}; {"Grumpy Cat", "15565dc7ac4", 25, 25}; {"Pepe 1", "15568257ca1", 20, 25}; {"Pepe 2", "15568256a3c", 20, 25}; {"Pepe 3", "1557c249008", 20, 25}; {"Pepe 4", "15568255720", 20, 25}; {"Pepe 5", "15568252932", 20, 25}; {"Pepe 6", "155682514c1", 20, 25}; {"Pepe 7", "1556824d1cd", 20, 25}; {"Trump", "1556848676b", 20, 30}; {"Putin", "15568377e1b", 20, 30}; {"Obama", "15568487b96", 20, 30}; {"HIS NAME IS", "1556848a816", 20, 35}; {"Bieber", "155ca086a04", 25, 40}; {"Trollface", "1507b1adc13", 25, 25}; {"Are you serious", "1507b1b73d8", 25, 30}; {"Please", "1507b1b94f9", 25, 30}; {"You don't say", "1507b1b314f", 25, 30}; {"Oh no", "1507b1d17ef", 25, 30}; {"Mwahaha", "1507b1c5e8e", 25, 30}; {"Epic Rage", "1507b1bfa13", 25, 30}; {"Challenge Accepted", "1507b1bb693", 25, 30}; {"True Story", "1507b1aee88", 25, 30}; {"LOL", "1507b1ca194", 25, 30}; {"What", "1507b1b20c3", 25, 30}; {"Nice", "1507b1c0a9d", 25, 30}; {"Pffftch", "1507b1a6609", 25, 30}; {"Epic", "1507b1be8c3", 25, 30}; {"Forever Alone", "1507b1c1b6e", 25, 30}; {"Unimpressed", "1507b1aff31", 25, 30}; {"Okay", "1507b1d289c", 25, 30}; {"Are You Kidding Me", "1507b1b6340", 25, 30}; {"Me Not Gusta", "1507b1cf647", 25, 30}; {"Derp", "1507b1bd80d", 25, 30}; {"Yaaaaas", "1507b1acab8", 25, 30}; {"Goodbye", "1507b1ce598", 25, 30}; {"Sad Face", "1507b1aa996", 25, 30}; {"Poker Face", "1507b1a8772", 25, 30}; {"Not Bad", "1507b1cd4f2", 25, 30}; {"Y U NO", "1507b1b4200", 25, 30}; {"Rage", "1507b1a98c7", 25, 25}; {"What the duck", "1507b1cc438", 25, 25}; {"Wow OK", "1507b1b0ffb", 25, 25}; {"Me Guta", "1507b1cb245", 25, 25}; {"Listening", "1507b1c90c8", 25, 25}; {"Confident", "1507b1bc76c", 25, 25}; {"Suspicious", "1507b1aba24", 25, 25}; {"Like a Sir", "1507b1c803d", 25, 25}; {"Cereal", "1507b1ba583", 25, 25}; {"Oh God Why", "1507b1d0768", 25, 25}; {"Happy Troll", "1507b1c3d31", 25, 25}; {"Herp", "1507b1c4dcb", 25, 25}; {"Awwww Yeah", "1507b1b8475", 25, 25}; {"Poker Face", "1507b1a76d7", 25, 25}; {"Happy Derp", "1507b1c2c6a", 25, 25}; {"Actually", "1507b1b52a7", 25, 25}; } menuPages = math.ceil(#imgList/6) text = {} text.en = { welcome = "\nWelcome to the FunCorp room! Stats don't count here.\n" } text.es = { welcome = "\n¡Bienvenido a la sala FunCorp! Aquí no cuentan los stats.\n" } text.hu = { welcome = "\nÜdv a FunCorp szobában! Itt nem tudsz sajtot szerezni.\n" } text.it = { welcome = "\nBenvenuto in una stanza FunCorp! Le statistiche non contano qui.\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 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 openMenu(name) ui.addTextArea(1, "", name, 58, 44, 687, 110, 0x324650, 0x0, 0.4, true) ui.addTextArea(16, "

<

", name, 8, 80, 50, 50, 0x324650, 0x0, 0, true) ui.addTextArea(17, "

>

", name, 737, 80, 50, 50, 0x324650, 0x0, 0, true) ui.addTextArea(2, "

<

", name, 6, 78, 50, 50, 0x324650, 0x0, 0, true) ui.addTextArea(3, "

>

", 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, "

" .. data[1] .. "

\"", 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 for _,f in next,{"AutoShaman","AutoScore","AutoNewGame","AutoTimeLeft","AutoScore","PhysicalConsumables","DebugCommand","MinimalistMode"} do tfm.exec["disable"..f](true) end for _,g in next,{"p","rank","help"} do system.disableChatCommandDisplay(g,true) end sudden=false powerups=true winner="" data={} players_table={} increase=0 intensity=40 mices=0 remain=10 last_win="" times=1; enabled=false function split(t,s) local a={} for i,v in string.gmatch(t,string.format("[^%s]+",s or "%s")) do table.insert(a,i) end return a end function eventRanking(name) local sc = {} for id, name in pairs(players_table) do sc[#sc+1] = {n=name,s=data[name].score,f=data[name].wins} end table.sort(sc,function(a,b) return a.s>b.s end) str1 = '' str2 = '' str3 = '' for k,v in pairs(sc) do if k < 11 then if str ~= '' then str1=str1.."
"..k.."° | "..v.n.."" str2=str2.."
"..v.s.."" str3=str3.."
"..v.f.."" else str1=""..k.."° | "..v.n.."" str2=""..v.s.."" str3=""..v.f.."" end end end ui.addTextArea(8000,'

Temporary Ranking',name,100,100,500,30,nil,0x2e424d,nil,true) ui.addTextArea(8001,"# Name Score Wins",name,110,110,480,20,0x0e232b,0x0e232b,nil,true) ui.addTextArea(8002,""..str1,name,110,130,480,220,0x0e232b,0x0e232b,nil,true) ui.addTextArea(8003,"

"..str2,name,400,130,60,220,0x0e232b,0x0e232b,nil,true) ui.addTextArea(8004,"

"..str3,name,485,130,60,220,0x0e232b,0x0e232b,nil,true) ui.addTextArea(8006,"

Close",name,300,350,210,20,0x3c5063,0x3c5063,nil,true) end function eventChatCommand(name,message) local arg = split(message, " ") if arg[1] == "p" then if arg[2] then nome = arg[2]:lower():gsub('%a', string.upper, 1) else nome = name end if tfm.get.room.playerList[nome] then ui.addTextArea(8003,'

'..nome,name,245,95,315,30,nil,0x2e424d,nil,true) ui.addTextArea(8004,"Score: "..data[nome].score.."

Wins: "..data[nome].wins.."
Matches: "..data[nome].matches.."",name,255,125,290,90,0x0e232b,0x0e232b,nil,true) ui.addTextArea(8005,"

Close",name,255,210,290,20,0x3c5063,0x3c5063,nil,true) else tfm.exec.chatMessage("Function not allowed",name) end end if message == "rank" then eventRanking(name) end if message == "help" then ui.addTextArea(9000,"

Help",name,100,90,600,30,nil,0x2e424d,nil,true) ui.addTextArea(9005,"The objetive of this module is kill the other players using the mouse to generate spirits.

At moment, 3 powerups are available:
F1 = Fast Spirits
F2 = Double Power
F3 = Box Meteor

Module made by Jessiewind26#2546 and Camilledrain#0000",name,150,125,500,165,0x0e232b,0x0e232b,nil,true) ui.addTextArea(9006,"Close",name,300,297,190,20,0x3c5063,0x3c5063,nil,true) end end mice={} 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, "

O

", nil, 780, 380, 16, 16, 0xff5880, 0xff00cc, 0.8, true) ui.addTextArea(0, "

CLICK HERE

", nil, 714, 380, 82, 16, 0xff5880, 0xff00cc, 0.8, true) system.bindMouse(name) if not data[name] then table.insert(players_table,name) data[name]={time=0,matches=0,wins=0,score=0,p1=false,p2=false,pcount=0} end ui.addTextArea(299,"

Menu",name,365,376,70,24,0x000001,0x000001,0.75,true) for i=112,123 do tfm.exec.bindKeyboard(name,i,true,true) system.bindMouse(name,true) end tfm.exec.chatMessage("
Welcome to module #clickwar!
Use the mouse to generate explosions and kill other mices!

Module made by Jessiewind26#2546 and Camilledrain#0000",name) end for name,player in pairs(tfm.get.room.playerList) do eventNewPlayer(name) end function eventMouse(name,x,y) if not tfm.get.room.playerList[name].isDead and enabled == true then if data[name].p1 == false then if data[name].time >= 2 then if data[name].p2 == true then tfm.exec.explosion(x,y,intensity,intensity*2,false) else tfm.exec.explosion(x,y,intensity/2,intensity*1.5,false) end data[name].time=0; tfm.exec.displayParticle(10,x,y,0,0,0,0,nil) end else if data[name].p2 == true then tfm.exec.explosion(x,y,intensity,intensity*2,false) else tfm.exec.explosion(x,y,intensity/2,intensity*1.5,false) end data[name].time=2; tfm.exec.displayParticle(10,x,y,0,0,0,0,nil) end end end function eventNewGame() for n,mouse in pairs(mice) do facingLeft[n] = false updateImg(n) end ui.removeTextArea(1111,nil) sudden=false tfm.exec.setGameTime(120) winner="" increase=0; remain=10 enabled=false intensity=40 prox=false; for name,player in pairs(tfm.get.room.playerList) do data[name].matches=data[name].matches+1 data[name].p1=false data[name].p2=false data[name].pcount=0 end end function eventLoop(pass,falt) if pass > 1200 and pass < 1700 then tfm.exec.chatMessage("Playing map "..tfm.get.room.currentMap.." made by "..tfm.get.room.xmlMapInfo.author) end for name,player in pairs(tfm.get.room.playerList) do if data[name].pcount >= 0 then data[name].pcount=data[name].pcount-1 else data[name].p1=false data[name].p2=false break end end if sudden == true then intensity=intensity+2 if falt < 20000 then intensity=intensity+1 end for name,player in pairs(tfm.get.room.playerList) do if not tfm.get.room.playerList[name].isDead then data[name].score=math.floor(data[name].score+(intensity/40)) end end end if falt < 40000 and sudden == false and falt > 30000 then tfm.exec.chatMessage("Ultra hard mode enabled!",nil) ui.addTextArea(1111,"",nil,-1000,-1000,3000,3000,0x000001,0x000001,0.8,false) sudden=true; end if falt < 20000 and sudden == true and falt > 19000 then ui.addTextArea(1111,"",nil,-1000,-1000,3000,3000,0x000001,0x000001,0.91,false) end if falt < 100 then tfm.exec.newGame("#10") end if prox == false then ui.setMapName("Click War RTM 2110.004 | Intensity: "..intensity.."") else ui.setMapName(""..winner.." wons the match! Next match on "..math.floor(falt/1000).." seconds.<") end remain=remain-0.5 if remain <= 3 and remain >= 0.5 then ui.addTextArea(1000,"

"..math.ceil(remain).."",nil,370,350,60,45,0x000001,0x000001,0.8,true) end if remain <= 0 then ui.removeTextArea(1000,nil) enabled=true; end for name,player in pairs(tfm.get.room.playerList) do data[name].time=data[name].time+1 end if enabled == true then increase=increase+0.5 if increase >= 2 then if sudden == false then intensity=intensity+1 increase=0; for name,player in pairs(tfm.get.room.playerList) do if not tfm.get.room.playerList[name].isDead then if pass > 30000 then data[name].score=math.floor(data[name].score+(intensity/24)) end end end end end end end function eventPlayerDied(name) if name == last_win and times >= 2 then tfm.exec.chatMessage("The victory sequence of "..last_win.." has been ended!") times=1 end local i=0 local n for pname,player in pairs(tfm.get.room.playerList) do if not player.isDead then i=i+1 n=pname end end if i==0 then tfm.exec.newGame("#10") elseif i==1 then winner=n; tfm.exec.giveCheese(n) tfm.exec.playerVictory(n) data[n].wins=data[n].wins+1 data[n].score=data[n].score+200 tfm.exec.setGameTime(10) tfm.exec.setPlayerScore(n,1,true) prox=true; if winner == last_win then data[n].score=data[n].score+100 times=times+1 if times == 2 then tfm.exec.chatMessage(""..last_win.." wons 2 times in a row!") elseif times >= 3 then tfm.exec.chatMessage("Legendary! "..last_win.." wons 3 times in a row!") end end last_win=n end end function eventTextAreaCallback(id,name,callback) 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 = callback:sub(12) + 0 if k == 1 then imgData[name] = nil tfm.exec.killPlayer(name) else imgData[name] = imgList[k] end updateImg(name) end if callback == "show_menu" then ui.addTextArea(299,"

Menu",name,365,376,70,24,0x000001,0x000001,0.75,true) ui.addTextArea(298,"

Help | Profile | Ranking",name,300,350,200,20,0x000001,0x000001,0.80,true) end if callback == "hide_menu" then ui.addTextArea(299,"

Menu",name,365,376,70,24,0x000001,0x000001,0.75,true) ui.removeTextArea(298,name) end if callback == "ranking" then eventChatCommand(name,"rank") end if callback == "profile" then tfm.exec.chatMessage("Use the !p command to view your profile and !p [user] to view the profile of specified user.",name) end if callback == "fechar" then for id=8000,8010 do ui.removeTextArea(id,name) end end if callback == "help" then eventChatCommand(name,"help") end if callback == "close" then for id=8000,8010 do ui.removeTextArea(id,name) ui.removeTextArea(6969+id,name) ui.removeTextArea(7979+id,name) end end if callback == "closep" then for id=9000,9010 do ui.removeTextArea(id,name) end end end function eventKeyboard(name,key,down,x,y) if enabled == true and powerups == true then if not tfm.get.room.playerList[name].isDead and data[name].p1 == false and data[name].p2 == false then if key == 112 and data[name].score >= 700 then data[name].p1=true data[name].score=data[name].score-700 data[name].pcount=16 tfm.exec.chatMessage(""..name.." used the powerup Fast Spirits!") end if key == 113 and data[name].score >= 250 then data[name].p2=true data[name].score=data[name].score-250 data[name].pcount=20 tfm.exec.chatMessage(""..name.." used the powerup Double Power!") end if key == 114 and data[name].score >= 550 then data[name].score=data[name].score-550 tfm.exec.chatMessage(""..name.." used the powerup Box Meteor!") for i=-6,19 do tfm.exec.addShamanObject(2,i*60,-1,0,0,0,false) end end end end end tfm.exec.newGame("#10") function main() for _,c in pairs(commands) do system.disableChatCommandDisplay(c) end for name in pairs(tfm.get.room.playerList) do eventNewPlayer(name) end end main()