×

Langue

Fermer
Atelier 801
  • Forums
  • Dev Tracker
  • Connexion
    • English Français
      Português do Brasil Español
      Türkçe Polski
      Magyar Română
      العربية Skandinavisk
      Nederlands Deutsch
      Bahasa Indonesia Русский
      中文 Filipino
      Lietuvių kalba 日本語
      Suomi עברית
      Italiano Česky
      Hrvatski Slovensky
      Български Latviešu
      Estonian
  • Langue
  • Forums
  • /
  • Transformice
  • /
  • Modules
  • /
  • Emote Shop
Emote Shop
Tactcat
« Citoyen »
1639745580000
    • Tactcat#0000
    • Profil
    • Derniers messages
    • Tribu
#1
  5
Ever wanted Twitch emotes in TFM? Well, now you can!
Inspired by #cbase bt

Type "!emoteshop"

I'm still working on this so some stuff might be wrong/bad/incomplete but as of now, it kinda works. Don't scroll too fast while browsing the emotes...
This script uses textarea ID's in the ~2000s so you should be able to copy-paste this into any module and it hopefully won't interfere with textarea ID's already in use!

https://i.imgur.com/z5exEsr.png

To do:
- Load/save from/to playerData
- Some kind of currency so that mice can buy emotes instead of all of them being available
- Make it less ugly...
- Build in a timer so they don't stay over your head forever <- done
- Add even more emotes?!

Put this in the top of your code:

Code Lua

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
local emotes = {
{'17d482ca23e.png',31,26},
{'17d482cb9b1.png',32,26},
{'17d482cd124.png',28,28},
{'17d482ce894.png',32,32},
{'17d482d0006.png',32,32},
{'17d482d17c4.png',28,20},
{'17d482d2f35.png',28,27},
{'17d482d46ac.png',32,30},
{'17d482d5e24.png',32,32},
{'17d482d7592.png',28,22},
{'17d482d8d03.png',32,32},
{'17d482da475.png',28,31},
{'17d482dbc01.png',32,27},
{'17d482dd358.png',31,32},
{'17d482deac9.png',80,19},
{'17d482e0239.png',31,32},
{'17d482e19a9.png',28,28},
{'17d482e311d.png',27,28},
{'17d482e488c.png',32,22},
{'17d482e5ffd.png',79,20},
{'17d482e776f.png',50,20},
{'17d482e8edf.png',80,20},
{'17d482ea652.png',80,19},
{'17d482ebdc3.png',32,31},
{'17d482ed535.png',80,20},
{'17d482eeca8.png',80,18},
{'17d482f0418.png',32,32},
{'17d482f1b89.png',32,22},
{'17d482f32f9.png',32,32},
{'17d482f4a6a.png',27,28},
{'17d482f61dc.png',22,32},
{'17d482f794c.png',26,32},
{'17d482f90bf.png',32,31},
{'17d482fa831.png',32,31},
{'17d482fbfa1.png',28,26},
{'17d482fd733.png',30,29},
{'17d482fee84.png',28,32},
{'17d483005f6.png',32,24},
{'17d48301d68.png',28,27},
{'17d483034db.png',28,25},
{'17d48304c4c.png',32,31},
{'17d483063be.png',28,27},
{'17d48307b2f.png',28,28},
{'17d483092a1.png',24,28},
{'17d4830aa11.png',24,28},
{'17d4830c183.png',28,28},
{'17d4830d8f5.png',28,28},
{'17d4830f068.png',38,20},
{'17d483107d9.png',32,32},
{'17d48311f4a.png',32,32},
{'17d483136ba.png',26,32},
{'17d48314e2c.png',28,28},
{'17d4831659d.png',8,21},
{'17d48317d11.png',32,32},
{'17d48319483.png',32,32},
{'17d4831abf5.png',28,28},
{'17d4831c365.png',32,32},
{'17d4831dad8.png',32,29},
{'17d4831f24a.png',28,32},
{'17d483209bb.png',28,22},
{'17d4a6e2300.png',31,32},
{'17d4a6e3a71.png',28,28},
{'17d4a6e5200.png',28,28},
{'17d4a6e6954.png',75,20},
{'17d4a6e80c6.png',32,30},
{'17d4a6e9838.png',28,22},
{'17d4a6eafa8.png',28,28},
{'17d4a6ec719.png',32,32},
{'17d4a6ede8b.png',32,32},
{'17d4a6ef5fe.png',27,28},
{'17d4a6f0d70.png',32,32},
{'17d4a6f2cb3.png',31,32},
{'17d4a6f4426.png',32,32},
{'17d4a6f636a.png',78,20},
{'17d4a6f8a7e.png',32,30},
{'17d4a6fa9c1.png',32,25},
{'17d4a6fc902.png',32,32},
{'17d4a6fe845.png',30,29},
{'17d4a6fffb7.png',28,22},
{'17d4a701728.png',28,28},
{'17d4a702e99.png',28,19},
{'17d4a70460a.png',28,28},
{'17d4a705d7b.png',32,32},
{'17d4a7074ed.png',26,32},
{'17d4a708c5f.png',28,28},
{'17d4a70a3d0.png',28,28},
{'17d4a70bb41.png',32,31},
{'17d4a70d2b2.png',31,32},
{'17d4a70ea24.png',32,32},
{'17d4a7101b3.png',32,22},
{'17d4a711909.png',28,19},
{'17d4a71307a.png',28,20},
{'17d4a7147ec.png',28,27},
{'17d4a715f5f.png',28,28}
}

local es_curr_emote = {}
local es_timer = {}
local es_player_emotes = {}
local es_player_shop_emotes = {}
local es_player_shop_emotes2 = {}
local es_page_tracker = {}
local es_selected_slot = {}

local emoteKeys = function(name,key,down,x,y)
local fkey = key-111
print(name.." pressed F"..fkey)
if es_curr_emote[name] then tfm.exec.removeImage(es_curr_emote[name]) end
es_curr_emote[name] = tfm.exec.addImage(emotes[es_player_emotes[name][fkey]][1], "$"..name, emotes[es_player_emotes[name][fkey]][2]-emotes[es_player_emotes[name][fkey]][2]*1.5, emotes[es_player_emotes[name][fkey]][3]-emotes[es_player_emotes[name][fkey]][3]*1.5-50)
es_timer[name] = os.time()
end

local es_Instantiate = function(name)
for i = 112, 119 do
tfm.exec.bindKeyboard(name,i,true,true)
end
es_player_emotes[name] = {math.random(1,94),math.random(1,94),math.random(1,94),math.random(1,94),math.random(1,94),math.random(1,94),math.random(1,94),math.random(1,94)}
es_player_shop_emotes[name] = {}
es_player_shop_emotes2[name] = {}
es_page_tracker[name] = 1
es_selected_slot[name] = 1
end

local es_displayClickableImage = function(id, event, x, y, name, updown)
ui.addTextArea(id,
"<textformat leftmargin='1' rightmargin='1'><a href='event:"
.. event .. "'>\n\n\n\n\n\n\n\n\n\n\n\n", name, x - 5, y - 5, 50, 80, 1, 1, 0.1,
true)
if updown == "down" then
ui.addTextArea(id,
"<textformat leftmargin='1' rightmargin='1'><a href='event:"
.. event .. "'><p align='center'>\n\n\n\nclick\n\n\n\n\n\n\n\n</p>", name, x - 5, y - 5, 50, 80, 1, 1, 0.1,
true)
end
end

local es_emojiBox = function(img, id, event, x, y, name)
local stringId = (id-2200)/2
es_player_shop_emotes[name][stringId] = tfm.exec.addImage(img, "&9", x+21, y+21, name, 1, 1, 0, 1, 0.5, 0.5)
es_displayClickableImage(id, event, x, y, name)
end

local es_emojiBox2 = function(img, id, event, x, y, name)
local stringId = id-2300
es_player_shop_emotes2[name][stringId] = tfm.exec.addImage(img, "&9", x+21, y+21, name, 1, 1, 0, 1, 0.5, 0.5)
es_displayClickableImage(id, event, x, y, name, "down")
end

local emojiPager = function(name, page)
local offsetX = 80
local offsetY = 150
local xGap = 85

for k,v in pairs(es_player_shop_emotes2[name]) do
if k then tfm.exec.removeImage(v) end
end

for i = 0,7 do
es_emojiBox2(emotes[i+page][1], 2301+i, "es_selector"..i+1, offsetX+(i*xGap), 225, name)
end
end

local emoteShopCallback = function(textAreaID, name, callback)
if textAreaID == 2202 then
ui.addTextArea(2219, "<font size='16'>V</font>", name, 80+13, 80, 15, 20, 1, 1, 0, true)
es_selected_slot[name] = tonumber(callback:sub(-1))
elseif textAreaID == 2204 then
ui.addTextArea(2219, "<font size='16'>V</font>", name, 165+13, 80, 15, 20, 1, 1, 0, true)
es_selected_slot[name] = tonumber(callback:sub(-1))
elseif textAreaID == 2206 then
ui.addTextArea(2219, "<font size='16'>V</font>", name, 250+13, 80, 15, 20, 1, 1, 0, true)
es_selected_slot[name] = tonumber(callback:sub(-1))
elseif textAreaID == 2208 then
ui.addTextArea(2219, "<font size='16'>V</font>", name, 335+13, 80, 15, 20, 1, 1, 0, true)
es_selected_slot[name] = tonumber(callback:sub(-1))
elseif textAreaID == 2210 then
ui.addTextArea(2219, "<font size='16'>V</font>", name, 420+13, 80, 15, 20, 1, 1, 0, true)
es_selected_slot[name] = tonumber(callback:sub(-1))
elseif textAreaID == 2212 then
ui.addTextArea(2219, "<font size='16'>V</font>", name, 505+13, 80, 15, 20, 1, 1, 0, true)
es_selected_slot[name] = tonumber(callback:sub(-1))
elseif textAreaID == 2214 then
ui.addTextArea(2219, "<font size='16'>V</font>", name, 590+13, 80, 15, 20, 1, 1, 0, true)
es_selected_slot[name] = tonumber(callback:sub(-1))
elseif textAreaID == 2216 then
ui.addTextArea(2219, "<font size='16'>V</font>", name, 675+13, 80, 15, 20, 1, 1, 0, true)
es_selected_slot[name] = tonumber(callback:sub(-1))
end

if callback == "closeES" then
for i = 2201,2221 do
ui.removeTextArea(i, name)
end
for i = 2301,2308 do
ui.removeTextArea(i, name)
end
for k,v in pairs(es_player_shop_emotes[name]) do
tfm.exec.removeImage(v)
end
for k,v in pairs(es_player_shop_emotes2[name]) do
tfm.exec.removeImage(v)
end
end

if callback == "leftEmoteShop" then
if es_page_tracker[name] > 1 then
es_page_tracker[name] = es_page_tracker[name]-1
emojiPager(name,es_page_tracker[name])
end
end

if callback == "rightEmoteShop" then
if es_page_tracker[name] < #emotes-7 then
es_page_tracker[name] = es_page_tracker[name]+1
emojiPager(name,es_page_tracker[name])
end
end

if callback:sub(1,11) == "es_selector" then
local selected = tonumber(callback:sub(-1))
local selectedEmote = tonumber(selected+es_page_tracker[name]-1)
es_player_emotes[name][tonumber(es_selected_slot[name])] = selectedEmote
tfm.exec.removeImage(es_player_shop_emotes[name][es_selected_slot[name]])
es_player_shop_emotes[name][es_selected_slot[name]] = tfm.exec.addImage(emotes[es_player_emotes[name][es_selected_slot[name]]][1], "&9", 80+21+((es_selected_slot[name]-1)*85), 121, name, 1, 1, 0, 1, 0.5, 0.5)
end
end

local cmdEmoteShop = function(name)
ui.addTextArea(2217, "<font size='16'>Emoji Shop</font> - click box to select", name, 50, 50, 700, 300, 0x324650, 0x212F36, 1, true)
ui.addTextArea(2201, "<p align='center'>F1</p>", name, 79, 150, 45, 15, 1, 1, 0, true)
es_emojiBox(emotes[es_player_emotes[name][1]][1], 2202, "emoji1", 80, 100, name)
ui.addTextArea(2203, "<p align='center'>F2</p>", name, 164, 150, 45, 15, 1, 1, 0, true)
es_emojiBox(emotes[es_player_emotes[name][2]][1], 2204, "emoji2", 165, 100, name)
ui.addTextArea(2205, "<p align='center'>F3</p>", name, 249, 150, 45, 15, 1, 1, 0, true)
es_emojiBox(emotes[es_player_emotes[name][3]][1], 2206, "emoji3", 250, 100, name)
ui.addTextArea(2207, "<p align='center'>F4</p>", name, 334, 150, 45, 15, 1, 1, 0, true)
es_emojiBox(emotes[es_player_emotes[name][4]][1], 2208, "emoji4", 335, 100, name)
ui.addTextArea(2209, "<p align='center'>F5</p>", name, 419, 150, 45, 15, 1, 1, 0, true)
es_emojiBox(emotes[es_player_emotes[name][5]][1], 2210, "emoji5", 420, 100, name)
ui.addTextArea(2211, "<p align='center'>F6</p>", name, 504, 150, 45, 15, 1, 1, 0, true)
es_emojiBox(emotes[es_player_emotes[name][6]][1], 2212, "emoji6", 505, 100, name)
ui.addTextArea(2213, "<p align='center'>F7</p>", name, 589, 150, 45, 15, 1, 1, 0, true)
es_emojiBox(emotes[es_player_emotes[name][7]][1], 2214, "emoji7", 590, 100, name)
ui.addTextArea(2215, "<p align='center'>F8</p>", name, 674, 150, 45, 15, 1, 1, 0, true)
es_emojiBox(emotes[es_player_emotes[name][8]][1], 2216, "emoji8", 675, 100, name)

ui.addTextArea(2219, "<font size='16'>V</font>", name, 80+13, 80, 15, 20, 1, 1, 0, true)
es_selected_slot[name] = 1

ui.addTextArea(2218, "<font size='16'><a href='event:closeES'>X</a></font>", name, 730, 55, 15, 20, 1, 1, 0, true)

ui.addTextArea(2220, "<font size='16'><a href='event:leftEmoteShop'>←</a></font>", name, 25, 250, 20, 20, 0x324650, 0x212F36, 1, true)
ui.addTextArea(2221, "<font size='16'><a href='event:rightEmoteShop'>→</a></font>", name, 755, 250, 20, 20, 0x324650, 0x212F36, 1, true)

emojiPager(name, es_page_tracker[name])
end

local removeEmote = function()
for name,player in pairs(tfm.get.room.playerList) do
if es_curr_emote[name] then
if os.time() - es_timer[name] >= 4000 then tfm.exec.removeImage(es_curr_emote[name]) end
end
end
end

for name,player in pairs(tfm.get.room.playerList) do
es_Instantiate(name)
end

Put this in your function eventLoop:

Code Lua

1
removeEmote()

Put this in your function eventKeyboard:

Code Lua

1
if key >= 112 and key <= 119 then emoteKeys(name,key,down,x,y) end

Put this in your function eventTextAreaCallback:

Code Lua

1
emoteShopCallback(textAreaID, name, callback)

Put this in your function eventNewPlayer:

Code Lua

1
es_Instantiate(name)

Put this in your function eventChatCommand:

Code Lua

1
if message=="emoteshop" then cmdEmoteShop(name) end

Remember to sub "name" for "playerName" if you have it like that and so forth.
For example, this is how it looks:

Code Lua

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
function eventChatCommand(name, message)
if message=="emoteshop" then cmdEmoteShop(name) end
end

function eventTextAreaCallback(textAreaID, name, callback)
emoteShopCallback(textAreaID, name, callback)
end

function eventLoop(elapsedTime, remainingTime)
removeEmote()
end

function eventKeyboard(name,key,down,x,y)
if key >= 112 and key <= 119 then emoteKeys(name,key,down,x,y) end
end

function eventNewPlayer(name)
es_Instantiate(name)
end

Dernière modification le 1667202720000
Lyfr
« Citoyen »
1642633800000
    • Lyfr#0000
    • Profil
    • Derniers messages
    • Tribu
#2
  0
Love it, i use it very frequently, cant wait for the update that make them not stay forever over our head :D
Kofamocter
« Citoyen »
1645735800000
    • Kofamocter#0000
    • Profil
    • Derniers messages
    • Tribu
#3
  0
POGGERS
Admiire_me
« Citoyen »
1657154760000
    • Admiire_me#6770
    • Profil
    • Derniers messages
#4
  0
Lyfr a dit :
Love it, i use it very frequently, cant wait for the update that make them not stay forever over our head :D

Soon (when i get a computer) i might be able to do it bcoz the owner doesn't post anything bout it, don't expect too much because i don't have any tribe to test it and also i kinda forgot how to do lua
Tactcat
« Citoyen »
1664660100000
    • Tactcat#0000
    • Profil
    • Derniers messages
    • Tribu
#5
  1
sorry guys.. easy to lose interest after the prototype works :p
Nnaaaz
« Citoyen »
1664668140000
    • Nnaaaz#0000
    • Profil
    • Derniers messages
    • Tribu
#6
  0
you got this Tac, waiting for the final work
Tactcat
« Citoyen »
1664728860000
    • Tactcat#0000
    • Profil
    • Derniers messages
    • Tribu
#7
  1
Nnaaaz a dit :
you got this Tac, waiting for the final work

big appreciate

update: the emotes are now timed and the script is using more specific names in the code (to prevent conflicts)
Tactcat
« Citoyen »
1667202600000
    • Tactcat#0000
    • Profil
    • Derniers messages
    • Tribu
#8
  1
update: after doing some testing i cleaned up peoples event functions and realized you can't have multiple of them, so that's fixed.. though now you gotta call the emoteshop functions in the event functions
(pls tell me how to make this easier)
Laiba
« Sénateur »
1675332180000
    • Laiba#5965
    • Profil
    • Derniers messages
#9
  1
Very nice!!
Tactcat
« Citoyen »
1682708700000
    • Tactcat#0000
    • Profil
    • Derniers messages
    • Tribu
#10
  3
i demand money
Grth_demon
« Citoyen »
1690406760000
    • Grth_demon#2154
    • Profil
    • Derniers messages
    • Tribu
#11
  0
its not working
Tactcat
« Citoyen »
1697921400000
    • Tactcat#0000
    • Profil
    • Derniers messages
    • Tribu
#12
  0
Grth_demon a dit :
its not working

throw an error in here or in a whisper in-game, i'll troubleshoot
  • Forums
  • /
  • Transformice
  • /
  • Modules
  • /
  • Emote Shop
© Atelier801 2018

Equipe Conditions Générales d'Utilisation Politique de Confidentialité Contact

Version 1.27