Module API FAQ |
Mikuhl « Citoyen » 1378341480000
| 0 | ||
Bigcrushes a dit : *cringe* |
Bigcrushes « Citoyen » 1378367700000
| 0 | ||
Jaackster a dit : are u from lua? did u test meh script? it failed didnt it |
0 | ||
Bigcrushes a dit : Jaackster is not in the lua group as far as I know. About your script (I didn't test it either but I'll mention some things I saw after looking at it): - line 8: tfm.exec.killPlayer is a function: e.g do tfm.exec.killPlayer(playerName) - similiar on line 10 and 17 - line 15 and 19: functions don't work like that in lua. You might want to try to write some simple lua code first before doing transformice scripts Check this out: http://www.lua.org/cgi-bin/demo |
Bigcrushes « Citoyen » 1378393800000
| 0 | ||
Moepl a dit : thx moepl, my friend has made an editted version that works already of my script. I have a lot of work to do ._. thx for the website |
Epicshawty « Citoyen » 1378413780000
| 0 | ||
Does this make everyone shaman in a new round? a dit : I'm a beginner. |
Thewav « Citoyen » 1378413900000
| 0 | ||
Yes but need end to close the for loop |
Epicshawty « Citoyen » 1378414080000
| 0 | ||
Thewav a dit : where do i put that? just make an example so i know :P |
Shamousey « Consul » 1378414080000
| 0 | ||
You need to end both the function and the for loop, just make sure there's an end for each of them. |
Epicshawty « Citoyen » 1378414200000
| 0 | ||
Shamousey a dit : Oh, okay. |
0 | ||
that's one of the more annoying bits of lua not using conventional curly braces. |
Epicshawty « Citoyen » 1378417260000
| 0 | ||
that part where you cant find in the module api documentation on how to make the last person standing win lel |
0 | ||
function eventPlayerDied() > local winner > for name,player in pairs(tfm.get.room.playerList) do > > if not player.isDead then > > > if not winner then > > > > winner=name > > > else > > > > return > > > > end > > > end > > end > tfm.exec.chatMessage(winner.." is the last person standing!") > end basically abort the function (return) if there are two people alive (another winner after one has been found), if there is only one winner then their name is set and yo ucan use it for whatever. |
Mikuhl « Citoyen » 1378420860000
| 0 | ||
Bigcrushes a dit : Im not in the lua team yet. (Hopefully I will be soon!) |
Epicshawty « Citoyen » 1378432980000
| 0 | ||
Jaackster a dit : me too lel |
0 | ||
samei cant wait |
Epicshawty « Citoyen » 1378438500000
| 0 | ||
Fxie a dit : lezz celebr8 |
Bigcrushes « Citoyen » 1378439040000
| 0 | ||
Epicshawty a dit : i wanna celebr8 too! Can someone pls gimme the lua code to split mice into teams? |
0 | ||
local players={} local teams={{},{},{}} for name,player in pairs(tfm.get.room.playerList) do > table.insert(players,name) > end table.sort(players,function() return math.random()>0.5 end) for i,player in ipairs(players) do > table.insert(teams[i%#teams],player) > end this will give you 3 teams of random people you can just keep adding to the team objects for more or remove for less teams[1], teams[2], teams[3], etc. are your teams teams[1] = [ "Fxie", "Someone else", "So on"] teams[2] = [ "You", "Bigcrushes", "Souris"] teams[3] = [ "Rad", "Ical", "Sillyputty"] i obviously can't test this but it should work even though I just wrote it on the spot. |
Bigcrushes « Citoyen » 1378471260000
| 0 | ||
Fxie a dit : ty *-* i thot u in lua? why cant u test it? and i never knew "%#" were used in lua :o got a lot to learn.... |
0 | ||
To get the number of items in an index table (table={1,2,3}) you use #table So if you make the table players = { "Me", "Myself", "I" } then #players will be 3 % is modulus, it gives you the remainder of a/b. You don't really need to know that to do basic stuff in Lua, it's more "advanced." Don't worry yourself with it until you have the basics down. |