×

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
  • /
  • [Tutorial] Crie tag de cores
[Tutorial] Crie tag de cores
Bolodefchoco
« Sénateur »
1552779780000
    • Bolodefchoco#0095
    • Profil
    • Derniers messages
    • Tribu
#1
  4

http://img.atelier801.com/1da4f24a.jpg



Funciona p/:
ui.addTextArea, ui.updateTextArea, tfm.exec.chatMessage, print

setColorTag(nomeTag, codigoCor)

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
local setColorTag
do
local colors = { }

setColorTag = function(tag, color)
assert(tag, "Missing tag.")
assert(color, "Missing color.")
if type(color) == "number" then
color = string.format("#%06x", color)
else
color = tostring(color)
if not string.find(color, '#') then
color = "#" .. color
end
end
tag = tostring(tag)
if not string.find(tag, "^<.->$") then
tag = "<" .. tag .. ">"
end
colors[#colors + 1] = { tag = tag, color = color }
end

local putColors = function(str)
for i = 1, #colors do
str = string.gsub(str, colors[i].tag, "<font color=\"" .. colors[i].color .. "\">")
end
return str
end

local addTextArea, updateTextArea, chatMessage, p = ui.addTextArea, ui.updateTextArea, tfm.exec.chatMessage, print
ui.addTextArea = function(id, str, ...)
return addTextArea(id, putColors(str), ...)
end
ui.updateTextArea = function(id, str, ...)
return updateTextArea(id, putColors(str), ...)
end
tfm.exec.chatMessage = function(str, ...)
return chatMessage(putColors(str), ...)
end
print = function(str)
return p(putColors(str))
end
end
Hugotitas
« Citoyen »
1552783740000
    • Hugotitas#0000
    • Profil
    • Derniers messages
    • Tribu
#2
  0
Ficou muito bom Bolo! Parabéns.
Larissa100
1552829820000
    • Larissa100#7382
    • Profil
    • Derniers messages
#3
[Modéré par Excasr, raison : Spam]
Tempo
« Consul »
1552845060000
    • Tempo#5571
    • Profil
    • Derniers messages
    • Tribu
#4
  0
Hugotitas a dit :
Ficou muito bom Bolo! Parabéns.
Rip
« Citoyen »
1552873920000
    • Rip#8110
    • Profil
    • Derniers messages
    • Tribu
#5
  0
Mt bim como sempre profissional
Sklag
« Citoyen »
1616713080000
    • Sklag#2552
    • Profil
    • Derniers messages
    • Tribu
#6
  0
n era mais facil fazer o seguinte?
local verde = "<VP>"

print(verde .. 'OI')

> Oi
Gamedroit
« Citoyen »
1616817600000
    • Gamedroit#3347
    • Profil
    • Derniers messages
    • Tribu
#7
  0
Sklag a dit :
n era mais facil fazer o seguinte?
local verde = "<VP>"

print(verde .. 'OI')

> Oi

Bem, mas neste caso você não poderia utilizar cores hex, por exemplo azul claro não tem tag, você teria que usar
Code Lua

1
print("<font color='#34ebd2'>Oi</font>")
Sklag
« Citoyen »
1644956640000
    • Sklag#2552
    • Profil
    • Derniers messages
    • Tribu
#8
  0
Gamedroit a dit :
Sklag a dit :
n era mais facil fazer o seguinte?
local verde = "<VP>"

print(verde .. 'OI')

> Oi

Bem, mas neste caso você não poderia utilizar cores hex, por exemplo azul claro não tem tag, você teria que usar
Code Lua

1
print("<font color='#34ebd2'>Oi</font>")

Isso que quis dizer
  • Forums
  • /
  • Transformice
  • /
  • Modules
  • /
  • [Tutorial] Crie tag de cores
© Atelier801 2018

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

Version 1.27