[Module API] Errors |
Leafileaf « Citoyen » 1381848780000
| 0 | ||
Hophipmice a dit : You didn't bind mouse. You also didn't use the binded key (space). |
Benbirkralm « Citoyen » 1381849440000
| 0 | ||
[•] Runtime Error : transformice.lua:26: attempt to concatenate string and nil What is this? |
0 | ||
That means that the string you try to call doesn't exist. Can you show us line 26 please? |
Leafileaf « Citoyen » 1381851240000
| 0 | ||
Ok here's an example. a dit : The error will be returned ( assuming this is the only line in the code ) because playerName is nil. Here's a fix for this sample. a dit : This can be used in a function for example, so if playerName is undeclared, it is replaced with "Stranger". Hence preventing the error. |
0 | ||
What mean this: [•] Runtime Error : invalid key to 'next' |
Shamousey « Consul » 1382304600000
| 0 | ||
Ouake a dit : I've added a small explanation of this in the OP, which should help you to figure out what's wrong. |
0 | ||
tfm.exec.disableAutoShaman(true); function eventLoop(timePassed, timeLeft) if aliveMice == 0 or aliveMice < 0 or timeLeft < 1000 or timeLeft < 100 then pn = playerName doNextMap(); end end function doNextMap() tfm.exec.newGame(maplist[math.random(#maplist)]); end function eventNewGame() aliveMice = 0 tfm.exec.setUIMapName("<s>Meep<t> Cannon<vi> Racing<bl> (MCR)"); tfm.exec.setUIShamanName("<ch>#<v>MCR Halloween"); for name,_pn in pairs(tfm.get.room.playerList) do aliveMice = aliveMice+1 for player,name in pairs(tfm.get.room.playerList) do tfm.exec.giveMeep(player) end end end function eventPlayerLeft(pn) aliveMice = aliveMice-1 end function eventPlayerDied(pn) aliveMice = aliveMice-1 end function eventPlayerWon(pn) aliveMice = aliveMice-1 end tfm.exec.disableAutoNewGame(true); maplist = {"381043", "4408698", "229834", "1643157", "3535192"}; doNextMap(); function eventPlayerDied(playerName) end tfm.exec.disableAutoShaman(true); tfm.exec.disableAutoShaman(true); tfm.exec.setNameColor("Tinittee", 0xeb1d51) tfm.exec.setNameColor("Galaktine", 0xED67EA) tfm.exec.setNameColor("Pseudolag", 0x0ACCDF) tfm.exec.setNameColor("Doneky", 0xEB1D51) function eventChatCommand(name,command) end tfm.exec.disableAutoShaman(true); system.disableChatCommandDisplay('win', true) function eventChatCommand(name, comando) if comando=="page" then ui.addPopip(0,0, "Teste") function eventChatCommand(name, comando) if comando=="report" then ui.addPopup(0, 2, "Denúncia:<br>Digite o <b>nome</b> e o <b>motivo</b> da denúncia!") end end function eventPopupAnswer(ID, playerName, answer) print(playerName.."Denunciou o jogador: "..answer) end admins = {"Tinittee", "Dedavii"} system.disableChatCommandDisplay('br',true) system.disableChatCommandDisplay('ibr',true) system.disableChatCommandDisplay('mort',true) system.disableChatCommandDisplay('sz',true) system.disableChatCommandDisplay('vamp',true) system.disableChatCommandDisplay('cora', true) system.disableChatCommandDisplay('win', true) system.disableChatCommandDisplay('cheese', true) system.disableChatCommandDisplay('hole', true) system.disableChatCommandDisplay('page', true) function eventChatCommand(playerName,val) for i = 1, # admins do if val== "listadm" then local message = "Gerentes: " for _,adminName in pairs(admins) do message = message .. adminName .. ", " end message = message:sub(1,-3) .. "." ui.addTextArea(5,'<R>'..message..'', playerName, 200, 50, 370, 50, 0x324650, 0x9C5462, 1.1); ui.addTextArea(6,[[<r><A href="event:fecha">X</A>]], playerName,557, 25, 13,17,0x324650, 0x9C5462, 1.1); ui.addTextArea(17,'1/1', playerName,370, 108, 23,17,0x324650, 0xC5CCD0, 1.1); elseif (val:sub(0,6) == [[cheese]]) and playerName== admins then for playerName,_ in pairs(tfm.get.room.playerList) do if (playerName == val:sub(8)) then tfm.exec.giveCheese(playerName) elseif (val:sub(8) == [ tfm.exec.giveCheese(playerName) end end elseif val:sub(0,5) == "admin" and playerName== admins then table.insert(admins, i+1, val:sub(7)) ui.addPopup(9090, 0, ""..val:sub(7).." agora é um ADMIN.",name, 350, 200, 100) tfm.exec.setNameColor(playerName, 0x820709) elseif val:sub(0,5) == "unadm" and playerName== admins then table.remove(admins, i+1, val:sub(7)) ui.addPopup(9090, 0, ""..val:sub(7).." não é mais um ADMIN",name, 350, 200, 100) elseif (val:sub(0,3) == [[win]]) and playerName== admins then for playerName,_ in pairs(tfm.get.room.playerList) do if (playerName == val:sub(5)) then tfm.exec.giveCheese(playerName) tfm.exec.playerVictory(playerName) elseif (val:sub(5) == [ tfm.exec.giveCheese(playerName) tfm.exec.playerVictory(playerName) end end elseif (val:sub(0,4) == [[hole]]) and playerName== admins then for playerName,_ in pairs(tfm.get.room.playerList) do if (playerName == val:sub(6)) then tfm.exec.playerVictory(playerName) elseif (val:sub(6) == [ tfm.exec.playerVictory(playerName) end end elseif (val:sub(0,2) == [[rp]]) and playerName== admins then for playerName,_ in pairs(tfm.get.room.playerList) do if (playerName == val:sub(4)) then tfm.exec.respawnPlayer(playerName) elseif (val:sub(4) == [ tfm.exec.respawnPlayer(playerName) end end elseif (val:sub(0,4) == [[sham]]) and playerName== admins then for playerName,_ in pairs(tfm.get.room.playerList) do if (playerName == val:sub(6)) then tfm.exec.setShaman(playerName) tfm.exec.disableAllShamanSkills(true) elseif (val:sub(6) == [ tfm.exec.setShaman(playerName) tfm.exec.disableAllShamanSkills(true) end end elseif (val:sub(0,7) == [[mapname]]) and playerName== admins then tfm.exec.setUIMapName(val:sub(9)) elseif (val:sub(0,7) == [[shaname]]) and playerName== admins then tfm.exec.setUIShamanName(val:sub(9)) elseif (val:sub(0,3) == [[fly]]) and playerName== admins then for playerName,_ in pairs(tfm.get.room.playerList) do if (playerName == val:sub(5)) then tfm.exec.bindKeyboard(playerName,32,true,true) elseif (val:sub(5) == [ tfm.exec.bindKeyboard(playerName,32,true,true) end end elseif (val:sub(0,4) == [[ifly]]) and playerName== admins then for playerName,_ in pairs(tfm.get.room.playerList) do if (playerName == val:sub(6)) then tfm.exec.bindKeyboard(playerName,32,true,false) elseif (val:sub(6) == [ tfm.exec.bindKeyboard(playerName,32,true,false) end end elseif (val:sub(0,4) == [[vamp]]) and playerName== admins then for playerName,_ in pairs(tfm.get.room.playerList) do if (playerName == val:sub(6)) then tfm.exec.setVampirePlayer(playerName) elseif (val:sub(6) == [ tfm.exec.setVampirePlayer(playerName) end end elseif (val:sub(0,4) == [[kill]]) and playerName== admins then for playerName,_ in pairs(tfm.get.room.playerList) do if (playerName == val:sub(6)) then tfm.exec.killPlayer(playerName) elseif (val:sub(6) == [ tfm.exec.killPlayer(playerName) end end elseif (val:sub(0,2) == [[np]]) then tfm.exec.disableAutoShaman(true) tfm.exec.disableAutoTimeLeft(true) tfm.exec.disableAutoNewGame(true) tfm.exec.newGame(val:sub(4)) elseif (val:sub(0,3) == [[nch]]) then tfm.exec.disableAutoShaman(false) tfm.exec.disableAutoTimeLeft(true) tfm.exec.newGame(val:sub(5)) elseif (val:sub(0,3) == [[sth]]) then tfm.exec.disableAutoTimeLeft(false) tfm.exec.disableAutoShaman(true) tfm.exec.newGame(val:sub(5)) elseif (val:sub(0,3) == [[nth]]) then tfm.exec.disableAutoTimeLeft(true) tfm.exec.disableAutoShaman(true) tfm.exec.newGame(val:sub(5)) elseif val=="dnps" then tfm.exec.disableAutoShaman(true,false) tfm.exec.disableAutoTimeLeft(true,false) tfm.exec.disableAutoNewGame(false) tfm.exec.newGame() print('Ok!') elseif val=="mort" then tfm.exec.killPlayer(playerName) elseif val=="br" and playerName== admins then ui.addPopup(0,2,"Sua mensagem aqui.",playerName,300,100,200) elseif val=="ibr" and playerName== admins then ui.removeTextArea(0) elseif (val:sub(0,4) == [[meep]]) and playerName== admins then for playerName,_ in pairs(tfm.get.room.playerList) do if (playerName == val:sub(6)) then tfm.exec.giveMeep(playerName) elseif (val:sub(6) == [ tfm.exec.giveMeep(playerName) end end elseif val== "mep" then tfm.exec.giveMeep(playerName) elseif val=="rsp" then tfm.exec.respawnPlayer(playerName) elseif val=="nnp" then tfm.exec.newGame(math.random(1, 143)) elseif val=="cora" then for t=0,2*math.pi,0.05 do x=(16*math.sin(t)^3)*10+400 y=(13*math.cos(t)-5*math.cos(2*t)-2*math.cos(3*t)-math.cos(4*t))*10+200 y=400-y tfm.exec.addShamanObject(0,x,y) end elseif val=="cor" then ui.addPopup(1, 2, "Coloque o HEX de sua cor.",playerName, 300, 100, 200) end end end function eventPopupAnswer(id, name, answer) if id==0 then ui.addTextArea(0, "<vp>•<b> <rose>[~" .. name .."] <VP><lt>" .. answer .. "</b> ",BR, 10, 370, 780, 17,0x324650, 1.1) elseif id ==1 then tfm.exec.setNameColor(name, "0x"..answer) print(name.." mudou para a cor :"..answer) end end function eventNewPlayer(name) ui.addTextArea(4, [[<J><A href="event:abrir">Controle da Tribo</A>]], playerName, 10, 30, 105, 17, 0x324650, 0xBABD3B, 1.1); end function eventKeyboard(player,key) if (key == 32) then tfm.exec.movePlayer(player,0,0,true,0,-50,true) end end [•] Init Error : transformice.lua:274: [string "transformice.lua"]:76: unexpected symbol Dernière modification le 1404055320000 |
Candrai « Citoyen » 1382346720000
| 0 | ||
my Lua a dit : how to fix: [•] ui.addTextArea : argument 2 can't be NIL.? command: "!bunuh" and "!info" is not work, how to fix it? |
0 | ||
@Tinnitee Not really sure what is wrong there. :/ @Candrai a dit : Try this. |
Candrai « Citoyen » 1382351700000
| 0 | ||
Jordynl a dit : thank you |
0 | ||
Tinittee a dit : You should really work on properly indenting that. http://pastebin.com/LNDxJztW I think this'll fix some of your errors |
0 | ||
Issey a dit : I can confirm that it works now. :) So it was an indentation fail. I learned something today. :D |
0 | ||
Got Ouake a dit : When I added this command: a dit : e |
0 | ||
Magicalorb a dit : Would you mind posting the entire script? |
Shamousey « Consul » 1382979180000
| 0 | ||
Magicalorb a dit : You're using string keys, there's no need for the loop there. It'll always be correct on the first iteration of the table and try to remove it, this error is explained in the OP. Try something like this. a dit : |
Enginfener « Citoyen » 1383128400000
| 0 | ||
[•] Runtime Error : transformice.lua:119: index expected, got nil |
Papero « Citoyen » 1383128940000
| 0 | ||
Enginfener a dit : its be more than helpful if we could see the code? |
Sandermr « Citoyen » 1383351240000
| 0 | ||
Removed. |
Mousechris « Censeur » 1383362040000
| 0 | ||
addImage("http://imgur.com/u0xEIsk", "?1", 0, 0) tfm.exec.disableAutoNewGame(true) maps={0,1,2,3,4,5,6,7,8,9,10} function eventLoop(time,remaining) if remaining<=0 then tfm.exec.newGame(maps[math.random(#maps)]) end end function eventPlayerDied() local i=0 for n,player in pairs(tfm.get.room.playerList) do if not player.isDead then i=i+1 end end if i==0 then tfm.exec.newGame(maps[math.random(#maps)]) end end [•] Init Error : transformice.lua:1: attempt to call nil what did I do wrong |
Joaovictors « Citoyen » 1383362640000
| 0 | ||
Mousechris a dit : tfm.exec.addImage(...) ? |