Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- contains = function(t,v)
- for k,v1 in pairs(v) do
- if v1==v then
- return true
- end
- end
- end
- trans={pt={COLOR_SELECT="Seleciona a cor!",CALL_THEME="o tema é ",WAITING="Número insuficiente de ratos",VOTING_START="Tema feita por ",START_VOTING="O tempo acabou... Todos os ratos irão votar todas as pinturas",OPTION_SELECTOR="(Podes selecionar a cor clicando em espaço"},en={COLOR_SELECT="Seleciona a cor!",CALL_THEME="theme is ",START_VOTING="Theme by ",WAITING="Insuficient number of players",OPTION_SELECTOR="(you can select the color using space)",VOTING_START="Time is over, all will vote all pictures"}}
- lang = "EN" --CHOOOOSEEEE THE LANGUAGE HERE!!!!!!
- if contains(tfm.get.room.community,trans) then
- lang = tfm.get.room.community
- end
- roomLanguage = trans[lang]
- print(tfm.get.room.community)
- timePerRound=120
- tfm.exec.newGame('<C><P G="0,1" /><Z><S><S L="800" H="63" X="401" Y="414" T="6" P="0,0,0.3,0.2,0,0,0,0" /><S L="20" o="fff500" H="100" X="508" Y="239" T="12" P="0,0,0.3,0.2,60,0,0,0" /><S L="148" o="935900" H="29" X="386" Y="223" T="12" P="0,0,0.3,0.2,45,0,0,0" /><S L="28" o="935900" H="10" X="333" Y="170" T="13" P="0,0,0.3,0.2,0,0,0,0" /><S L="20" o="324650" H="20" X="467" Y="263" T="12" P="0,0,0.3,0.2,0,0,0,0" /><S L="58" o="fff500" H="10" X="472" Y="270" T="12" P="0,0,0.3,0.2,-45,0,0,0" /><S P="0,0,0.3,0.2,40,0,0,0" L="148" o="935900" X="380" Y="227" T="12" H="29" /><S L="50" o="324650" H="10" X="466" Y="257" T="12" P="0,0,0.3,0.2,-15,0,0,0" /><S L="20" o="324650" H="10" X="444" Y="276" T="13" P="0,0,0.3,0.2,0,0,0,0" /><S L="148" o="935900" X="391" H="29" Y="217" T="12" P="0,0,0.3,0.2,50,0,0,0" /><S P="0,0,0.3,0.2,-50,0,0,0" L="58" o="324650" X="472" Y="269" T="12" H="10" /><S L="27" o="fff500" H="188" X="544" Y="129" T="12" P="0,0,0.3,0.2,0,0,0,0" /></S><D /><O /></Z></C>')
- paint = 2
- step = "remove"
- tfm.exec.setGameTime(5, true)
- function remove()
- for i = 2, paint do
- ui.removeTextArea(i, nil)
- end
- end
- points = {}
- pos = {}
- people = {}
- mor = {}
- choosed = {}
- size = {}
- function create()
- points = {}
- pos = {}
- people = {}
- mor = {}
- choosed = {}
- size = {}
- tfm.exec.newGame('<C><P L="8800" Ca="" /><Z><S /><D /><O /></Z></C>', nil)
- number = 1
- for i, v in pairs(tfm.get.room.playerList) do
- tfm.exec.addPhysicObject(number*5-4, number*900, 200,{type=12, width=800, height=400, color=0xffffff,miceCollision=false,foreground=true})
- tfm.exec.addPhysicObject(number*5-3, number*900, 300,{type=0, width=100, height=10})
- tfm.exec.addPhysicObject(number*5-2, number*900, 250,{type=0, width=100, height=10})
- tfm.exec.addPhysicObject(number*5-1, number*900+20, 250,{type=0, width=10, height=100})
- tfm.exec.addPhysicObject(number*5, number*900-20, 250,{type=0, width=10, height=100})
- tfm.exec.movePlayer(i, number*900, 300, false, 0, 0, false)
- pos[i] = number
- points[i] = 0
- table.insert(people, i)
- choosed[i] = "NaN"
- number = number + 1
- size[i] = 5
- end
- tfm.exec.setGameTime(10, true)
- words = {"monkey", "car", "jelly", "piano", "flower", "pot"}
- no = math.random(#words)
- oneoption = words[no]
- no = math.random(#words)
- twooption = words[no]
- no = math.random(#words)
- threeoption = words[no]
- no = math.random(#words)
- fouroption = words[no]
- onechoose = 0
- twochoose = 0
- threechoose = 0
- fourchoose = 0
- step = "choosing"
- ui.addTextArea(1, '<a href="event:oneoption">' .. tostring(oneoption) .. '</a>', nil, 200, 200, 100, 0, 0x123450, 0x123450, 1, true)
- ui.addTextArea(2, '<a href="event:twooption">' .. tostring(twooption) .. '</a>', nil, 200, 250, 100, 0, 0x123450, 0x123450, 1, true)
- ui.addTextArea(3, '<a href="event:threeoption">' .. tostring(threeoption) .. '</a>', nil, 200, 300, 100, 0, 0x123450, 0x123450, 1, true)
- ui.addTextArea(4, '<a href="event:fouroption">' .. tostring(fouroption) .. '</a>', nil, 200, 350, 100, 0, 0x123450, 0x123450, 1, true)
- for i, v in pairs(pos) do
- print(i .. " " .. v)
- end
- end
- tfm.exec.disableMortCommand(true)
- tfm.exec.disableAfkDeath(true)
- tfm.exec.disableAutoNewGame(true)
- tfm.exec.disableAutoScore(true)
- tfm.exec.disableAutoTimeLeft(true)
- tfm.exec.disableAutoShaman(true)
- function eventTextAreaCallback(id, j, call)
- -- aq fica tudo sobre escolher a palavra
- if step == "choosing" then
- if call == "oneoption" and not(choosed[j] == "oneoption") then
- if choosed[j] == "twooption" then
- twochoose = twochoose - 1
- end
- if choosed[j] == "threeoption" then
- threechoose = threechoose - 1
- end
- if choosed[j] == "fouroption" then
- fourchoose = fourchoose - 1
- end
- choosed[j] = "oneoption"
- ui.addTextArea(1, '<a href="event:oneoption">' .. tostring(oneoption) .. '</a>', nil, 200, 200, 100, 0, 0x123450, 0xCCFFC, 1, true)
- ui.addTextArea(2, '<a href="event:twooption">' .. tostring(twooption) .. '</a>', nil, 200, 250, 100, 0, 0x123450, 0x123450, 1, true)
- ui.addTextArea(3, '<a href="event:threeoption">' .. tostring(threeoption) .. '</a>', nil, 200, 300, 100, 0, 0x123450, 0x123450, 1, true)
- ui.addTextArea(4, '<a href="event:fouroption">' .. tostring(fouroption) .. '</a>', nil, 200, 350, 100, 0, 0x123450, 0x123450, 1, true)
- onechoose = onechoose + 1
- end
- if call == "twooption" and not(choosed[j] == "twooption") then
- if choosed[j] == "oneoption" then
- onechoose = onechoose - 1
- end
- if choosed[j] == "threeoption" then
- threechoose = threechoose - 1
- end
- if choosed[j] == "fouroption" then
- fourchoose = fourchoose - 1
- end
- choosed[j] = "twooption"
- ui.addTextArea(1, '<a href="event:oneoption">' .. tostring(oneoption) .. '</a>', j, 200, 200, 100, 0, 0x123450, 0x123450, 1, true)
- ui.addTextArea(2, '<a href="event:twooption">' .. tostring(twooption) .. '</a>', j, 200, 250, 100, 0, 0x123450, 0xCCFFC, 1, true)
- ui.addTextArea(3, '<a href="event:threeoption">' .. tostring(threeoption) .. '</a>', j, 200, 300, 100, 0, 0x123450, 0x123450, 1, true)
- ui.addTextArea(4, '<a href="event:fouroption">' .. tostring(fouroption) .. '</a>', j, 200, 350, 100, 0, 0x123450, 0x123450, 1, true)
- twochoose = twochoose + 1
- end
- if call == "threeoption" and not(choosed[j] == "threeoption") then
- if choosed[j] == "oneoption" then
- onechoose = onechoose - 1
- end
- if choosed[j] == "twooption" then
- twochoose = twochoose - 1
- end
- if choosed[j] == "fouroption" then
- fourchoose = fourchoose - 1
- end
- choosed[j] = "threeoption"
- ui.addTextArea(1, '<a href="event:oneoption">' .. tostring(oneoption) .. '</a>', j, 200, 200, 100, 0, 0x123450, 0x123450, 1, true)
- ui.addTextArea(2, '<a href="event:twooption">' .. tostring(twooption) .. '</a>', j, 200, 250, 100, 0, 0x123450, 0x123450, 1, true)
- ui.addTextArea(3, '<a href="event:threeoption">' .. tostring(threeoption) .. '</a>', j, 200, 300, 100, 0, 0x123450, 0xCCFFC, 1, true)
- ui.addTextArea(4, '<a href="event:fouroption">' .. tostring(fouroption) .. '</a>', j, 200, 350, 100, 0, 0x123450, 0x123450, 1, true)
- threechoose = threechoose + 1
- end
- if call == "fouroption" and not(choosed[j] == "fouroption") then
- if choosed[j] == "oneoption" then
- onechoose = onechoose - 1
- end
- if choosed[j] == "twooption" then
- twochoose = twochoose - 1
- end
- if choosed[j] == "threeoption" then
- threechoose = threechoose - 1
- end
- choosed[j] = "fouroption"
- ui.addTextArea(1, '<a href="event:oneoption">' .. tostring(oneoption) .. '</a>', j, 200, 200, 100, 0, 0x123450, 0x123450, 1, true)
- ui.addTextArea(2, '<a href="event:twooption">' .. tostring(twooption) .. '</a>', j, 200, 250, 100, 0, 0x123450, 0x123450, 1, true)
- ui.addTextArea(3, '<a href="event:threeoption">' .. tostring(threeoption) .. '</a>', j, 200, 300, 100, 0, 0x123450, 0x123450, 1, true)
- ui.addTextArea(4, '<a href="event:fouroption">' .. tostring(fouroption) .. '</a>', j, 200, 350, 100, 0, 0x123450, 0xCCFFC, 1, true)
- fourchoose = fourchoose + 1
- end
- ui.updateTextArea(1, '<a href="event:oneoption">' .. tostring(oneoption) .. '</a>' .. " " .. onechoose, nil)
- ui.updateTextArea(2, '<a href="event:twooption">' .. tostring(twooption) .. '</a>' .. " " .. twochoose, nil)
- ui.updateTextArea(3, '<a href="event:threeoption">' .. tostring(threeoption) .. '</a>' .. " " .. threechoose, nil)
- ui.updateTextArea(4, '<a href="event:fouroption">' .. tostring(fouroption) .. '</a>' .. " " .. fourchoose, nil)
- else
- if call == "color" then
- ui.removeTextArea(0, j)
- ui.showColorPicker(1, j, color[j], "select the color")
- system.bindMouse(j, true)
- end
- player=j
- if call == "more" then
- if not(contains(player, mor)) then
- mor[#mor+1]=player
- if #mor >= math.ceil(#people / 2) then
- tfm.exec.setGameTime(timePerRound, true)
- end
- end
- end
- if call == "paper" then
- ui.removeTextArea(0, j)
- ui.showColorPicker(2, j, 0x000000, "select the color of the paper (NOT WORKING)")
- system.bindMouse(j, true)
- end
- if call == "size" then
- ui.removeTextArea(0, j)
- ui.addPopup(1, 2, "input here the size", j, 300, 200, 200, true)
- system.bindMouse(j, true)
- end
- if call == "Super poop" then
- points[people[now]] = points[people[now]] + 1
- ui.removeTextArea(1, j)
- end
- if call == "poop" then
- points[people[now]] = points[people[now]] + 2
- ui.removeTextArea(1, j)
- end
- if call == "ok" then
- points[people[now]] = points[people[now]] + 3
- ui.removeTextArea(1, j)
- end
- if call == "good" then
- points[people[now]] = points[people[now]] + 4
- ui.removeTextArea(1, j)
- end
- if call == "epic" then
- points[people[now]] = points[people[now]] + 5
- ui.removeTextArea(1, j)
- end
- if call == "legendary" then
- points[people[now]] = points[people[now]] + 6
- ui.removeTextArea(1, j)
- ui.addTextArea(1, '<J><p align="center">LEGENDARY!!!!!</p>', people[now], 0, 380, 800, 0, 0x123455, 0x123450, 1, true)
- end
- end
- end
- function eventLoop(p, r) --agr que vi o eventLoop() é o maior 0.0
- print(mor)
- if r < 0 then
- if step == "choosing" then
- choos = false
- what = ""
- if onechoose > twochoose and onechoose > threechoose and onechoose > fourchoose then
- print(oneoption)
- choos = true
- what = oneoption
- end
- if twochoose > onechoose and twochoose > threechoose and twochoose > fourchoose then
- print(twooption)
- choos = true
- what = twooption
- end
- if threechoose > onechoose and threechoose > twochoose and threechoose > fourchoose then
- print(threeoption)
- choos = true
- what = threeoption
- end
- if fourchoose > onechoose and fourchoose > twochoose and fourchoose > threechoose then
- print(fouroption)
- choos = true
- what = fouroption
- end
- if choos then
- step = "draw"
- ui.removeTextArea(1, nil)
- ui.removeTextArea(2, nil)
- ui.removeTextArea(3, nil)
- ui.removeTextArea(4, nil)
- ui.addTextArea(1, '<p align="center">' .. roomLanguage["CALL_THEME"] .. what .. roomLanguage["OPTION_SELECTOR"] .. '</p>', nil, 0, 380, 800, 0, 0x123450, 0x123450, 0.8, true)
- paint = 2
- tfm.exec.setGameTime(timePerRound, true)
- color = {}
- size = {}
- for i, v in pairs(tfm.get.room.playerList) do
- system.bindMouse(i, true)
- system.bindKeyboard(i, 32, false, true)
- color[i] = 0x000000
- size[i] = 5
- end
- end
- elseif step == "draw" then
- for i, v in pairs(tfm.get.room.playerList) do
- system.bindMouse(i, false)
- end
- ui.removeTextArea(1, nil)
- ui.addTextArea(1, '<p align="center">' .. roomLanguage["START_VOTING"] .. '</p>' , nil, 0, 200, 800, 0, 0x123455, 0x123450, 1, true)
- step = "start vote"
- tfm.exec.setGameTime(3, true)
- elseif step == "start vote" then
- now = 1
- for i, v in pairs(tfm.get.room.playerList) do
- print(people[now])
- tfm.exec.movePlayer(i, pos[people[now]]*900, 300, false, 0, 0, false)
- end
- ui.addTextArea(1, '<p align="center">' .. roomLanguage["VOTING_START"] .. people[now] .. ' <a href="event:Super poop">Super poop</a>, <a href="event:poop">poop</a>, <a href="event:ok">ok</a>, <a href="event:good">good</a>, <a href="event:epic">epic</a> or <a href="event:legendary">LEGENDARY</a></p>', nil, 0, 380, 800, 0, 0x123455, 0x123450, 1, true)
- ui.addTextArea(1, '<p align="center">Your picture</p>', people[now], 0, 380, 800, 0, 0x123455, 0x123450, 1, true)
- step = "voting"
- tfm.exec.setGameTime(10, true)
- elseif step == "voting" then
- now = now + 1
- if now == #people + 1 then
- step = "collecting"
- tfm.exec.setGameTime(10, true)
- else
- points[people[now]] = 0
- for i, v in pairs(tfm.get.room.playerList) do
- print(people[now])
- tfm.exec.movePlayer(i, pos[people[now]]*900, 300, false, 0, 0, false)
- end
- ui.addTextArea(1, '<p align="center">' .. roomLanguage["VOTING_START"] .. people[now] .. ' <a href="event:Super poop">Super poop</a>, <a href="event:poop">poop</a>, <a href="event:ok">ok</a>, <a href="event:good">good</a>, <a href="event:epic">epic</a> or <a href="event:legendary">LEGENDARY</a></p>', nil, 0, 380, 800, 0, 0x123455, 0x123450, 1, true)
- ui.addTextArea(1, '<p align="center">Your picture</p>', people[now], 0, 380, 800, 0, 0x123455, 0x123450, 1, true)
- end
- tfm.exec.setGameTime(10, true)
- elseif step == "collecting" then
- that = ""
- pointed = -1
- for i, v in pairs(points) do
- tfm.exec.setPlayerScore(i, v, false)
- if v > pointed then
- pointed = v
- that = i
- end
- end
- for i, v in pairs(tfm.get.room.playerList) do
- tfm.exec.movePlayer(i, pos[that]*900, 300, false, 0, 0, false)
- end
- ui.addTextArea(1, '<p align="center">' .. that .. ' wins!</p>', nil, 0, 200, 800, 0, 0x123455, 0x123450, 1, true)
- step = "remove"
- tfm.exec.setGameTime(5, true)
- elseif step == "remove" then
- people = 0
- roomPeoplePlaying=0
- for i, v in pairs(tfm.get.room.playerList) do
- people = people + 1
- roomPeoplePlaying=roomPeoplePlaying+1
- end
- if people > 1 then
- remove()
- create()
- else
- ui.addTextArea(1, '<p align="center">'..roomLanguage["WAITING"]..'</p>', nil, 0, 200, 800, 0, 0x123455, 0x123450, 1, true)
- end
- end
- end
- if not(r<0) then
- if step=="collecting" then
- for i, v in pairs(tfm.get.room.playerList) do
- print(pos[people[math.random(0,roomPeoplePlaying-1)]])
- print(people[math.random(1,roomPeoplePlaying)])
- print(roomPeoplePlaying)
- tfm.exec.movePlayer(i, pos[people[math.random(1,roomPeoplePlaying)]]*900, 300, false, 0, 0, false)
- ui.addTextArea(1, '<p align="center">Who will win?</p>', nil, 0, 200, 800, 0, 0x123455, 0x123450, 1, true)
- end
- end
- end
- end
- function eventMouse(j, x, y)
- if step == "draw" then
- if pos[j]*900-400 < x and pos[j]*900+400 > x then -- assetar as bordas
- --o addTextArea em baixo é a coisa mais importante, obviamente no paint battle tem que haver pintura
- ui.addTextArea(paint, "", nil, x - size[j]/2, y - size[j]/2, size[j], size[j], color[j], color[j], 1, false)
- paint = paint + 1
- end
- end
- end
- function eventKeyboard(j, id, p, x, y)
- system.bindMouse(j, false)
- ui.addTextArea(0, '<a href="event:color">select the color!</a><br/><a href="event:size">select the size!</a><br/><a href="event:paper">Change the color of the background</a><br/><a href="event:more">More time!</a>', j, 0, 180, 800, 0, 0x123450, 0x123450, 1, true)
- end
- function eventColorPicked(id, j, c)
- if not(tonumber(c) == -1) and not(tonumber(c)==nil) then
- if id == 1 then
- color[j] = tonumber(c)
- ui.addTextArea(1, '<p align="center">'.. roomLanguage["CALL_THEME"] .. what .. '</p>', j, 0, 380, 800, 0, color[j], 0x123450, 0.8, true)
- end
- if id == 3 then
- tfm.exec.removePhysicObject(pos[j]*5-4)
- tfm.exec.addPhysicObject(pos[j]*5-4, pos[j]*900, 200,{type=12, width=800, height=400, color=0xffffff,miceCollision=false,foreground=true})
- end
- end
- end
- function eventPopupAnswer(id, j, r)
- if id == 1 and not(tonumber(r)==nil) then
- size[j] = tonumber(r)
- end
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement