×

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
  • /
  • Archives
  • /
  • Module API FAQ
« ‹ 6 / 38 › »
Module API FAQ
Leafileaf
« Citoyen »
1377264360000
    • Leafileaf#0000
    • Profil
    • Derniers messages
    • Tribu
#101
  0
Tomdizzy a dit :
It is possible for a single subdomain to be down

Ok yea. Btw, congrats on the 100th post.

Someone please tell me something about my mod function...
Fxie
« Citoyen »
1377264480000
    • Fxie#0000
    • Profil
    • Derniers messages
    • Tribu
#102
  0
I can point out a few problems, but since I can't run Lua either I can't actually give you a fleshed-out solution. The following should be noted, however:

a dit :
elseif message=="makemod ^"

This is an exact match: you "makemod anyone" will not satisy this condition. Instead, you should use match, such as
elseif message:match("makemod %a+")

You can also use this to get the name straight from the message and save yourself a lot of time without that for loop by simply saying
local username=message:match("makemod (%a+)")
if tfm.get.room.playerList[username] then
-- players[username].mod=true
-- end


Also, you use "players" a lot, but it isn't defined anywhere. You should make that >.>

One last thing: by default, everything is global, so you really almost never need to use _G unless, for some odd reason, you use the same local and global variable names somewhere.
Leafileaf
« Citoyen »
1377266940000
    • Leafileaf#0000
    • Profil
    • Derniers messages
    • Tribu
#103
  0
Um, if I wasn't wrong, you don't have to define a variable to use it in Lua. So I guess my usage was legit :3

And thanks for the help Fxie, I'll add some acknowledgement in the minigame (not just the script). ^^
Shamousey
« Consul »
1377267300000
    • Shamousey#0095
    • Profil
    • Derniers messages
    • Tribu
#104
  0
Leafileaf a dit :
Um, if I wasn't wrong, you don't have to define a variable to use it in Lua. So I guess my usage was legit :3

And thanks for the help Fxie, I'll add some acknowledgement in the minigame (not just the script). ^^

If you don't define something, it doesn't exist, and therefore is nil and unusable.
Leafileaf
« Citoyen »
1377267840000
    • Leafileaf#0000
    • Profil
    • Derniers messages
    • Tribu
#105
  0
How do you even define something in Lua ._."
Shamousey
« Consul »
1377268080000
    • Shamousey#0095
    • Profil
    • Derniers messages
    • Tribu
#106
  0
Leafileaf a dit :
How do you even define something in Lua ._."

Using the = operator.

tableName = {}
variableName = 4
Leafileaf
« Citoyen »
1377270000000
    • Leafileaf#0000
    • Profil
    • Derniers messages
    • Tribu
#107
  0
Ok thanks. I'll declare the table.
Luisemma
« Citoyen »
1377270000000
    • Luisemma#0000
    • Profil
    • Derniers messages
    • Tribu
#108
  0
How to
Join Lua team shamousey plss
Shamousey
« Consul »
1377272400000
    • Shamousey#0095
    • Profil
    • Derniers messages
    • Tribu
#109
  0
Luisemma a dit :
How to
Join Lua team shamousey plss

That's outlined in the first post.
Safwanrockz
« Censeur »
1377294960000
    • Safwanrockz#0095
    • Profil
    • Derniers messages
    • Tribu
#110
  0
Can anyone give me a code that is similar to pictionary? Like there is a new command/message each round.
I asked shamo but apparently he was afk ;;
Shamousey
« Consul »
1377295740000
    • Shamousey#0095
    • Profil
    • Derniers messages
    • Tribu
#111
  0
a dit :
words={"pie","nipple","walrus","rose","heart","bacon"}

function eventNewGame()
word=words[math.random(#words)]
end

function eventChatCommand(name,command)
if command==word then
tfm.exec.chatMessage("Ding!")
end
end

I hope this helps, Safwan.
Safwanrockz
« Censeur »
1377295860000
    • Safwanrockz#0095
    • Profil
    • Derniers messages
    • Tribu
#112
  0
Thank you!
Epicshawty
« Citoyen »
1377398100000
    • Epicshawty#0000
    • Profil
    • Derniers messages
    • Tribu
#113
  0
How do you exactly run a room like do you go to like /room #abc and you put the code in there (if you're in the lua team)
Shamousey
« Consul »
1377398220000
    • Shamousey#0095
    • Profil
    • Derniers messages
    • Tribu
#114
  0
Epicshawty a dit :
How do you exactly run a room like do you go to like /room #abc and you put the code in there (if you're in the lua team)

1. Enter a room starting with # or *#, making sure the room name is 5 or more characters long.
2. Open the Lua prompt (/lua).
3. Enter the code in the text box.
4. Hit submit to excecute it.
Epicshawty
« Citoyen »
1377398400000
    • Epicshawty#0000
    • Profil
    • Derniers messages
    • Tribu
#115
  0
Shamousey a dit :
1. Enter a room starting with # or *#, making sure the room name is 5 or more characters long.
2. Open the Lua prompt (/lua).
3. Enter the code in the text box.
4. Hit submit to excecute it.

danke
:)
EDIT:
Suicide command a dit :
function.eventChatCommand(playerName,command)
if command=="mort" then
tfm.exec.killPlayer(playerName)
end
end
Shamousey
« Consul »
1377427320000
    • Shamousey#0095
    • Profil
    • Derniers messages
    • Tribu
#116
  0
a dit :
tfm.exec.killPlayer

>
a dit :
tfm.exec.killPlayer(playerName)

You seemed to miss that last bit out, Epicshawty.
Epicshawty
« Citoyen »
1377464040000
    • Epicshawty#0000
    • Profil
    • Derniers messages
    • Tribu
#117
  0
Shamousey a dit :
>


You seemed to miss that last bit out, Epicshawty.

im a beginner so yeah xD
i removed the (playerName) on purpose because I thought if you did like !mort Shamousey it killed you
so yeah xD
Fxie
« Citoyen »
1377464280000
    • Fxie#0000
    • Profil
    • Derniers messages
    • Tribu
#118
  0
playerName is the name of whoever typed the command, command is the full string

If you typed !mort Shamousey, playerName would be "Epicshawty" and command would be "mort Shamousey"
Epicshawty
« Citoyen »
1377464400000
    • Epicshawty#0000
    • Profil
    • Derniers messages
    • Tribu
#119
  0
Fxie a dit :
playerName is the name of whoever typed the command, command is the full string

If you typed !mort Shamousey, playerName would be "Epicshawty" and command would be "mort Shamousey"

thanks for the help :)
so playerName can avoid other players and it can't avoid you
that seems pretty cool
Cadencecool
« Citoyen »
1377474300000
    • Cadencecool#0000
    • Profil
    • Derniers messages
#120
  0
May i need some help??
Wanted to make a Minigame ..
  • Forums
  • /
  • Transformice
  • /
  • Archives
  • /
  • Module API FAQ
« ‹ 6 / 38 › »
© Atelier801 2018

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

Version 1.27