×

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
  • /
  • Script Requests
« ‹ 149 / 160 › »
Script Requests
Mutluerkek
« Citoyen »
1534837080000
    • Mutluerkek#8315
    • Profil
    • Derniers messages
    • Tribu
#2961
  0
Fixed code.
Pr0_tct0_ro666x
« Citoyen »
1534841160000
    • Pr0_tct0_ro666x#0306
    • Profil
    • Derniers messages
    • Tribu
#2962
  0
How to count elements in the array?

Dernière modification le 1534842540000
Boxofkrain
« Censeur »
1534849680000
    • Boxofkrain#0000
    • Profil
    • Derniers messages
    • Tribu
#2963
  2
I have code it allows VIP players to change nickname colour.
But when there are a lot of VIPs in room, code become buggy.
If someone use !nickcolor command and if this person is VIP, color picker will appear to him.
But sometimes LUA shows color pickers to other VIPs. I think the problem appears when two players use !nickcolor at the same time but I have no idea how to fix it.

Fragment of code:

Code Lua

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
  elseif com=="nickcolor" then
for player in next, tfm.get.room.playerList do
for i = 1, vipsnumber do
if player==vips[i] then
ui.showColorPicker(1, player, 0xffffff, "[VIP] Kolor nicku")
end
end
end
end
end

function eventColorPicked(id, player, color)
if id==1 then
tfm.exec.setNameColor(player, color)
end
end


In vips array I have all the VIPs.
I know the code can be funny for LUA pros but I'm still learning and sorry about that :D
Thx in advance.
Bolodefchoco
« Sénateur »
1534873080000
    • Bolodefchoco#0095
    • Profil
    • Derniers messages
    • Tribu
#2964
  5
Ryzjot a dit :
How to count elements in the array?

Use the operator #

#array

Boxofkrain a dit :
I have code it allows VIP players to change nickname colour.
But when there are a lot of VIPs in room, code become buggy.
If someone use !nickcolor command and if this person is VIP, color picker will appear to him.
But sometimes LUA shows color pickers to other VIPs. I think the problem appears when two players use !nickcolor at the same time but I have no idea how to fix it.

Fragment of code:

Code Lua

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
  elseif com=="nickcolor" then
for player in next, tfm.get.room.playerList do
for i = 1, vipsnumber do
if player==vips[i] then
ui.showColorPicker(1, player, 0xffffff, "[VIP] Kolor nicku")
end
end
end
end
end

function eventColorPicked(id, player, color)
if id==1 then
tfm.exec.setNameColor(player, color)
end
end


In vips array I have all the VIPs.
I know the code can be funny for LUA pros but I'm still learning and sorry about that :D
Thx in advance.

Suggestion: use sets

Code Lua

1
2
3
4
5
6
7
8
9
10
local vips = {
["Bolodefchoco#0000"] = true,
["You#0000"] = true,
}

eventChatCommand = function(playerName, command)
if vips[playerName] then -- you don't need all those loops
ui.showColorPicker(1, playerName, 0xffffff, "[VIP] Kolor nicku")
end
end
Pr0_tct0_ro666x
« Citoyen »
1534883820000
    • Pr0_tct0_ro666x#0306
    • Profil
    • Derniers messages
    • Tribu
#2965
  0
Thanks, you helped me a lot!
Kerberos
« Censeur »
1535117580000
    • Kerberos#4278
    • Profil
    • Derniers messages
    • Tribu
#2966
  0
Is it possible to add NPC in tribehouse (Like Bots in village but can't give item, title etc.)?
Honorabilis
« Consul »
1535119740000
    • Honorabilis#0000
    • Profil
    • Derniers messages
    • Tribu
#2967
  0
Kerberos a dit :
Is it possible to add NPC in tribehouse (Like Bots in village but can't give item, title etc.)?

kinda
Sebafrancuz
« Consul »
1535121540000
    • Sebafrancuz#0000
    • Profil
    • Derniers messages
    • Tribu
#2968
  0
Honorabilis a dit :
Kerberos a dit :
Is it possible to add NPC in tribehouse (Like Bots in village but can't give item, title etc.)?

kinda

It won't work in tribehouse, it uses Module team's functions (tfm.exec.addImage, system.newTimer).
Bolodefchoco
« Sénateur »
1535122440000
    • Bolodefchoco#0095
    • Profil
    • Derniers messages
    • Tribu
#2969
  4
Kerberos a dit :
Is it possible to add NPC in tribehouse (Like Bots in village but can't give item, title etc.)?

Well, I can make #bolodefchoco0npc for you. You just need to say what does the bot do and why you need it
Kerberos
« Censeur »
1535142000000
    • Kerberos#4278
    • Profil
    • Derniers messages
    • Tribu
#2970
  0
Bolodefchoco a dit :
Kerberos a dit :
Is it possible to add NPC in tribehouse (Like Bots in village but can't give item, title etc.)?

Well, I can make #bolodefchoco0npc for you. You just need to say what does the bot do and why you need it

Thanks a lot, I just wanna make my tribe house cooler *-*
Bolodefchoco
« Sénateur »
1535146320000
    • Bolodefchoco#0095
    • Profil
    • Derniers messages
    • Tribu
#2971
  4
Kerberos a dit :
Bolodefchoco a dit :
Kerberos a dit :
Is it possible to add NPC in tribehouse (Like Bots in village but can't give item, title etc.)?

Well, I can make #bolodefchoco0npc for you. You just need to say what does the bot do and why you need it

Thanks a lot, I just wanna make my tribe house cooler *-*

Ask Envidiame#0000 for the bot script I made. :P It doesn't move tho. It's just a map with some drawing answering stuff
Kerberos
« Censeur »
1535188740000
    • Kerberos#4278
    • Profil
    • Derniers messages
    • Tribu
#2972
  0
Bolodefchoco a dit :
Kerberos a dit :
Bolodefchoco a dit :
Kerberos a dit :
Is it possible to add NPC in tribehouse (Like Bots in village but can't give item, title etc.)?

Well, I can make #bolodefchoco0npc for you. You just need to say what does the bot do and why you need it

Thanks a lot, I just wanna make my tribe house cooler *-*

Ask Envidiame#0000 for the bot script I made. :P It doesn't move tho. It's just a map with some drawing answering stuff

Tysmmm
Ticktoxic
« Citoyen »
1535413500000
    • Ticktoxic#0930
    • Profil
    • Derniers messages
    • Tribu
#2973
  0
Could you make a windows error code? xD
Mutluerkek
« Citoyen »
1535468340000
    • Mutluerkek#8315
    • Profil
    • Derniers messages
    • Tribu
#2974
  1
Hi i need a pages system i try but not working :P
example :

LeaderBoard

#1 Name score
#2 Name score
#3 Name score
#4 Name score
#5 Name score

Next Page button

Next page :

#6 Name score
#7 Name score
#8 Name score
#9 Name score
#10 Name score

Previous page button

Dernière modification le 1535468400000
Athesdrake
« Citoyen »
1535555400000
    • Athesdrake#0000
    • Profil
    • Derniers messages
    • Tribu
#2975
  1
Mutluerkek a dit :
Hi i need a pages system i try but not working :P
example :

LeaderBoard

#1 Name score
#2 Name score
#3 Name score
#4 Name score
#5 Name score

Next Page button

Next page :

#6 Name score
#7 Name score
#8 Name score
#9 Name score
#10 Name score

Previous page button

One way doing this:
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
ranking = {
"Someone#0000",
"Someone#1234",
"Someone#1337",
"Someone#8457",
"Someone#0911",
"Someone#2018",
"Someone#5555"
-- ...
}
createLeaderboard = function(page)
local text = {} -- string concatenations with big string are really slow.
for i, playerName in next, {table.unpack(ranking, (page-1)*5+1, page*5)} do -- slice the table so you have 5 player at once.
table.insert(text, string.format("#%d %s", (page-1)*5+i, playerName)) -- don't forget to calculate the ranking position
end
return table.concat(text, "\n")
end

print(createLeaderboard(1))
--[[ #1 Someone#0000
#2 Someone#1234
#3 Someone#1337
#4 Someone#8457
#5 Someone#0911
]]
print(createLeaderboard(2))
--[[ #6 Someone#2018
#7 Someone#5555
]]

Dernière modification le 1535555460000
Mutluerkek
« Citoyen »
1535580720000
    • Mutluerkek#8315
    • Profil
    • Derniers messages
    • Tribu
#2976
  0
Athesdrake a dit :
Mutluerkek a dit :
Hi i need a pages system i try but not working :P
example :

LeaderBoard

#1 Name score
#2 Name score
#3 Name score
#4 Name score
#5 Name score

Next Page button

Next page :

#6 Name score
#7 Name score
#8 Name score
#9 Name score
#10 Name score

Previous page button

One way doing this:
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
ranking = {
"Someone#0000",
"Someone#1234",
"Someone#1337",
"Someone#8457",
"Someone#0911",
"Someone#2018",
"Someone#5555"
-- ...
}
createLeaderboard = function(page)
local text = {} -- string concatenations with big string are really slow.
for i, playerName in next, {table.unpack(ranking, (page-1)*5+1, page*5)} do -- slice the table so you have 5 player at once.
table.insert(text, string.format("#%d %s", (page-1)*5+i, playerName)) -- don't forget to calculate the ranking position
end
return table.concat(text, "\n")
end

print(createLeaderboard(1))
--[[ #1 Someone#0000
#2 Someone#1234
#3 Someone#1337
#4 Someone#8457
#5 Someone#0911
]]
print(createLeaderboard(2))
--[[ #6 Someone#2018
#7 Someone#5555
]]

oh why not think me thx men :^3
Choristos
« Citoyen »
1536689520000
    • Choristos#0299
    • Profil
    • Derniers messages
#2977
  0
How to destroy shaman object?
Bolodefchoco
« Sénateur »
1536696360000
    • Bolodefchoco#0095
    • Profil
    • Derniers messages
    • Tribu
#2978
  0
Choristos a dit :
How to destroy shaman object?

addShamanObject returns the object ID.

Once you have it (addShamanObject or a for in objectList), use tfm.exec.removeObject(ID)
Futardea
1537085820000
    • Futardea#0000
    • Profil
    • Derniers messages
#2979
[Modéré par Batt_mellamy, raison : Please speak English in the EN forums!]
Bolodefchoco
1537101780000
    • Bolodefchoco#0095
    • Profil
    • Derniers messages
    • Tribu
#2980
[Modéré par Batt_mellamy, raison : Reply to moderated post]
  • Forums
  • /
  • Transformice
  • /
  • Modules
  • /
  • Script Requests
« ‹ 149 / 160 › »
© Atelier801 2018

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

Version 1.27