View difference between Paste ID: TaazxDJ4 and B8KiuVKX
SHOW: | | - or go back to the newest paste.
1
tfm.exec.disableAutoNewGame(true)
2
tfm.exec.disableAfkDeath(true)
3
tfm.exec.disableAutoShaman(false)
4
maps={0,1,2,3,4,5,6,9,11,12,13,15,16,17,18,19,20,24,25}
5
tfm.exec.newGame(0)
6
system.disableChatCommandDisplay("help",true)
7
system.disableChatCommandDisplay("remove",true)
8
local t=0
9
local n=0
10-
ui.addPopup(1, 0, "Hello, welcome to the Haunted Game created by Mousetat! \nThe shaman can control mice by pressing I to jump, J to move left, K to move down , and L to move right! \nIn short use IJKL to move. \nIf you are uncomfortable with the 'I' button, you can alternatively press the 'Space' button to jump! \n\nFeel free to change maps! \nHave fun! \n\nType !help for this popup to pop again!", nil, 200,100,400,true)
10+
local s="Welcome to Haunted Game created by Mousetat!\nType !remove to remove this chatbox.\n"
11
ui.addPopup(1, 1, "Hello, welcome to the Haunted Game created by Mousetat! \nThe shaman can control mice by pressing I to jump, J to move left, K to move down , and L to move right! \nIn short use IJKL to move. \nIf you are uncomfortable with the 'I' button, you can alternatively press the 'Space' button to jump! \n\nFeel free to change maps! \nHave fun! \n\nType !help for this popup to pop again!", nil, 200,100,400,true)
12
13
ui.addTextArea(2, s , nil, 20, 20, 400, 200, nil, nil, 0.5, true)
14-
ui.addPopup(1, 0, "Hello, welcome to the Haunted Game created by Mousetat! \nThe shaman can control mice by pressing I to jump, J to move left, K to move down , and L to move right! \nIn short use IJKL to move. \nIf you are uncomfortable with the 'I' button, you can alternatively press the 'Space' button to jump! \n\nFeel free to change maps! \nHave fun! \n\nType !help for this popup to pop again!", nil, 200,100,400,true)
14+
15
function eventPopupAnswer(popupID, playerName, answer)
16
if popupID==1 and answer=="no" then
17
ui.addPopup(1, 0, "You do not agree with me. So you DIE!\n\n Bye Bye cruel world ^^", playerName, 200,100,400,true)
18
tfm.exec.killPlayer(playerName)
19
s=s..playerName.." died an unfortunate death because she doesn't agree with me :(\n"
20
ui.updateTextArea(2,s,nil)
21
elseif popupID==1 and answer=="yes" then
22
ui.addPopup(1, 0, "Nice! You agree with me. So you get a cheese as a reward!\n\nYummy! ^^", playerName, 200,100,400,true)
23
tfm.exec.giveCheese(playerName)
24
s=s..playerName.." got CHEESE because she agrees with me ^^\n"
25
ui.updateTextArea(2,s,nil)
26
elseif popupID==3 and answer=="yes" then
27
ui.addPopup(1,0,"Nice! You agree with me, so you will respawn if you're dead and get Meep function! ^^", playerName, 200,100,400,true)
28
tfm.exec.respawnPlayer(playerName)
29
tfm.exec.setNameColor(playerName, 0xFFFF00)
30
tfm.exec.giveMeep(playerName)
31
s=s..playerName.." revived(if dead) and got the MEEP function!\n"
32
ui.updateTextArea(2,s,nil)
33
elseif popupID==3 and answer=="no" then
34
ui.addPopup(1, 0, "You do not agree with me. So you DIE!\n\n Bye Bye cruel world ^^", playerName, 200,100,400,true)
35
tfm.exec.killPlayer(playerName)
36
s=s..playerName.." died an unfortunate death because she doesn't agree with me :(\n"
37
ui.updateTextArea(2,s,nil)
38
end
39
end
40-
print("t: " .. t)
40+
41
function eventChatCommand(name,message)
42
if message=="help" then
43
ui.addPopup(3, 1, "Hello, welcome to the Haunted Game created by Mousetat! \nThe shaman can control mice by pressing I to jump, J to move left, K to move down , and L to move right! \nIn short use IJKL to move. \nIf you are uncomfortable with the 'I' button, you can alternatively press the 'Space' button to jump! \n\nFeel free to change maps! \nHave fun! \n\nType !help for this popup to pop again!", nil, 200,100,400,true)
44
end
45
if message=="remove"then
46
ui.removeTextArea(2, name)
47
end
48
end
49
50
function eventLoop(time,remaining)
51
if remaining<=0 then
52
tfm.exec.newGame(maps[math.random(#maps)])
53
end
54
end
55
56
function eventPlayerDied(playerName)
57
n=n-1
58
s=s..playerName.." died an unfortunate death :(\n"
59
ui.updateTextArea(2,s,nil)
60
for name, player in pairs(tfm.get.room.playerList) do
61
	if n==t or n<=0 or playerName==player.isShaman then
62
		if player.isShaman then
63
		tfm.exec.giveCheese(name)
64
		tfm.exec.playerVictory(name)
65
		tfm.exec.newGame(maps[math.random(#maps)])
66
		end
67
	end
68
end
69
end
70
71
function eventPlayerWon(playerName,timeElapsed)
72
t=t+1
73
s=s..playerName.." got cheese back to hole! SHE WON! ^.^\n"
74
ui.updateTextArea(2,s,nil)
75
for name, player in pairs(tfm.get.room.playerList) do
76
	if n==t then
77
		if player.isShaman then
78
		tfm.exec.giveCheese(name)
79
		tfm.exec.playerVictory(name)
80
		tfm.exec.newGame(maps[math.random(#maps)])
81
		end
82
	end
83
end	
84
end
85
86
function eventNewGame()
87
n=0
88
t=0
89
for name, player in pairs(tfm.get.room.playerList) do
90
	for keys, k in pairs({32, 73, 74, 75, 76}) do
91
		if player.isShaman then
92
		tfm.exec.bindKeyboard(name, k, true, true)
93
		else
94
		tfm.exec.bindKeyboard(name, k, true, false)
95
		end
96
		
97
	end
98
n=n+1
99
end
100
n=n-1
101
print(n)
102
end
103
104
function eventKeyboard(name, key, down, x, y)
105
for name, player in pairs(tfm.get.room.playerList) do
106
	if not player.isShaman then
107
	if key == 73 then
108
		tfm.exec.movePlayer(name, 0, 0, true, 0, -50, false)
109
	elseif key == 32 then
110
		tfm.exec.movePlayer(name, 0, 0, true, 0, -50, false)
111
	elseif key == 75 then
112
		tfm.exec.movePlayer(name, 0, 0, true, 0, 40, false)
113
	elseif key == 74 then
114
		tfm.exec.movePlayer(name, 0, 0, true, -40, 0, false)                
115
	elseif key == 76 then 
116
		tfm.exec.movePlayer(name, 0, 0, true, 40, 0, false)  
117
	end     
118
	end                
119
end
120
end