×

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
  • /
  • [Module API] Errors
« ‹ 16 / 17 › »
[Module API] Errors
Error_404
1478029980000
    • Error_404#0000
    • Profil
    • Derniers messages
#301
[Modéré par Jordy, raison : Fixed.]
R_ims
« Censeur »
1481244600000
    • R_ims#6168
    • Profil
    • Derniers messages
    • Tribu
#302
  1
function eventLoop(time, secTime)
for i=1,10 do
tfm.exec.addConjuration(10, 50, 5000)
tfm.exec.addConjuration(200, 50, 5000)
tfm.exec.addConjuration(150, 50, 5000)
tfm.exec.addConjuration(120, 50, 5000)
tfm.exec.addConjuration(100, 50, 5000)
tfm.exec.addConjuration(300, 50, 5000)
end
end
Saintgio
« Consul »
1481247780000
    • Saintgio#0000
    • Profil
    • Derniers messages
    • Tribu
#303
  0
pvsto a dit :
function eventLoop(time, secTime)
for i=1,10 do
tfm.exec.addConjuration(10, 50, 5000)
tfm.exec.addConjuration(200, 50, 5000)
tfm.exec.addConjuration(150, 50, 5000)
tfm.exec.addConjuration(120, 50, 5000)
tfm.exec.addConjuration(100, 50, 5000)
tfm.exec.addConjuration(300, 50, 5000)
end
end

I don't see the purpose of your post, whatever, your coordinates are out of range, for example: if i want to put the Conjuration in x=300 and y=200, it have to be tfm.exec.addConjuration(30, 20).
Dannyhpy
« Citoyen »
1481652900000
    • Dannyhpy#7433
    • Profil
    • Derniers messages
    • Tribu
#304
  0
Only the last command of this code is working...
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
-- COMMANDE CHEESE
function eventChatCommand(pseudo, message)
if message:sub(0,6) == "cheese" then
if message:sub(8) ~= "" then
ui.addTextArea(0, message:sub(8) .. " a reçu un fromage", nil, 350, 20)
tfm.exec.giveCheese(message:sub(8))
else
ui.addTextArea(0, pseudo .. " a reçu un fromage", nil, 350, 20)
tfm.exec.giveCheese(pseudo)
end
end
end
-- COMMANDE SHAMAN
function eventChatCommand(pseudo, message)
if message:sub(0,6) == "shaman" then
if message:sub(8) ~= "" then
ui.addTextArea(0, message:sub(8) .. " est maintenant chamane", nil, 350, 20)
tfm.exec.setShaman(message:sub(8))
else
ui.addTextArea(0, pseudo .. " est maintenant chamane", nil, 350, 20)
tfm.exec.setShaman(pseudo)
end
end
end
-- COMMMANDE KILL
function eventChatCommand(pseudo, message)
if message:sub(0,4) == "kill" then
if message:sub(6) ~= "" then
tfm.exec.killPlayer(message:sub(6))
ui.addTextArea(0, message:sub(6) .. " a été tué", nil, 350, 20)
else
tfm.exec.killPlayer(pseudo)
ui.addTextArea(0, pseudo .. " s\'est suicidé", nil, 350, 20)
end
end
end

Dernière modification le 1481653320000
Sebafrancuz
« Consul »
1481653800000
    • Sebafrancuz#0000
    • Profil
    • Derniers messages
    • Tribu
#305
  1
Dannyiy a dit :
Only the last command of this code is working...
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
-- COMMANDE CHEESE
function eventChatCommand(pseudo, message)
if message:sub(0,6) == "cheese" then
if message:sub(8) ~= "" then
ui.addTextArea(0, message:sub(8) .. " a reçu un fromage", nil, 350, 20)
tfm.exec.giveCheese(message:sub(8))
else
ui.addTextArea(0, pseudo .. " a reçu un fromage", nil, 350, 20)
tfm.exec.giveCheese(pseudo)
end
end
end
-- COMMANDE SHAMAN
function eventChatCommand(pseudo, message)
if message:sub(0,6) == "shaman" then
if message:sub(8) ~= "" then
ui.addTextArea(0, message:sub(8) .. " est maintenant chamane", nil, 350, 20)
tfm.exec.setShaman(message:sub(8))
else
ui.addTextArea(0, pseudo .. " est maintenant chamane", nil, 350, 20)
tfm.exec.setShaman(pseudo)
end
end
end
-- COMMMANDE KILL
function eventChatCommand(pseudo, message)
if message:sub(0,4) == "kill" then
if message:sub(6) ~= "" then
tfm.exec.killPlayer(message:sub(6))
ui.addTextArea(0, message:sub(6) .. " a été tué", nil, 350, 20)
else
tfm.exec.killPlayer(pseudo)
ui.addTextArea(0, pseudo .. " s\'est suicidé", nil, 350, 20)
end
end
end


You can't use the same event a lot's of time, then only the last one is working.
Try to create one eventChatCommand() :
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
function eventChatCommand(pseudo, message)
if message:sub(0,6) == "cheese" then
if message:sub(8) ~= "" then
ui.addTextArea(0, message:sub(8) .. " a reçu un fromage", nil, 350, 20)
tfm.exec.giveCheese(message:sub(8))
else
ui.addTextArea(0, pseudo .. " a reçu un fromage", nil, 350, 20)
tfm.exec.giveCheese(pseudo)
end
end
if message:sub(0,6) == "shaman" then
if message:sub(8) ~= "" then
ui.addTextArea(0, message:sub(8) .. " est maintenant chamane", nil, 350, 20)
tfm.exec.setShaman(message:sub(8))
else
ui.addTextArea(0, pseudo .. " est maintenant chamane", nil, 350, 20)
tfm.exec.setShaman(pseudo)
end
end
if message:sub(0,4) == "kill" then
if message:sub(6) ~= "" then
tfm.exec.killPlayer(message:sub(6))
ui.addTextArea(0, message:sub(6) .. " a été tué", nil, 350, 20)
else
tfm.exec.killPlayer(pseudo)
ui.addTextArea(0, pseudo .. " s\'est suicidé", nil, 350, 20)
end
end
end
Dannyhpy
« Citoyen »
1481653860000
    • Dannyhpy#7433
    • Profil
    • Derniers messages
    • Tribu
#306
  0
Thank you for your help! :)
And...
Code Lua

1
if hasTribe==NAME
Can we verify the tribe of the player?

Dernière modification le 1481654280000
Sebafrancuz
« Consul »
1481654760000
    • Sebafrancuz#0000
    • Profil
    • Derniers messages
    • Tribu
#307
  1
Dannyiy a dit :
Thank you for your help! :)
And...
Code Lua

1
if hasTribe==NAME
Can we verify the tribe of the player?

Sure you can:
Code Lua

1
2
3
for playerName, p in pairs(tfm.get.room.playerList) do
print(playerName.." tribe is "..p.tribeName)
end

if you want use it in different situation use:
Code Lua

1
tfm.get.room.playerList["Your_nick"].tribeName

Dernière modification le 1481654820000
Dannyhpy
« Citoyen »
1482000960000
    • Dannyhpy#7433
    • Profil
    • Derniers messages
    • Tribu
#308
  0
Hello,
And for add an admin for commands? (:
Tocutoeltuco
« Censeur »
1487791380000
    • Tocutoeltuco#0000
    • Profil
    • Derniers messages
#309
  0
Dannyiy a dit :
Hello,
And for add an admin for commands? (:

It's simple
Code Lua

1
2
3
4
5
6
7
8
9
10
11
admins={Danniyiy=true}--here you can put your admins, or use !admin name

function eventChatCommand(name,cmd)
if admins[name] then
if cmd:sub(0,5)=="admin" then
admins[cmd:sub(7)]=true
end
--admin commands here
end
--user commands here
end
Censere
« Consul »
1491545820000
    • Censere#0095
    • Profil
    • Derniers messages
    • Tribu
#310
  0
local map = ''

function main()
tfm.exec.disableAutoNewGame()
tfm.exec.disableAfkDeath()
tfm.exec.newGame(map)
end

function eventNewGame()

end

function eventNewPlayer(name)
tfm.exec.respawnPlayer(name)
end

function eventPlayerDied(name)
tfm.exec.respawnPlayer(name)
end

main()


I use this script to play maps directly from XML. How can I add the following?
Set the mapmaker name in info bar (Ex: @6935131) and set the mapcode in info bar (Ex: Censere) so it appears like a normal map played using /np
Make myself (Censere) always the shaman

I tried to use tfm.exec.setShaman(Censere) but I get an argument error, so I'm probably using it wrong, and I don't know how to set the map info. Can anyone help?

Edit: Answered elsewhere

Dernière modification le 1491614700000
Loghorizonph
« Citoyen »
1491801480000
    • Loghorizonph#0000
    • Profil
    • Derniers messages
    • Tribu
#311
  0
How Can I Spawn Cannon ball or Snowball pressing Letter S/ducking
Sebafrancuz
« Consul »
1492896660000
    • Sebafrancuz#0000
    • Profil
    • Derniers messages
    • Tribu
#312
  1
Loghorizonph a dit :
How Can I Spawn Cannon ball or Snowball pressing Letter S/ducking

Here you got very good tutorial made by Shamousey.
Dieingflame
« Citoyen »
1494896460000
    • Dieingflame#0000
    • Profil
    • Derniers messages
#313
  0
Hey, In A Pokelua Survivor Lobby, Something in chat Said Dieingflame Has Been Promoted and i did !help and it said i was admin so i tested it in a private room and now im admin in survivor pokelua (havent tested normal survivor)
Pegasusya7
« Citoyen »
1502355720000
    • Pegasusya7#0000
    • Profil
    • Derniers messages
#314
  0
one time, i was in a module and a bunch of ice in it im not sure if its a scam or error someone said its a scam though
King_seniru
« Censeur »
1522210380000
    • King_seniru#5890
    • Profil
    • Derniers messages
    • Tribu
#315
  0
OMG this code caused me severe lag and it didnt work properly. Can anyone help
Code Lua

1
2
3
4
5
6
7
time = 0
function eventLoop(t,r)
time = time + 1
while time < 30 do
print("hi" .. time)
end
end
King_seniru
« Censeur »
1522218780000
    • King_seniru#5890
    • Profil
    • Derniers messages
    • Tribu
#316
  1
Loghorizonph a dit :
How Can I Spawn Cannon ball or Snowball pressing Letter S/ducking

Try this
Spwan cannon when pressing s

Code Lua

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
--spawn cannons when pressing 's' 
players = tfm.get.room.playerList

function eventNewPlayer(name)
tfm.exec.bindKeyboard(name,83,false,true) -- binds the key
end


for name, data in next, players do
eventNewPlayer(name)
function eventKeyboard(name, key, down, x, y)
if key == 83 then -- chacking whether the key is 's'
if players[name].isFacingRight then -- checking the direction to spawn
tfm.exec.addShamanObject(17, players[name].x + 1, players[name].y + 5, 90,50 ,-20, false) --spawning the cannon
else
tfm.exec.addShamanObject(17, players[name].x -1, players[name].y + 5, 270 ,-20, false)
end
end
end
end

spawn snowballs when pressing s

Code Lua

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
players = tfm.get.room.playerList

function eventNewPlayer(name)
tfm.exec.bindKeyboard(name,83,false,true) -- binds the key
end


for name, data in next, players do
eventNewPlayer(name)
function eventKeyboard(name, key, down, x, y)
if key == 83 then -- chacking whether the key is 's'
if players[name].isFacingRight then -- checking the direction to spawn
tfm.exec.addShamanObject(34, players[name].x + 1, players[name].y , 90,50 ,-20, false) --spawning the cannon
else
tfm.exec.addShamanObject(34,players[name].x -1, players[name].y , 270 ,-20, false)
end
end
end
end
Intas
« Citoyen »
1522235040000
    • Intas#0123
    • Profil
    • Derniers messages
#317
  0
King_seniru a dit :
OMG this code caused me severe lag and it didnt work properly. Can anyone help

Code Lua

1
2
3
4
5
6
7
8
time = 0

function eventLoop(t,r)
time = time + 1
if time < 30 then
print("hi " .. time)
end
end

Notice that eventLoop is called every half a second, so time will get to 30 after 15 seconds. If you want to do something the first 30 seconds, do time = time + 0.5 instead.
King_seniru
« Censeur »
1522237140000
    • King_seniru#5890
    • Profil
    • Derniers messages
    • Tribu
#318
  1
Intas a dit :
King_seniru a dit :
OMG this code caused me severe lag and it didnt work properly. Can anyone help

Code Lua

1
2
3
4
5
6
7
8
time = 0

function eventLoop(t,r)
time = time + 1
if time < 30 then
print("hi " .. time)
end
end

Notice that eventLoop is called every half a second, so time will get to 30 after 15 seconds. If you want to do something the first 30 seconds, do time = time + 0.5 instead.

NO thats not the problem. It prints like this
hi'time'(12032) -- not like this but a very big number. the code run at onc without looping every 0.5 sec.
and cause lag
>my ping was about 29000
Sebafrancuz
« Consul »
1522237680000
    • Sebafrancuz#0000
    • Profil
    • Derniers messages
    • Tribu
#319
  0
King_seniru a dit :
Intas a dit :
King_seniru a dit :
OMG this code caused me severe lag and it didnt work properly. Can anyone help

Code Lua

1
2
3
4
5
6
7
8
time = 0

function eventLoop(t,r)
time = time + 1
if time < 30 then
print("hi " .. time)
end
end

Notice that eventLoop is called every half a second, so time will get to 30 after 15 seconds. If you want to do something the first 30 seconds, do time = time + 0.5 instead.

NO thats not the problem. It prints like this
hi'time'(12032) -- not like this but a very big number. the code run at onc without looping every 0.5 sec.
and cause lag
>my ping was about 29000

Your "while loop" was infinite because your variable "time" was all the time 0 ( I mean in loop ), so lower than 30.

While is like a waiting for a condition which is false.
So if you gave time < 30 then its waiting for time == 30 when it will stop.
You gave time = time + 1 out of a loop so it waited infinitely.

Dernière modification le 1522238040000
King_seniru
« Censeur »
1522292580000
    • King_seniru#5890
    • Profil
    • Derniers messages
    • Tribu
#320
  1
Well now that code i have given is workingwell. Maybe some bug or a connection problem. TY
  • Forums
  • /
  • Transformice
  • /
  • Modules
  • /
  • [Module API] Errors
« ‹ 16 / 17 › »
© Atelier801 2018

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

Version 1.27