×

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
  • /
  • Lua Snippets
« ‹ 24 / 33 › »
Lua Snippets
Zyx
« Censeur »
1381615440000
    • Zyx#8690
    • Profil
    • Derniers messages
#461
  0
What is the 'bind Keyboard' script for? What does it do?
Mikuhl
« Citoyen »
1381615560000
    • Mikuhl#3311
    • Profil
    • Derniers messages
    • Tribu
#462
  0
Swirlfire a dit :
What is the 'bind Keyboard' script for? What does it do?

Just an example of binding the keyboard.
Zyx
« Censeur »
1381616760000
    • Zyx#8690
    • Profil
    • Derniers messages
#463
  0
Also I think you should make the

for name,player in pairs(tfm.get.room.playerList) do
system.bindMouse(name, true)
end

function eventMouse(name, x, y)
tfm.exec.addShamanObject(tfm.enum.shamanObject.littleBox, x, y, 0, 0, 0, false)
end


snippet for Lua Team only because one of my tribemates found out how to launch it and when I came in the whole tribe house was flooded with anvils, little boxes, etc and I lagged too hard, I had to refresh my tab. :(


He was abusing it..
Shamousey
« Consul »
1381616880000
    • Shamousey#0095
    • Profil
    • Derniers messages
    • Tribu
#464
  0
What are you suggesting to make available to just the Lua Team, mouse events or spawning shaman objects? Either way that'd limit what can be done, people can abuse it and make you lag in many different ways too.
Issey
« Citoyen »
1381618140000
    • Issey#0000
    • Profil
    • Derniers messages
#465
  0
Pages a dit :

values={}
for name in pairs(tfm.get.room.playerList) do
values[name]={i=1}
end

color=0x3C5064

content={}
content[1]=[[Some BS]]
content[2]=[[BSer]]
arrowRight=[[<a href="event:next">>></a>]]
arrowLeft=[[<a href="event:previous">&lt;&lt;</a>]]

ui.addTextArea(1,content[1],nil,nil,nil,200,300,color,color)
ui.addTextArea(1001,arrowRight,nil,270,333,nil,nil,color,color)

function eventTextAreaCallback(id,name,cb)
if(cb=='next')then
values[name].i=values[name].i+1
ui.updateTextArea(1,content[values[name].i],name,nil,nil,200,300,color,color)
ui.addTextArea(1002,arrowLeft,name,10,333,nil,nil,color,color)
values[name].c=values[name].i+1
if(content[values[name].c]==nil) then
ui.removeTextArea(1001,name)
end
else if(cb=='previous') then
values[name].i=values[name].i-1
ui.updateTextArea(1,content[values[name].i],name,nil,nil,200,300,color,color)
ui.addTextArea(1001,arrowRight,name,270,333,nil,nil,color,color)
values[name].c=values[name].i-1
if(content[values[name].c]==nil) then
ui.removeTextArea(1002,name)
end
end
end
end

A script for text area pages, just add content[3] and content[4] and so on to add pages.
Note: This one is a lot different than the one Shamousey made ;*
Edit: Made the script player specific.
Hakureiduck
« Citoyen »
1381620180000
    • Hakureiduck#0000
    • Profil
    • Derniers messages
    • Tribu
#466
  0
Swirlfire a dit :
Also I think you should make the

for name,player in pairs(tfm.get.room.playerList) do
system.bindMouse(name, true)
end

function eventMouse(name, x, y)
tfm.exec.addShamanObject(tfm.enum.shamanObject.littleBox, x, y, 0, 0, 0, false)
end


snippet for Lua Team only because one of my tribemates found out how to launch it and when I came in the whole tribe house was flooded with anvils, little boxes, etc and I lagged too hard, I had to refresh my tab. :(


He was abusing it..

Even withouth these function one could still find a way to lag your game or even make it crash. It takes one or two clicks to remove the /np rights so that they can't use Lua anymore in your tribe house.

If it's not your tribe then have your tribe leader do that, if he refuses to do that then move to another tribe with better administration e.e

Anyway, before lua existed people could still crash your game by using crash maps in tribe house
Lightningwx
« Citoyen »
1381772520000
    • Lightningwx#0000
    • Profil
    • Derniers messages
    • Tribu
#467
  0
You need to replace da "player list " with player names?
Gaaranicolo
« Citoyen »
1382096460000
    • Gaaranicolo#0000
    • Profil
    • Derniers messages
    • Tribu
#468
  0
Why it doesn't work for me. Everytime I enter the script nothing happens
Safwanrockz
« Censeur »
1382099940000
    • Safwanrockz#0095
    • Profil
    • Derniers messages
    • Tribu
#469
  0
Gaaranicolo a dit :
Why it doesn't work for me. Everytime I enter the script nothing happens

You either don't have 1000 cheese or have been banned for hacking before.
Alicim
1382118600000
    • Alicim#0000
    • Profil
    • Derniers messages
    • Tribu
#470
[Modéré par Takumisyn, raison : Spam]
Xxninjazxx
« Citoyen »
1382123340000
    • Xxninjazxx#0000
    • Profil
    • Derniers messages
#471
  0
Gaaranicolo a dit :
Why it doesn't work for me. Everytime I enter the script nothing happens

Safwanrockz a dit :
You either don't have 1000 cheese or have been banned for hacking before.

That or your script does nothing/is incorrect.
Bethdacat
« Consul »
1382134860000
    • Bethdacat#0000
    • Profil
    • Derniers messages
    • Tribu
#472
  0
Add this to OP
Default Text in Chatbox a dit :
print("Here, you type your own words here.")

I just discovered
Shamousey
« Consul »
1382135520000
    • Shamousey#0095
    • Profil
    • Derniers messages
    • Tribu
#473
  0
Bethdacat a dit :
Add this to OP

I just discovered

That's quite literally the most basic thing you can do with Lua. You should read some sort of Lua Tutorial or the manual before you even attempt at using it ingame, and if you do either you'd know about this.
Basterfeild
« Citoyen »
1382373960000
    • Basterfeild#0000
    • Profil
    • Derniers messages
#474
  0
How to set Oppacity for Ui.Text.Area?
Jordy
« Consul »
1382374380000
    • Jordy#0015
    • Profil
    • Derniers messages
    • Tribu
#475
  0
Basterfeild a dit :
How to set Oppacity for Ui.Text.Area?

ui.addTextArea(Int id, String text, String targetPlayer, Int x, Int y, Int width, Int height, Int backgroundColor, Int borderColor, Float backgroundAlpha)

Try: 0.8 for example.

Basterfeild a dit :
Thanks :)

You're welcome.
Basterfeild
« Citoyen »
1382374500000
    • Basterfeild#0000
    • Profil
    • Derniers messages
#476
  0
Thanks :)
Erikadeedee
« Citoyen »
1382894040000
    • Erikadeedee#0000
    • Profil
    • Derniers messages
    • Tribu
#477
  0
Thanks, my tribe mates and I are having an amazing time using the lua codes!!
Makinit
« Citoyen »
1383069180000
    • Makinit#0095
    • Profil
    • Derniers messages
    • Tribu
#478
  0
Eternal snow:
a dit :
tfm.exec.snow()

local loopCount = 0
function eventLoop()
if loopCount == 0 then
tfm.exec.snow()
tfm.exec.snow()
end
loopCount = (loopCount + 1) % 100
end
Fluffyshine
« Citoyen »
1383071340000
    • Fluffyshine#0000
    • Profil
    • Derniers messages
    • Tribu
#479
  0
Map rotation:
a dit :

curr = {};

function eventNewGame()
curr.time = os.time();
end

function doNextMap()
tfm.exec.newGame(maplist[math.random(#maplist)]);
end

tfm.exec.disableAutoNewGame(true);
maplist = {1, 2, 3, 4, 5};
doNextMap();

function eventLoop(hasPassed, isLeft)
curr.dead = 0;
curr.alive = 0;
for target,str in pairs(tfm.get.room.playerList) do
curr.alive = curr.alive+1
if str.isDead then
curr.dead = curr.dead+1
end
end
if curr.dead-curr.alive == 0 or curr.time < os.time()-120000 then
doNextMap();
end
end

~~
Makinit
« Citoyen »
1383132540000
    • Makinit#0095
    • Profil
    • Derniers messages
    • Tribu
#480
  0
Fluffyshine a dit :
Map rotation:
~~

Looping through the playerList twice per second will waste a lot of processor time. Using the death, win and respawn events is more efficient and more accurate:
a dit :
tfm.exec.disableAutoNewGame(true)

local maplist = {1, 2, 3, 4, 5}
local gameStart = 0
local alive = 0

function eventNewGame()
gameStart = os.time()
alive = 0
for name in pairs(tfm.get.room.playerList) do
spawned()
end
end

function eventLoop()
if gameStart < os.time() - 120000 then
doNextMap()
end
end

function doNextMap()
tfm.exec.newGame(maplist[math.random(#maplist)])
end

function died()
alive = alive - 1
if alive == 0 then
doNextMap()
end
end

function spawned()
alive = alive + 1
end

function eventPlayerWon(name)
died()
end

function eventPlayerDied(name)
died()
end

function eventPlayerRespawn(name)
spawned()
end

doNextMap()
  • Forums
  • /
  • Transformice
  • /
  • Modules
  • /
  • Lua Snippets
« ‹ 24 / 33 › »
© Atelier801 2018

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

Version 1.27