×

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
  • /
  • Modules
  • /
  • Script Requests
« ‹ 25 / 160 › »
Script Requests
Pmcarpan
« Citoyen »
1384403940000
    • Pmcarpan#0000
    • Profil
    • Derniers messages
    • Tribu
#481
  0
Kmlcan a dit :
Uh, I can't use down thingy in eventKeyboard, can anybody give me an example? How can I use that?

Down thingy as in down arrow(keycode 40)? Seems to work for me. Depends on what you're trying to do.

sample code a dit :


for name,player in pairs(tfm.get.room.playerList) do
tfm.exec.bindKeyboard(name,40,true,true)
tfm.exec.setPlayerScore(name,0,false)
end

function eventKeyboard(name,id,pressed,px,py)
if id==40 and pressed==true then
tfm.exec.setPlayerScore(name,1,true)
end
end


I used the code above, and it works for me.
Safwanrockz
« Censeur »
1384416120000
    • Safwanrockz#0095
    • Profil
    • Derniers messages
    • Tribu
#482
  0
Pmcarpan a dit :
Down thingy as in down arrow(keycode 40)? Seems to work for me. Depends on what you're trying to do.
I used the code above, and it works for me.

Ah, so "press" is boolean, now I get it.
Choompexx
1384434900000
    • Choompexx#0000
    • Profil
    • Derniers messages
    • Tribu
#483
[Modéré par Ramenfrog, raison : Spam.]
Empty
1384473960000
    • Empty#8994
    • Profil
    • Derniers messages
    • Tribu
#484
[Modéré par Takumisyn, raison : Advertisement / Spam]
Mertocinokl
« Citoyen »
1384539900000
    • Mertocinokl#0000
    • Profil
    • Derniers messages
    • Tribu
#485
  0
write !stats Repeating the player's statistics to come out ta ensure that popup?
Shamousey
« Consul »
1384540140000
    • Shamousey#0095
    • Profil
    • Derniers messages
    • Tribu
#486
  0
Mertocinokl a dit :
write !stats Repeating the player's statistics to come out ta ensure that popup?

You can't get the player's stats through Lua. It's an intended feature but doesn't work.
Mertocinokl
« Citoyen »
1384540260000
    • Mertocinokl#0000
    • Profil
    • Derniers messages
    • Tribu
#487
  0
okay . Thank you.
Sandermr
« Citoyen »
1384546920000
    • Sandermr#0000
    • Profil
    • Derniers messages
    • Tribu
#488
  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 because it waits for that afk to answer 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 or something like that.

Script:
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, "Question", 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

.
Pmcarpan
« Citoyen »
1384590180000
    • Pmcarpan#0000
    • Profil
    • Derniers messages
    • Tribu
#489
  0
Sandermr a dit :
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 because it waits for that afk to answer 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 or something like that.

Well you could use something like an eventLoop configured to put answered==mice at a certain point.

implement this in the code a dit :

if remaining<=timeinmilliseconds then
answered==mice
eventPopupAnswer(99, "No one", "no answer")
end

That should do it probably.
Doneky
« Citoyen »
1384637280000
    • Doneky#0000
    • Profil
    • Derniers messages
    • Tribu
#490
  0
a dit :
tfm.exec.disableAutoNewGame(true)
tfm.exec.disableAutoShaman(true)
tfm.exec.newGame("@3238402")

coord1 = {}

for name,player in pairs(tfm.get.room.playerList) do
tfm.exec.bindKeyboard(name,32,true,true)
end

function eventKeyboard(name,tecla,press,x,y)
if not coord1[name] and not tfm.get.room.playerList[name].isDead and tfm.get.room.currentMap == "@3238402" and tecla == 32 and press == true and x>=355 and x<=390 and y>=250 and y<=270 then
tfm.exec.setPlayerScore(name,1,true)
tfm.exec.chatMessage("<font color='#A4D0E7'><b>~</b> Você adiquiriu <b>1</b> ponto.</font>",name)
coord1[name] = true
end
end

Someone know if there's another form of do this that not occupy many lines?
Orb
« Censeur »
1384686060000
    • Orb#0095
    • Profil
    • Derniers messages
    • Tribu
#491
  0
Doneky a dit :
Someone know if there's another form of do this that not occupy many lines?

Use a lua minifier

Lua minifier a dit :

tfm.exec.disableAutoNewGame(true)tfm.exec.disableAutoShaman(true)tfm.exec.newGame("@3238402")coord1={}for a,b in pairs(tfm.get.room.playerList)do tfm.exec.bindKeyboard(a,32,true,true)end;function eventKeyboard(a,c,d,e,f)if not coord1[a]and not tfm.get.room.playerList[a].isDead and tfm.get.room.currentMap=="@3238402"and c==32 and d==true and e>=355 and e<=390 and f>=250 and f<=270 then tfm.exec.setPlayerScore(a,1,true)tfm.exec.chatMessage("<font color='#A4D0E7'><b>~</b> Você adiquiriu <b>1</b> ponto.</font>",a)coord1[a]=true end end

:)
Doneky
« Citoyen »
1384693320000
    • Doneky#0000
    • Profil
    • Derniers messages
    • Tribu
#492
  0
I want know a form that no occupy very space and lines. This form not change at nothing. ^
Safwanrockz
« Censeur »
1384716780000
    • Safwanrockz#0095
    • Profil
    • Derniers messages
    • Tribu
#493
  0
Doneky a dit :
I want know a form that no occupy very space and lines. This form not change at nothing. ^

I'd help you if I understood what you want.
Doneky
« Citoyen »
1384718460000
    • Doneky#0000
    • Profil
    • Derniers messages
    • Tribu
#494
  0
Okay! There's the minigame minigame keyhunt and chessehunt, it has a base of go the a specific place (coordinate) and press the key 32 (space). My script has this, and is working right, but it occupy many lines and space (kbs), so I want know if there's other form of do this that not occupy space (kbs) and lines.
a dit :
Sorry! Bad english. :'(
Safwanrockz
« Censeur »
1384718820000
    • Safwanrockz#0095
    • Profil
    • Derniers messages
    • Tribu
#495
  0
Doneky a dit :
Okay! There's the minigame minigame keyhunt and chessehunt, it has a base of go the a specific place (coordinate) and press the key 32 (space). My script has this, and is working right, but it occupy many lines and space (kbs), so I want know if there's other form of do this that not occupy space (kbs) and lines.

Try using this lua minifier.
Abdeltif
« Citoyen »
1384878300000
    • Abdeltif#0000
    • Profil
    • Derniers messages
    • Tribu
#496
  0
Hello there ,
I need help !
I don't really understand this event : eventTextAreaCallback
Can i get an example of it please ?
Safwanrockz
« Censeur »
1384879980000
    • Safwanrockz#0095
    • Profil
    • Derniers messages
    • Tribu
#497
  0
Abdeltif a dit :
Hello there ,
I need help !
I don't really understand this event : eventTextAreaCallback
Can i get an example of it please ?

Callback a dit :

ui.addTextArea(0, "<a href='event:close'>X</a href>", nil)
function eventTextAreaCallBack(id,name,cb)
if cb=="close" then
ui.removeTextArea(0)
end
end

Clicking on the X in the specified text area removes the text area.
Abdeltif
« Citoyen »
1384880880000
    • Abdeltif#0000
    • Profil
    • Derniers messages
    • Tribu
#498
  0
Safwanrockz a dit :
Clicking on the X in the specified text area removes the text area.

Does not work .
Safwanrockz
« Censeur »
1384881660000
    • Safwanrockz#0095
    • Profil
    • Derniers messages
    • Tribu
#499
  0
Abdeltif a dit :
Does not work .

Oh, sorry. Try this
a dit :

ui.addTextArea(0, "<a href='event:close'>X</a>", nil)
function eventTextAreaCallBack(id,name,cb)
if cb=="close" then
ui.removeTextArea(0)
end
end

 
Abdeltif
« Citoyen »
1384882260000
    • Abdeltif#0000
    • Profil
    • Derniers messages
    • Tribu
#500
  0
Safwanrockz a dit :
Oh, sorry. Try this
 

Does not work either .
  • Forums
  • /
  • Transformice
  • /
  • Modules
  • /
  • Script Requests
« ‹ 25 / 160 › »
© Atelier801 2018

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

Version 1.27