×

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
« ‹ 22 / 38 › »
Module API FAQ
Makinit
« Citoyen »
1383347940000
    • Makinit#0095
    • Profil
    • Derniers messages
    • Tribu
#422
  0
Animjarcanin a dit :
Why tfm.get.room.objectList[id].x (for bomb) return a fake value ?

Some object types like bomb are not synced. So while the position appears to change client side, it will always stay the same on the server side.
Makinit
« Citoyen »
1383348180000
    • Makinit#0095
    • Profil
    • Derniers messages
    • Tribu
#424
  0
Animjarcanin a dit :
Thank you for the fast answer ! However, i can't make my module ! :(

You could consider using another object type like ball.
Orb
« Censeur »
1383409620000
    • Orb#0095
    • Profil
    • Derniers messages
    • Tribu
#426
  0
Do you need to be 18+ to be a coder/lua tester?
Hophipmice
« Citoyen »
1383409620000
    • Hophipmice#0000
    • Profil
    • Derniers messages
    • Tribu
#427
  0
Magicalorb a dit :
Do you need to be 18+ to be a coder?

You mean a lua tester? As I remember, no.
Tummnus
« Citoyen »
1383410940000
    • Tummnus#0000
    • Profil
    • Derniers messages
    • Tribu
#428
  0
Magicalorb a dit :
Do you need to be 18+ to be a coder?

I suppose you're talking about a Lua Tester? No. You just need to be able to have experience.
Personally I don't find a big use of being a Lua Tester other than helping since you're able to test your own code in your Tribe House if you have permission.
Sandermr
« Citoyen »
1383419520000
    • Sandermr#0000
    • Profil
    • Derniers messages
    • Tribu
#429
  0
Hi, I made a script which asks a question to all mice in the room and checks how many mice answered yes, then does an action depending on how many mice answered yes (in this case, half or more).

So it's working so far but I have a problem, if someone is afk or just not bothered to answer the question none of the actions are done so what I need added to the script is a way that if someone doesn't answer in X amount of time their answer becomes nil.

a dit :
function CheckMice()
mice=0
for player, name in pairs(tfm.get.room.playerList) do
mice=mice+1
end
end
CheckMice()

function Question()
answered=0
yes=0
ui.addPopup(99, 1, "<p align='center'><b>Question?</b></p>", nil, 250, 150, 250)
end
Question()

function eventPopupAnswer(id, name, ans)
if (id == 99) then
answered=answered+1
print(name.." answered: "..ans)
if (ans=="yes") then
yes=yes+1
end
print("Number of answers: "..answered)
print("Number of Yes: "..yes)

if (answered == mice) then
if (yes >= mice*0.5) then
-- Do something
else
-- Do something else
end
end
end
end

.
Mikuhl
« Citoyen »
1383421260000
    • Mikuhl#3311
    • Profil
    • Derniers messages
    • Tribu
#430
  0
Sandermr a dit :

It would be quite hard since if you arent a Lua Team member you cant use timers, but you could use eventLoop and variables.

eventLoop happens every .5 sec so once a variable reaches 30 when you add 1 to it each time it will equal one minute.
Issey
« Citoyen »
1383480960000
    • Issey#0000
    • Profil
    • Derniers messages
#431
  0
Sandermr a dit :

So it's working so far but I have a problem, if someone is afk or just not bothered to answer the question none of the actions are done so what I need added to the script is a way that if someone doesn't answer in X amount of time their answer becomes nil.

a dit :

mouse={}
function CheckMice()
mice=0
for player, name in pairs(tfm.get.room.playerList) do
mice=mice+1
end
end
CheckMice()

function Question()
answered=0
yes=0
time=0
n=true
ui.addPopup(99, 1, "text", nil, 250, 150, 250)
end
Question()

function eventPopupAnswer(id, name, ans)
if (id == 99) then
answered=answered+1
print(name.." answered: "..ans)
if (ans=="yes") then
mouse[name]={true}
yes=yes+1
end
print("Number of answers: "..answered)
print("Number of Yes: "..yes)

if (answered == mice) then
if (yes >= mice*0.5) then
-- Do something
else
-- Do something else
end
end
end
end

function eventLoop(ct,tr)
while n==true do
time=time+0.5
end
if(time>4) then
for name in pairs(tfm.get.room.playerList)
if not mouse[name]==true then
--then their answer=nil
end
end
end

i don't see a variable for a mouse' answer..?
Sandermr
« Citoyen »
1383481200000
    • Sandermr#0000
    • Profil
    • Derniers messages
    • Tribu
#432
  0
Issey a dit :
i don't see a variable for a mouse' answer..?

Sandermr a dit :
mice=0
mice=mice+1

.
Abdeltif
« Citoyen »
1383485820000
    • Abdeltif#0000
    • Profil
    • Derniers messages
    • Tribu
#433
  0
How can we use time with eventLoop(t ,tr) fonction
for example i have :

function eventLoop()
for i=1,1 do
tfm.exec.addShamanObject(0, 400, 200)
end

Please ?
Fluffyshine
« Citoyen »
1383486060000
    • Fluffyshine#0000
    • Profil
    • Derniers messages
    • Tribu
#434
  0
Abdeltif a dit :
How can we use time with eventLoop(t ,tr) fonction
for example i have :

function eventLoop()
for i=1,1 do
tfm.exec.addShamanObject(0, 400, 200)
end

Please ?

A timer?
Abdeltif
« Citoyen »
1383486060000
    • Abdeltif#0000
    • Profil
    • Derniers messages
    • Tribu
#435
  0
Fluffyshine a dit :
A timer?

No
A delay of 5 sc
Bruno
« Censeur »
1383490920000
    • Bruno#3852
    • Profil
    • Derniers messages
    • Tribu
#436
  0
How to use tfm.exec.get.room.playerList.playerName = Zzmacth?
Safwanrockz
« Censeur »
1383491400000
    • Safwanrockz#0095
    • Profil
    • Derniers messages
    • Tribu
#437
  0
Zzmacth a dit :
How to use tfm.exec.get.room.playerList.playerName = Zzmacth?

tfm.exec.get.room.playerList[name]
Add any [name] that exists in the room.
Bruno
« Censeur »
1383492720000
    • Bruno#3852
    • Profil
    • Derniers messages
    • Tribu
#438
  0
Safwanrockz a dit :
tfm.exec.get.room.playerList[name]
Add any [name] that exists in the room.

Error, this script doesn't work here. :'c
Shamousey
« Consul »
1383492840000
    • Shamousey#0095
    • Profil
    • Derniers messages
    • Tribu
#439
  0
Zzmacth a dit :
Error, this script doesn't work here. :'c

What exact code are you trying to run?
Bruno
« Censeur »
1383493080000
    • Bruno#3852
    • Profil
    • Derniers messages
    • Tribu
#440
  0
Shamousey a dit :
What exact code are you trying to run?

I need a code that identifies if I'm in the room, then print some information.
  • Forums
  • /
  • Transformice
  • /
  • Archives
  • /
  • Module API FAQ
« ‹ 22 / 38 › »
© Atelier801 2018

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

Version 1.27