×

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
« ‹ 4 / 38 › »
Module API FAQ
Nox
« Citoyen »
1376872140000
    • Nox#2215
    • Profil
    • Derniers messages
    • Tribu
#61
  0
This is weird but... I know nothing about programming languages. I once learned a bit of Python. I want to make this game for my tribe, do I use the /lua popup for scripting?
Haruhitastic
« Censeur »
1376872440000
    • Haruhitastic#0000
    • Profil
    • Derniers messages
    • Tribu
#62
  0
Only if you have permissions to.
Also, you can't run Python in /lua. You'll have to convert it.
Tommhawk
« Citoyen »
1376892000000
    • Tommhawk#0000
    • Profil
    • Derniers messages
#63
  0
Ah,I'll just be waiting till you're actually able to run Lua in tribehouse ;;
Jordy
« Consul »
1376892540000
    • Jordy#0015
    • Profil
    • Derniers messages
    • Tribu
#64
  0
Take a look at lua, It really isn't that easy that you directly can write full scripts for your tribe house when it gets released. :P

http://www.phailed.me/2011/02/learn-lua-the-hard-way-1/
Fxie
« Citoyen »
1376896620000
    • Fxie#0000
    • Profil
    • Derniers messages
    • Tribu
#65
  0
It was to me and I still can't run it
Sandermr
« Citoyen »
1377169020000
    • Sandermr#0000
    • Profil
    • Derniers messages
    • Tribu
#66
  0
Will we be able to progam to kick anyone from who does meet tribe requirements and give ranks automatically so we don't have to log into Moepl's tribe bots?
Shamousey
« Consul »
1377169380000
    • Shamousey#0095
    • Profil
    • Derniers messages
    • Tribu
#67
  0
Sandermr a dit :
Will we be able to progam to kick anyone from who does meet tribe requirements and give ranks automatically so we don't have to log into Moepl's tribe bots?

It'll stay dedicated to minigames, with no additional tribe-oriented functions.
Safwanrockz
« Censeur »
1377170040000
    • Safwanrockz#0095
    • Profil
    • Derniers messages
    • Tribu
#68
  0
Sandermr a dit :
Will we be able to progam to kick anyone from who does meet tribe requirements and give ranks automatically so we don't have to log into Moepl's tribe bots?

Admis have already mentioned that you will be able to only program/code lua in your tribe houses, just like Shamo said, no additional tribe functions.
Leafileaf
« Citoyen »
1377172440000
    • Leafileaf#0000
    • Profil
    • Derniers messages
    • Tribu
#69
  0
Jordynl a dit :
We have to your aknowledge in lua and scripting. So make up a good lua script with comments of what everything does, Post it at: http://paste.moepl.eu And post it here.

:/

I posted it in PasteBin.

Anyway, I'm back with some code, and here's the link. http://pastebin.com/W00yxULt

Some kind-hearted soul please help me see if I made any mistakes in it.

EDIT: I didn't comment everything (some comments here and there though, for people wishing to understand parts that I deem more complicated), the code was pretty straight-forward.
Shamousey
« Consul »
1377172680000
    • Shamousey#0095
    • Profil
    • Derniers messages
    • Tribu
#70
  0
There's no access to "require", "sleep", or "socket" methods.

You're using "tfm.get.room.playerList[playerName].x", which can be a bit laggy, in eventKeyboard, while the event itself passes the player's x and y co-ordinates.

"if bestTime then else" would probably be better off as "if not bestTime then".

You need a "then" after an if or elseif statement.

As it stands, your code gives the following error:
a dit :
[•] Init Error : [string "transformice.lua"]:44: 'then' expected

[url][/url]
Leafileaf
« Citoyen »
1377173220000
    • Leafileaf#0000
    • Profil
    • Derniers messages
    • Tribu
#71
  0
Shamousey a dit :
There's no access to "require", "sleep", or "socket" methods.

You're using "tfm.get.room.playerList[playerName].x", which can be a bit laggy, in eventKeyboard, while the event itself passes the player's x and y co-ordinates.

"if bestTime then else" would probably be better off as "if not bestTime then".

You need a "then" after an if or elseif statement.

As it stands, your code gives the following error:
[url][/url]

Thanks, I'll edit it. EDIT: Edited. The "then" has been rectified and I changed the if statement.

P.S. What is a possible solution to remove or reduce the lag for "tfm.get.room.playerList[playerName].x"? Do I put "nil"?
Fxie
« Citoyen »
1377173340000
    • Fxie#0000
    • Profil
    • Derniers messages
    • Tribu
#72
  0
Stopping the script stops the script for everyone period, so it's not a good idea any way you look at it. You can use system.newTimer to create an event that occurs after a set timeframe, such as

system.newTimer(function()
-- tfm.exec.respawnPlayer(playerName)
-- tfm.exec.chatMessage("Spawned ye matey!",playerName)
-- end,5000)

Note it uses ms, so 5000 is 5s
Leafileaf
« Citoyen »
1377173460000
    • Leafileaf#0000
    • Profil
    • Derniers messages
    • Tribu
#73
  0
Fxie a dit :
Stopping the script stops the script for everyone period, so it's not a good idea any way you look at it. You can use system.newTimer to create an event that occurs after a set timeframe, such as

system.newTimer(function()
-- tfm.exec.respawnPlayer(playerName)
-- tfm.exec.chatMessage("Spawned ye matey!",playerName)
-- end,5000)

Thanks a lot! :3
Shamousey
« Consul »
1377174000000
    • Shamousey#0095
    • Profil
    • Derniers messages
    • Tribu
#74
  0
Leafileaf a dit :
P.S. What is a possible solution to remove or reduce the lag for "tfm.get.room.playerList[playerName].x"?

You can't, that relies on the sync updating the player's co-ordinates which doesn't happen all that often. You could keep your own based on when a player presses a key, if you needed.
Fxie
« Citoyen »
1377174360000
    • Fxie#0000
    • Profil
    • Derniers messages
    • Tribu
#75
  0
Speaking of keeping your own: you should look up using variables and eventually objects if you don't know about those things. I didn't see any variables at all in your code. Althrough the keyboard function provides realtime x/y in its parameters, your code could've been

local player=tfm.get.room.playerList[playerName]

then just player.x and player.y for each instance where used. That's just being efficient.
Leafileaf
« Citoyen »
1377174360000
    • Leafileaf#0000
    • Profil
    • Derniers messages
    • Tribu
#76
  0
Fxie a dit :
Speaking of keeping your own: you should look up using variables and eventually objects if you don't know about those things. I didn't see any variables at all in your code. Althrough the keyboard function provides realtime x/y in its parameters, your code could've been

local player=tfm.get.room.playerList[playerName]

then just player.x and player.y for each instance where used. That's just being efficient.

Sure, I didn't think of that. What with learning Lua and all the TFM Module API functions.....

Oh, and I did use a variable to keep track of time.
Fxie
« Citoyen »
1377174780000
    • Fxie#0000
    • Profil
    • Derniers messages
    • Tribu
#77
  0
Oh let me lecture you on that too then

"a" (might be convenient for readability by both yourself and others to use more specific names) is actually the current time (in ms), so you could have a more precise time record by simply setting timeCounter to "a," or a/1000 to convert to regular seconds.
Leafileaf
« Citoyen »
1377174900000
    • Leafileaf#0000
    • Profil
    • Derniers messages
    • Tribu
#78
  0
Fxie a dit :
Oh let me lecture you on that too then

"a" (might be convenient for readability by both yourself and others to use more specific names) is actually the current time (in ms), so you could have a more precise time record by simply setting timeCounter to "a," or a/1000 to convert to regular seconds.

The event loop only executes once every 500ms so it's practically the same. I don't see any point changing that bit.
Fxie
« Citoyen »
1377175020000
    • Fxie#0000
    • Profil
    • Derniers messages
    • Tribu
#79
  0
Just good practice. Also helps if, by any "unusual" chance, eventLoop is horribly coded in such a way that lag does affect regularity of intervals. Y'know, incase Tig had anything to do with it.
Leafileaf
« Citoyen »
1377175680000
    • Leafileaf#0000
    • Profil
    • Derniers messages
    • Tribu
#80
  0
Fxie a dit :
Just good practice. Also helps if, by any "unusual" chance, eventLoop is horribly coded in such a way that lag does affect regularity of intervals. Y'know, incase Tig had anything to do with it.

Ahem yea, maybe. Ok I shall implement your suggestion :P EDIT: Done.

Is there anything else I can/should change in there?
  • Forums
  • /
  • Transformice
  • /
  • Archives
  • /
  • Module API FAQ
« ‹ 4 / 38 › »
© Atelier801 2018

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

Version 1.27