View difference between Paste ID: QcH0zqxd and gQMVkY3r
SHOW: | | - or go back to the newest paste.
1
---------------------------------
2
--Game Set-up
3
---------------------------------
4
    modeSet = 1
5
    --[[#0 = Normal || #1 = QnA Only || #2 = TnF Only]]--
6
    roundTime = false
7
    --[[#true = Longer Round Time || #false = Shorter Round Time]]--
8
    
9
---------------------------------
10
--Questions/Statements
11
---------------------------------
12
    multipleChoice = {}
13
    --[[ multipleChoice[#] = {question = "?", answer1 = "A", answer2 = "B", answer3 = "C", correctAnswer = "D", score = 999} ]]--
14
    trueAndFalse = {}
15
    --[[ trueAndFalse[#] = {statement = ".", answer = "true 3/false 4", score = 999} ]]--
16
    
17
------List your multipleChoice questions here.
18
    multipleChoice[1] = {question = "When was Transformice released?", answer1 = "January 2011", answer2 = "December 2010", answer3 = "April 2011", correctAnswer = "May 2010", score = 10}
19
    multipleChoice[2] = {question = "What country did Transformice originate from?", answer1 = "London", answer2 = "Canada", answer3 = "China", correctAnswer = "France", score = 10}
20
    multipleChoice[3] = {question = "What is the most famous skill learnt in Transformice called?", answer1 = "Corner jumping", answer2 = "Turn around", answer3 = "Wall kicking", correctAnswer = "Wall jumping", score = 10}
21
    multipleChoice[4] = {question = "Which bot says, 'Kikoo pwet [username]!'?", answer1 = "Baffbot", answer2 = "Holzbot", answer3 = "Birdbot", correctAnswer = "Cfmbot", score = 10}
22-
    multipleChoice[5] = {question = "Who created this tribe?", answer1 = "Mvehpower", answer2 = "Ifeelawesome", answer3 = "Pixlelight", correctAnswer = "Zaxavien", score = 10}
22+
    multipleChoice[5] = {question = "What is the color of trampoline?", answer1 = "Blue", answer2 = "Colourless", answer3 = "Green", correctAnswer = "Purple", score = 10}
23
    multipleChoice[6] = {question = "What color is water?", answer1 = "Blue", answer2 = "Green", answer3 = "White", correctAnswer = "Colourless", score = 10}
24
    multipleChoice[7] = {question = "Who created Transformice?", answer1 = "Melibellule", answer2 = "Zou", answer3 = "Transformice", correctAnswer = "Tigrounette", score = 10}
25
    multipleChoice[8] = {question = "Which of the following is NOT a Atelier 801 game?", answer1 = "Transformice", answer2 = "Bouboum", answer3 = "Fortoresse", correctAnswer = "Transforcats", score = 10}
26
    multipleChoice[9] = {question = "What command do u type to wave a flag?", answer1 = "/c", answer2 = "/facebook", answer3 = "/tc", correctAnswer = "/f", score = 10}
27
    multipleChoice[10] = {question = "Which of the following is an official module?", answer1 = "#PokeLua", answer2 = "#simonsays", answer3 = "#mousehunt", correctAnswer = "#dancedance", score = 10}
28
    multipleChoice[11] = {question = "Which of the following is NOT an official module?", answer1 = "#labyrinth", answer2 = "#palette", answer3 = "#keyhunt", correctAnswer = "#maze", score = 10}
29
    multipleChoice[12] = {question = "How many teasers are there in TransfromiceTV?", answer1 = "3", answer2 = "5", answer3 = "1", correctAnswer = "4", score = 10}
30
    multipleChoice[13] = {question = "What is the default color of mice in Tfm?", answer1 = "White", answer2 = "Black", answer3 = "Pink", correctAnswer = "Brown", score = 10}
31
    multipleChoice[14] = {question = "How do u do a moonwalk while facing the left?", answer1 = "up, dance, up", answer2 = "Up, down, right, cry, jump", answer3 = "Up, down, left, confetti, up", correctAnswer = "Up, down, right, kiss, jump", score = 10}
32
    multipleChoice[15] = {question = "What do you call an elephant swimming?", answer1 = "Elephant swimming!", answer2 = "Diving animal!", answer3 = "Grey sink!", correctAnswer = "Swimming trunk!", score = 10}
33
    multipleChoice[16] = {question = "Which object can you NOT transform into?", answer1 = "Large box", answer2 = "Large plank", answer3 = "Anvil", correctAnswer = "Ball", score = 10}
34
    multipleChoice[17] = {question = "334 + 448 = ?", answer1 = "772", answer2 = "114", answer3 = "562", correctAnswer = "782", score = 10}
35
    multipleChoice[18] = {question = "When was Fishing Event held in 2011?", answer1 = "May", answer2 = "July", answer3 = "September", correctAnswer = "April", score = 10}
36
    multipleChoice[19] = {question = "What was map 666?", answer1 = "Fishing Map", answer2 = "Christmas Map", answer3 = "Carnival Map", correctAnswer = "Halloween Map", score = 10}
37
    multipleChoice[20] = {question = "What was map 555?", answer1 = "Fishing Map", answer2 = "Christmas Map", answer3 = "Halloween Map", correctAnswer = "Carnival Map", score = 10}
38
    multipleChoice[21] = {question = "What was map 777?", answer1 = "Carnival Map", answer2 = "Christmas Map", answer3 = "Halloween Map", correctAnswer = "Fishing", score = 10}
39
    multipleChoice[22] = {question = "How do you teleport in module #utility WITH HOTKEY?", answer1 = "!tp [username] + click", answer2 = "Ctrl + w", answer3 = "T + click", correctAnswer = "Ctrl + click", score = 10}
40
    multipleChoice[23] = {question = "Which perm category do mechanism maps belong to?", answer1 = "P3", answer2 = "P11", answer3 = "P8", correctAnswer = "P6", score = 10}
41
    multipleChoice[24] = {question = "Which perm category do racing maps belong to?", answer1 = "P1", answer2 = "P42", answer3 = "P5", correctAnswer = "P7", score = 10}
42
    multipleChoice[25] = {question = "Which perm category do art maps belong to?", answer1 = "P2", answer2 = "P41", answer3 = "P9", correctAnswer = "P5", score = 10}
43
    multipleChoice[26] = {question = "How many continents are there in the world?", answer1 = "6", answer2 = "5", answer3 = "9", correctAnswer = "7", score = 10}
44
    multipleChoice[27] = {question = "How many oceans are there in the world?", answer1 = "4", answer2 = "9", answer3 = "3", correctAnswer = "5", score = 10}
45
    multipleChoice[28] = {question = "Which country is the capital of USA?", answer1 = "London", answer2 = "California", answer3 = "Boston", correctAnswer = "Washington DC", score = 10}
46
    multipleChoice[29] = {question = "How many seeds does a mango have?", answer1 = "Too many to count", answer2 = "Two", answer3 = "More than two", correctAnswer = "One only", score = 10}
47
    multipleChoice[30] = {question = "What sound do porcupines make when they kiss?", answer1 = "Muah!", answer2 = "Eww!", answer3 = "Hahaha!", correctAnswer = "Ouch!", score = 10}
48
    multipleChoice[31] = {question = "What is the color of wood?", answer1 = "Yellow", answer2 = "Red", answer3 = "Black", correctAnswer = "Brown", score = 10}
49
    multipleChoice[32] = {question = "How many continents are there in the world?", answer1 = "Six", answer2 = "Ten", answer3 = "Eight", correctAnswer = "Seven", score = 10}
50
    multipleChoice[33] = {question = "Which continent is Melbourne in?", answer1 = "Europe", answer2 = "Asia", answer3 = "America", correctAnswer = "Australia", score = 10}
51
    multipleChoice[34] = {question = "Which continent is Madagascar in?", answer1 = "Australia", answer2 = "Asia", answer3 = "America", correctAnswer = "Africa", score = 10}
52
    multipleChoice[35] = {question = "What is the capital of Russia?", answer1 = "Saint Petersburg", answer2 = "Omsk", answer3 = "Samara", correctAnswer = "Moscow", score = 10}
53
    multipleChoice[36] = {question = "What is the capital of India?", answer1 = "Bangalore", answer2 = "Bangladesh", answer3 = "Mumbai", correctAnswer = "New Delhi", score = 10}
54
    multipleChoice[37] = {question = "What is the capital of France?", answer1 = "Nice", answer2 = "Lyon", answer3 = "Nancy", correctAnswer = "Paris", score = 10}
55
    multipleChoice[38] = {question = "1,3,6,10,?", answer1 = "14", answer2 = "16", answer3 = "20", correctAnswer = "15", score = 10}
56
    multipleChoice[39] = {question = "1,4,9,16,25,?", answer1 = "41", answer2 = "30", answer3 = "42", correctAnswer = "36", score = 10}
57
    multipleChoice[40] = {question = "What can you serve but never eat?", answer1 = "Candy", answer2 = "Chicken", answer3 = "Fish", correctAnswer = "Volleyball", score = 10}
58
59
------List you trueAndFalse statements here.
60
    trueAndFalse[1] = {statement = "Most of our tribe members are asians.", answer = "true 3", score = 10}
61
    trueAndFalse[2] = {statement = "Cowmushroom is a girl.", answer = "false 4", score = 10}
62
    trueAndFalse[3] = {statement = "Mvehpower is our first Map Creator.", answer = "false 4", score = 10}
63
    trueAndFalse[4] = {statement = "Water is blue.", answer = "false 4", score = 10}
64
    trueAndFalse[2] = {statement = "Zaxavien is a girl.", answer = "true 3", score = 10}
65
    
66
---------------------------------
67
--Script Init.
68
---------------------------------
69
    --Player and Text
70
    player = {}
71
    textBox = {}
72
    tpZONE = {}
73
    pID = 1000
74
    mode = 0 --Reference modeSet for values.
75
    
76
    --Game Loop
77
    sec = 0 --Seconds
78
    rnd = 0 --Round
79
    rnm = "" --Round Name
80
    gm = 1 --Game Number
81
    ql = 0 --Last Question
82
    tl = 0 --Last Statement
83
    ca = 0 --Correct Answer
84
    sc = 0 --
85
    
86
    --Reset Scores
87
    for n,p in pairs(tfm.get.room.playerList) do
88
        tfm.exec.setPlayerScore(n, 0, false)
89
    end
90
    
91
    --Whenever a player enters the room || A new round starts
92
    function eventNewPlayer(n)
93
        player[n] = 
94
        {
95
            id = pID, 
96
            chosen = true, 
97
            answer = 0
98
        }
99
        pID = pID + 100
100
    end
101
    
102
    for p in pairs(tfm.get.room.playerList) do 
103
        eventNewPlayer(p) 
104
    end
105
    
106
    function setChosen(n,b) 
107
        player[n].chosen = b 
108
    end
109
    
110
---------------------------------
111
--Every New Round
112
---------------------------------
113
    --Part 1
114
    function reset(m)
115
        mode = m
116
        local map = "0"
117
        
118
        --Reset boxes
119
        for i=1,#textBox,1 do ui.removeTextArea(i,nil) 
120
            table.remove(textBox,i) 
121
        end
122
        
123
        --Choosing a map.
124
        if mode == 1 then
125
            local maps = {"5826217"}
126
            map = maps[math.random(#maps)]
127
        elseif mode == 2 then
128
            local maps = {"5838948"}
129
            map = maps[math.random(#maps)]
130
        end
131
        
132
        --Start game
133
        tfm.exec.disableAutoShaman(true)
134
        tfm.exec.newGame(map)
135
        tfm.exec.setGameTime(0)
136
    end
137
    
138
    --Part 2
139
    function eventNewGame()
140
        tfm.exec.disableAutoNewGame(true)
141
        tfm.exec.disableAutoScore(true)
142
        tfm.exec.disableAfkDeath(true)
143
        tfm.exec.disableAutoTimeLeft(true)
144
        for p in pairs(tfm.get.room.playerList) do 
145
            eventNewPlayer(p) 
146
        end
147
         
148
        --Finding the objects for textBoxes and teleport zones
149
        local xml = tfm.get.room.xmlMapInfo.xml
150
        local xmlGROUNDS = xml:match('<S>[^´]+</S>'):gsub("<S>","")
151
        for p in xmlGROUNDS:gmatch('<S[^/]+/>') do
152
            for i=0,15,1 do
153
                if p:match(string.format('lua="%s"',tostring(i))) then
154
                    local l = p:match('L="[0-9]+"'):gsub('L="',''):gsub('"','')-2
155
                    local h = p:match('H="[0-9]+"'):gsub('H="',''):gsub('"','')
156
                    local x = p:match('X="[0-9]+"'):gsub('X="',''):gsub('"','')-(l/2)
157
                    local y = p:match('Y="[0-9]+"'):gsub('Y="',''):gsub('"','')-(h/2)+1
158
                    if mode == 1 then
159
                        if i == 1 then textBox[1] = {x = x, y = y, w = l, h = h, event = "Q", txt = "Question will be Here\n<font color='#CB546B'>Click for Help</font>"} end
160
                        if i == 2 then textBox[2] = {x = x, y = y, w = l, h = h, event = "T", txt = "Timer"} end
161
                        if i == 3 then textBox[3] = {x = x, y = y, w = l, h = h, event = "RT", txt = "Answer Red"} end
162
                        if i == 4 then textBox[4] = {x = x, y = y, w = l, h = h, event = "BF", txt = "Answer Blue"} end
163
                        if i == 5 then textBox[5] = {x = x, y = y, w = l, h = h, event = "G", txt = "Answer Green"} end
164
                        if i == 6 then textBox[6] = {x = x, y = y, w = l, h = h, event = "O", txt = "Answer Orange"} end
165
                    elseif mode == 2 then
166
                        if i == 1 then textBox[1] = {x = x, y = y, w = l, h = h, event = "Q", txt = "Question will be Here\n<font color='#CB546B'>Click for Help</font>"} end
167
                        if i == 2 then textBox[2] = {x = x, y = y, w = l, h = h, event = "T", txt = "Timer"} end
168
                        if i == 3 then textBox[3] = {x = x, y = y, w = l, h = h, event = "RT", txt = "True"} end
169
                        if i == 4 then textBox[4] = {x = x, y = y, w = l, h = h, event = "BF", txt = "False"} end
170
                    end              
171
                    if i >= 10 then
172
                        x = p:match('X="[0-9]+"'):gsub('X="',''):gsub('"','')
173
                        y = p:match('Y="[0-9]+"'):gsub('Y="',''):gsub('"','')
174
                        tpZONE[i] = {x1 = x-(l/2), x2 = x+(l/2), y1 = y-(h/2), y2 = y+(h/2)}
175
                    end
176
                end
177
            end
178
        end
179
 
180
        local tbS = "<p align = 'center'><b>"
181
        local tbE = "</b></p>"
182
        for i = 1, #textBox, 1 do
183
            local cc = 0x010101
184
            if i == 2 then 
185
                cc = 0x000A59 
186
            elseif i >= 3 then 
187
                cc = 0x010101 
188
            end
189
            ui.addTextArea(i,
190
                string.format("%s<a href='event:%s'>%s</a>%s",tbS,textBox[i].event,textBox[i].txt,tbE)
191
            ,nil,textBox[i].x,textBox[i].y,textBox[i].w,textBox[i].h,cc,cc,1,false)
192
        end
193
    end
194
195
---------------------------------
196
--Buttons
197
---------------------------------
198
    function eventTextAreaCallback(id , n, event)
199
        if player[n].chosen == false then
200
            --Set chosen
201
            if id >= 3 and id <= 6 then 
202
                player[n].answer = id 
203
                setChosen(n,true) 
204
            end
205
            --Move to a tp zone
206
            if event == "RT" then tfm.exec.movePlayer(n,math.random(tpZONE[10].x1,tpZONE[10].x2),math.random(tpZONE[10].y1,tpZONE[10].y2),false) end
207
            if event == "BF" then tfm.exec.movePlayer(n,math.random(tpZONE[11].x1,tpZONE[11].x2),math.random(tpZONE[11].y1,tpZONE[11].y2),false) end
208
            if event == "G" then tfm.exec.movePlayer(n,math.random(tpZONE[12].x1,tpZONE[12].x2),math.random(tpZONE[12].y1,tpZONE[12].y2),false) end
209
            if event == "O" then tfm.exec.movePlayer(n,math.random(tpZONE[13].x1,tpZONE[13].x2),math.random(tpZONE[13].y1,tpZONE[13].y2),false) end
210
        end
211
    end
212
    
213
---------------------------------
214
--Game Loop
215
---------------------------------
216
    function eventLoop()
217
        ui.updateTextArea(2,"<b><p align = 'center'>Time: "..math.ceil(sec).." "..rnm.."</p></b>")
218
        if sec > 0 then 
219
            sec = sec-0.5 
220
        else 
221
            sec = 0 
222
        end
223
 
224
        --Round Start
225
        if rnd == 0 and sec == 0 then
226
            --Set map
227
            if modeSet == 0 then
228
                if gm < 3 then 
229
                    reset(1) 
230
                elseif gm == 3 then 
231
                    reset(2) 
232
                    gm = 0 
233
                end
234
            elseif modeSet == 1 then 
235
                reset(1)
236
            elseif modeSet == 2 then 
237
                reset(2)
238
            end
239
            
240
            --Set values, and no choosing
241
            sec,rnd,rnm,gm,ca = 20,1,"Get Ready!",gm+1,0
242
            if roundTime == false then sec = 10 end
243
            for n,p in pairs(tfm.get.room.playerList) do 
244
                setChosen(n,true) 
245
            end
246
        end
247
 
248
        --Question
249
        if rnd == 1 and sec == 0 then
250
            sec,rnd,rnm = 30,2,"Choose..."
251
            if roundTime == false then rnd = 3 sec = 15 end
252
            local tbS,tbE = "<b><p align='center'>","</p></b>"
253
 
254
            if mode == 1 then
255
                local q = math.random(1,#multipleChoice)
256
                if q == ql then 
257
                    q = math.random(1,#multipleChoice) 
258
                 else 
259
                    ql = q 
260
                end
261
                ui.updateTextArea(1,string.format("%s<a href='event:%s'>%s\nScore: %s</a>%s",tbS,textBox[1].event,multipleChoice[q].question,multipleChoice[q].score,tbE))
262
                sc = multipleChoice[q].score
263
                local df,at = 0,{}
264
                for i=3,6,1 do at[i] = {v=i} end
265
                while df == 0 do df = at[math.random(3,6)].v end if df ~= 0 then
266
                    ui.updateTextArea(df,string.format("%s<a href='event:%s'>%s</a>%s",tbS,textBox[df].event,multipleChoice[q].answer1,tbE)) at[df].v = 0 df = 0 end
267
                while df == 0 do df = at[math.random(3,6)].v end if df ~= 0 then
268
                    ui.updateTextArea(df,string.format("%s<a href='event:%s'>%s</a>%s",tbS,textBox[df].event,multipleChoice[q].answer2,tbE)) at[df].v = 0 df = 0 end
269
                while df == 0 do df = at[math.random(3,6)].v end if df ~= 0 then
270
                    ui.updateTextArea(df,string.format("%s<a href='event:%s'>%s</a>%s",tbS,textBox[df].event,multipleChoice[q].answer3,tbE)) at[df].v = 0 df = 0 end
271
                while df == 0 do df = at[math.random(3,6)].v end if df ~= 0 then
272
                    ui.updateTextArea(df,string.format("%s<a href='event:%s'>%s</a>%s",tbS,textBox[df].event,multipleChoice[q].correctAnswer,tbE)) ca = df at[df].v = 0 df = 0 end
273
            elseif mode == 2 then
274
                local q = math.random(1,#trueAndFalse)
275
                if q == tl then 
276
                    q = math.random(1,#trueAndFalse) 
277
                else 
278
                    tl = q
279
                end
280
                ui.updateTextArea(1,string.format("%s<a href='event:%s'>%s     Score: %s</a>%s",tbS,textBox[1].event,trueAndFalse[q].statement,trueAndFalse[q].score,tbE))
281
                ca,sc = trueAndFalse[q].correctAnswer,trueAndFalse[q].score
282
            end
283
            for n,p in pairs(tfm.get.room.playerList) do 
284
                setChosen(n,false) 
285
            end
286
        end
287
       
288
        if rnd == 2 and sec == 0  then --Final Answer
289
            sec,rnd,rnm = 20,3,"Final Answer?"
290
            for n,p in pairs(tfm.get.room.playerList) do
291
                setChosen(n,false)
292
                if player[n].answer == 0 then 
293
                    tfm.exec.killPlayer(n) 
294
                end
295
            end
296
        end
297
 
298
        if rnd == 3 and sec == 0 then --Round End
299
            sec,rnd,rnm = 10,0,"Winners!"
300
            if roundTime == false then sec = 5 end
301
            for n,p in pairs(tfm.get.room.playerList) do
302
                setChosen(n,true)
303
                if player[n].answer ~= ca  then 
304
                    tfm.exec.killPlayer(n) 
305
                else 
306
                    tfm.exec.giveCheese(n) 
307
                    tfm.exec.setPlayerScore(n,sc,true) 
308
                end
309
            end
310
        end
311
    end
312
    
313
-------------------------------
314
--The End...
315
-------------------------------