×

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
« ‹ 14 / 17 › »
[Module API] Errors
Alexpp
« Citoyen »
1426796700000
    • Alexpp#0000
    • Profil
    • Derniers messages
    • Tribu
#261
  0
velspar a dit :
Alexpp a dit :
try replace « table.getn(xyz) » to « #xyz »

Gives me this error: "Init Error : Velspar.lua:87: attempt to get length of number"

This function may be used by tables, not numbers.
Velspar
« Citoyen »
1426798320000
    • Velspar#0000
    • Profil
    • Derniers messages
    • Tribu
#262
  0
I know Im not using numbers(i think...)
Pretty much what im doing:

players = {}
function eventNewPlayer(name)
players[name] = {id = table.getn(players)}
end


So the their ID is however many is in the table when they join?
I think I might see the problem, but cant get lua to work...
Will have to get into this some other time :P
Booleando
« Citoyen »
1426802520000
    • Booleando#0000
    • Profil
    • Derniers messages
    • Tribu
#263
  0
players = {}
c=1

function eventNewPlayer(name)
players[name] ={id=c}
c=c+1
end

for k in pairs(tfm.get.room.playerList) do
eventNewPlayer(k)
end
Velspar
« Citoyen »
1426814940000
    • Velspar#0000
    • Profil
    • Derniers messages
    • Tribu
#264
  0
Found my mistakes, thanks for the help ;)

Dernière modification le 1426826880000
Fussbet
1427583480000
    • Fussbet#0000
    • Profil
    • Derniers messages
    • Tribu
#265
[Modéré par Shamousey, raison : OP quote.]
Xxx
« Citoyen »
1429472820000
    • Xxx#6197
    • Profil
    • Derniers messages
    • Tribu
#268
  0
function eventNewGame()
textArea = 0
ui.addTextArea(textArea, "", nil, -400, -300, 1600, 1200, nil, nil, 0, true)
ended = nil
for name, player in pairs(tfm.get.room.playerList) do
shaman[name] = player.isShaman or nil < mistake here index expected, got nil
tfm.exec.setPlayerScore(name, 1, true)
if player.inHardMode == 2 then
tfm.exec.killPlayer(name)
end
end
end
Alexpp
« Citoyen »
1429475880000
    • Alexpp#0000
    • Profil
    • Derniers messages
    • Tribu
#269
  0
Xxxgameover a dit :

shaman = {}
function eventNewGame()
textArea = 0
ui.addTextArea(textArea, "", nil, -400, -300, 1600, 1200, nil, nil, 0, true)
ended = nil
for name, player in pairs(tfm.get.room.playerList) do
shaman[name] = player.isShaman or nil &lt; mistake here index expected, got nil
tfm.exec.setPlayerScore(name, 1, true)
if player.inHardMode == 2 then
tfm.exec.killPlayer(name)
end
end
end
Aritefiku
1429622460000
    • Aritefiku#0000
    • Profil
    • Derniers messages
    • Tribu
#270
[Modéré par Shamousey, raison : Being banned isn't a module error. Talk to a moderator about it instead of posting it on the forums.]
Velspar
« Citoyen »
1429728780000
    • Velspar#0000
    • Profil
    • Derniers messages
    • Tribu
#271
  0
Just wondering if this a problem or not:
tfm.exec.movePlayer(playerName, xPosition, yPosition, offset)

Whenever I make the x and y Positions 0, I get this:
"Argument error."

If this is not a problem, it would be nice if this could be specified in the Lua documentation threads spoiler thing. I spent atleast 25 minutes trying to figure out where that error was coming from. '-'
Darkfeline
« Citoyen »
1431304140000
    • Darkfeline#2536
    • Profil
    • Derniers messages
#272
  0
Using this:

http://pastebin.com/tKG2SJ6Y

Mice aren't teleporting. Map is loading but, mice aren't teleporting.

Init Error : [string "Pinkiepawz.lua"]:156: 'end' expected (to close 'function' at line 145)
Woebegone
« Citoyen »
1431395280000
    • Woebegone#8377
    • Profil
    • Derniers messages
    • Tribu
#273
  0
pinkiepawz a dit :
Using this:

http://pastebin.com/tKG2SJ6Y

Mice aren't teleporting. Map is loading but, mice aren't teleporting.

Init Error : [string "Pinkiepawz.lua"]:156: 'end' expected (to close 'function' at line 145)

Did you copy the whole thing? When I tried it, it seemed fine.
Hiumee
« Citoyen »
1433276280000
    • Hiumee#9737
    • Profil
    • Derniers messages
    • Tribu
#274
  0
Why I can't bind 'W' key? I can only up arrow :(
There are more codes for a key? I think I used 87...
Shamousey
« Consul »
1433285640000
    • Shamousey#0095
    • Profil
    • Derniers messages
    • Tribu
#275
  0
Alexunutrei a dit :
Why I can't bind 'W' key? I can only up arrow :(
There are more codes for a key? I think I used 87...

Some keycodes are different with AZERTY/QWERTY keyboard. Letters W and Z are swapped, and letters Q and A are swapped. Try binding the opposite one to get it to work.
Philarry
« Citoyen »
1437713280000
    • Philarry#0000
    • Profil
    • Derniers messages
    • Tribu
#276
  0
a dit :
function eventChatCommand(name,anil)
if anil == mapcode then tfm.exec.newGame(mapcode)
end
end

I want it to type a !mapcode to change the map to the mapcode,but it doesnt work
Esh
« Censeur »
1437789240000
    • Esh#0095
    • Profil
    • Derniers messages
    • Tribu
#277
  0
Philarry a dit :
a dit :
function eventChatCommand(name,anil)
if anil == mapcode then tfm.exec.newGame(mapcode)
end
end

I want it to type a !mapcode to change the map to the mapcode,but it doesnt work

so, you don't need the condition if, just use this:

function eventChatCommand(name,anil)
tfm.exec.newGame(anil)
end
Taric
« Citoyen »
1438537500000
    • Taric#5206
    • Profil
    • Derniers messages
    • Tribu
#278
  0
Eshkation a dit :
Philarry a dit :
a dit :
function eventChatCommand(name,anil)
if anil == mapcode then tfm.exec.newGame(mapcode)
end
end

I want it to type a !mapcode to change the map to the mapcode,but it doesnt work

so, you don't need the condition if, just use this:

function eventChatCommand(name,anil)
tfm.exec.newGame(anil)
end

Need pcall:
function eventChatCommand(name,anil)
pcall(tfm.exec.newGame, anil)
end
Amrtast
« Censeur »
1441381260000
    • Amrtast#0000
    • Profil
    • Derniers messages
#279
  0
!Good job shamo, Thank

Dernière modification le 1451247300000
Eternity
« Citoyen »
1445297700000
    • Eternity#0622
    • Profil
    • Derniers messages
    • Tribu
#280
  0
Some scripts which used to work aren't working anymore.
I have no idea why.
  • Forums
  • /
  • Transformice
  • /
  • Modules
  • /
  • [Module API] Errors
« ‹ 14 / 17 › »
© Atelier801 2018

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

Version 1.27