×

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
« ‹ 22 / 33 › »
Lua Snippets
Boygawgaw
« Citoyen »
1381214580000
    • Boygawgaw#0000
    • Profil
    • Derniers messages
    • Tribu
#421
  0
Yes, however it only spawns one block per click.
Sennesandin
« Citoyen »
1381245900000
    • Sennesandin#0000
    • Profil
    • Derniers messages
#422
  0
Hi! when First Won then i will map change. Help Pleas................
Hophipmice
« Citoyen »
1381246080000
    • Hophipmice#0000
    • Profil
    • Derniers messages
    • Tribu
#423
  0
Sennesandin a dit :
Hi! when First Won then i will map change. Help Pleas................

a dit :
i=0
function eventPlayerWon()
i=i+1d
if i==1 then
tfm.exec.newGame()
end
end

function eventNewGame()
i=0
end
function eventNewPlayer(name)
tfm.exec.newGame()
end

text.
Basterfeild
« Citoyen »
1381249920000
    • Basterfeild#0000
    • Profil
    • Derniers messages
#424
  0
How to add text in chat to new player in room?
Hophipmice
« Citoyen »
1381250160000
    • Hophipmice#0000
    • Profil
    • Derniers messages
    • Tribu
#425
  0
Basterfeild a dit :
How to add text in chat to new player in room?

Either:
a dit :
function eventNewPlayer(name)
print("yourtexthere!")
end

As print only works for the person that runs the code, this might be more helpful:
a dit :

function eventNewPlayer(name)
ui.addPopup(0,0,"texthere",name,155,200,500)
end

Don't change the name but, but you can change the numbers.

As :
a dit :
function eventNewPlayer(name)
tfm.exec.chatMessage("text",name)
end

WONT WORK IN TRIBE HOUSES!
Manacer
« Citoyen »
1381258620000
    • Manacer#0000
    • Profil
    • Derniers messages
    • Tribu
#426
  0
Help please :

table.remove(ban, answer)

[20:53] [•] Runtime Error : transformice.lua:503: bad argument: number expected, got string
Moepl
« Citoyen »
1381260900000
    • Moepl#0095
    • Profil
    • Derniers messages
#427
  0
Manacer a dit :
Help please :

table.remove(ban, answer)

[20:53] [•] Runtime Error : transformice.lua:503: bad argument: number expected, got string

answer is probably a string. read up on the documentation about table.remove
Sennesandin
« Citoyen »
1381261140000
    • Sennesandin#0000
    • Profil
    • Derniers messages
#428
  0
This
a dit :
function eventPlayerWon(playerName)
tfm.exec.newGame(maps[math.random(#maps)])


and
a dit :

function eventPlayerWon(playerName)
ui.addTextArea(1,"<J>"..playerName.."<N> En son kazanan Oyuncu ^^",NIL,10,30)
end

At the same time does not work

Can somebody help pls..
Hophipmice
« Citoyen »
1381261920000
    • Hophipmice#0000
    • Profil
    • Derniers messages
    • Tribu
#429
  0
Sennesandin a dit :
This


and


At the same time does not work

Can somebody help pls..

do this for maps:
a dit :
maps={"@Mapcode,@Mapcode"}
function eventPlayerWon(name)
tfm.exec.newGame(tfm.exec.newGame(maps[math.random(#maps)])
end

if that doesn't work, try this:

a dit :


maps={"@Mapcode,@Mapcode"}
i=0
function eventPlayerWon()
i=i+1d
if i==1 then
tfm.exec.newGame()
end
end

function eventNewGame(maps)
i=0
end
function eventNewPlayer(name)
tfm.exec.newGame()
end


If that also doesn't work, try this:
a dit :
maps={"@Mapcode,@Mapcode"}
function evenPlayerWon(name)
tfm.exec.newGame(maps)
Sennesandin
« Citoyen »
1381262280000
    • Sennesandin#0000
    • Profil
    • Derniers messages
#430
  0
All three of them did not work
Mikuhl
« Citoyen »
1381262940000
    • Mikuhl#3311
    • Profil
    • Derniers messages
    • Tribu
#431
  0
Sennesandin a dit :
All three of them did not work

a dit :

maps = {666666, 1000000}

function eventPlayerWon(playerName)
tfm.exec.newGame("@"..maps[math.random(#maps)])
end

.
Sennesandin
« Citoyen »
1381263360000
    • Sennesandin#0000
    • Profil
    • Derniers messages
#432
  0
Jaackster a dit :
.

İ doed
Manacer
« Citoyen »
1381268460000
    • Manacer#0000
    • Profil
    • Derniers messages
    • Tribu
#433
  0
Moepl a dit :
answer is probably a string. read up on the documentation about table.remove

I find not :/
Bengalstar
« Citoyen »
1381272420000
    • Bengalstar#0000
    • Profil
    • Derniers messages
#434
  0
Shamousey a dit :
Could you clarify what you mean by "glitching"? It's working fine for me.

the items in the room
they'll lag a lot and respawn over and over again
Fluffyshine
« Citoyen »
1381272540000
    • Fluffyshine#0000
    • Profil
    • Derniers messages
    • Tribu
#435
  0
Sennesandin a dit :
All three of them did not work

Hi, I use this:

a dit :

maplist = {1,2,3,4,5};
function doNextMap()
tfm.exec.newGame(maplist[math.random(#maplist)]);
end

----------------------------------------------------------------
function eventNewGame()
aliveMice = 0
for name,_target in pairs(tfm.get.room.playerList) do
aliveMice = aliveMice+1
end
end
----------------------------------------------------------------
function eventPlayerLeft(target)
aliveMice = aliveMice-1
end
----------------------------------------------------------------
function eventPlayerDied(target)
aliveMice = aliveMice-1
end
----------------------------------------------------------------
function eventPlayerWon(target)
aliveMice = aliveMice-1
end
----------------------------------------------------------------
function eventLoop(timePassed, timeLeft)
if (aliveMice == 0 or timeLeft < 1001) then
doNextMap();
end
end

doNextMap();


Works like a charm!
Tini
« Sénateur »
1381272780000
    • Tini#0095
    • Profil
    • Derniers messages
    • Tribu
#436
  0
Shamousey, Fluffyshine, help-me!
a dit :
translations={
EN={
help={
"<font size='25'><bv>Introdução</bv></font><br><br>Este é o <b>Cannon Meep Racing</b><br><br>Aqui você poderá se divertir com seus amigos, você só precisa pegar o queijo e não ser morto pelo <b>MEEP</b><br><br><br>Pessas com nome em <font color='#eb1d51'>vermelho</font> são <b>devs</b>, você tem que respeitá-los",
"<font size='25'><vp>Mapas</vp></font><br><br><br>@381043<br>@286333<br>@229834<br>@1643157<br>@3535192<br><br>",
"<font size='25'><j>Comandos</j></font><br><br><br><b>!mort</b> <i>(bugado)</i> - Para se matar<br><b>!cheeseadmin</b> <i>(bugado)</i>- para dar queijo à uma pessoa (uso permitido somente para admins)",
"<font size='25'><g>Sugestões</g></font><br><br>Caso você tenha alguma sugestão para o nosso Minigame, você pode ir até o <b>Fórum da Tribo</b> e dê sua sugestão no tópico do Minigame.",
"<font size='25' color='#eb1d51'>Devs</font><br><br><br><b>Tinittee</b> - Criador do jogo<br><b>Dedavii</b> - Co-criador do jogo<br>",
"<font size='25'><ch>Bugs</ch></font><br><br><br><j>• !fromage (!cheeseadmin) bugado<br>• !mort bugado<br>• !report bugado</j><br><br><br><br>",
"<font size='25'><r>Change Logs</r></font><br><br><br><v>[28/09]</v>• Minigame criado<br><v>[29/09]</v>• Script editado<br><v>[29/09]</v>• <b>Doneky</b> agora é <font color='#eb1d51'>admin</font><br><v>[30/09]</v> • Doneky saiu da equipe<br><v>[06/10]</v> • Comando <i>!help</i> substituido por <i>!page</i>",
"<font size='25' color='#D3A979'>Códigos</font><br><br><br>A cada semana teremos novos novos códigos para terem acesso à sala (ver o mapa), e nesses códigos terão dicas da resposta.<br><br>Esta semana, a dica do código é:<br><br>•Usado no nosso Minigame<br>•Usado em survivor<br><br><b>Resposta:</b> <i>meep</i><br><br><br><br><br><br><br>Dicas do <b>próximo</b> código:<br><br>• Onde são anunciados as novidades<br>• Usado por vários da tribo<br>• Tem um cargo com o pré-fixo 'Se'",
}
}
}

players={}
system.disableChatCommandDisplay("help")

textarea=ui.addTextArea
function ui.addTextArea(id,text,targetPlayer,x,y,width,height,backgroundColor,borderColor,backgroundAlpha,emboss)
--if not backgroundColor then backgroundColor=0x324650 end
--if not borderColor then borderColor=0x000001 end
if emboss then
textarea(6969+id,"",targetPlayer,x,y+1,width,height,0x000001,0x000001,backgroundAlpha)
textarea(7979+id,"",targetPlayer,x,y-1,width,height,0x6A8FA2,0x6A8FA2,backgroundAlpha)
end
textarea(id,text,targetPlayer,x,y,width,height,backgroundColor,borderColor,backgroundAlpha)
end

function eventNewPlayer(name)
players[name]={helpid=1}
ui.addTextArea(0,"<p align='center'><a href='event:help'><b>?</b></a></p>",name,780,374,16,16,nil,0x324650,nil,true)
end

for name,player in pairs(tfm.get.room.playerList) do
eventNewPlayer(name)
end

function trans(mes)
if translations[tfm.get.room.community] and translations[tfm.get.room.community][mes] then
return translations[tfm.get.room.community][mes]
else
return translations.EN[mes]
end
end

function eventChatCommand(name,command)
if command=="help" then
ui.addTextArea(1,trans("help")[players[name].helpid],name,250,50,300,300,nil,0x324650,nil,true)
ui.addTextArea(2,"<p align='center'><a href='event:previous'><b>←</b></a></p>",name,500,365,16,16,nil,0x324650,nil,true)
ui.addTextArea(3,"<p align='center'><a href='event:next'><b>→</b></a></p>",name,532,365,16,16,nil,0x324650,nil,true)
ui.addTextArea(4,"<p align='center'><a href='event:close'><b>x</b></a></p>",name,442,365,42,16,nil,0x324650,nil,true)
ui.addTextArea(5,"<p align='center'>"..players[name].helpid.."/"..#trans("help").."</p>",name,250,365,42,16,nil,0x324650,nil,true)
end
end

function eventTextAreaCallback(id,name,callback)
if callback=="help" then
eventChatCommand(name,callback)
elseif callback=="close" then
players[name].helpid=1
for id=1,5 do
ui.removeTextArea(id,name)
ui.removeTextArea(6969+id,name)
ui.removeTextArea(7979+id,name)
end
elseif callback=="next" and players[name].helpid<#trans("help") then
players[name].helpid=(players[name].helpid)+1
ui.updateTextArea(1,trans("help")[players[name].helpid],name)
ui.updateTextArea(5,"<p align='center'>"..players[name].helpid.."/"..#trans("help").."</p>",name)
elseif callback=="previous" and players[name].helpid>1 then
players[name].helpid=players[name].helpid-1
ui.updateTextArea(1,trans("help")[players[name].helpid],name)
ui.updateTextArea(5,"<p align='center'>"..players[name].helpid.."/"..#trans("help").."</p>",name)
end
end

Error? Help-me!
Fluffyshine
« Citoyen »
1381273320000
    • Fluffyshine#0000
    • Profil
    • Derniers messages
    • Tribu
#437
  0
Tinittee a dit :
Shamousey, Fluffyshine, help-me!

Error? Help-me!

What’s the problem? Everything works fine here.
Tini
« Sénateur »
1381273320000
    • Tini#0095
    • Profil
    • Derniers messages
    • Tribu
#438
  0
Lua a dit :
tfm.exec.disableAutoShaman(true);
function eventLoop(timePassed, timeLeft)
if aliveMice == 0 or aliveMice < 0 or timeLeft < 1000 or timeLeft < 100 then pn = playerName
doNextMap();
end
end

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

function eventNewGame()
aliveMice = 0
tfm.exec.setUIMapName("<vp>Meep <font color='#EB1D51'>Racing</font>");
tfm.exec.setUIShamanName("<ch>#<font color='#eb1d51'>Racing</font>");
for name,_pn in pairs(tfm.get.room.playerList) do
aliveMice = aliveMice+1
for player,name in pairs(tfm.get.room.playerList) do
tfm.exec.giveMeep(player)
end
end
end

function eventPlayerLeft(pn)
aliveMice = aliveMice-1
end

function eventPlayerDied(pn)
aliveMice = aliveMice-1
end

function eventPlayerWon(pn)
aliveMice = aliveMice-1
end

tfm.exec.disableAutoNewGame(true);
maplist = {"381043", "286333", "229834", "1643157", "3535192", };
doNextMap();
ui.addPopup(1, 0, "<i>Meep Racing</i> é um Minigame criado por <font color='#eb1d51'><b>Tinittee</b></font> e <font color='#eb1d51'><b>Dedavii</b></font><br><br>Digite <font color='#2ecf73'><i>!help</i></font> para saber mais informações<br>Digite <font color='#2ECF73'><i>!report</i></font> para denunciar um usuário. (<i>bugado</i>)<br>Digite <font color='#2ECF73'><i>!mort</i></font> para se matar (<i>bugado</i>)<br><br><br>Dúvidas? clique na <b>interrogação</b> (<b>?</b>) no canto inferior à direita da sua tela<br><br><br> Scritp by: <b>Tinittee</b>", name, 200, 200, 500)
function eventPlayerDied(playerName)
end
tfm.exec.disableAutoShaman(true);
tfm.exec.disableAutoShaman(true);
tfm.exec.setNameColor("Tinittee", 0xeb1d51)
tfm.exec.setNameColor("Dedavii", 0xeb1d51)
tfm.exec.setNameColor("Doneky", 0xeb1d51)
function eventChatCommand(name,command)
if command == "help" then
ui.addPopup(1, 0, "O objetivo do jogo é pegar o queijo sem ser morto pelo <b>meep</b>.<br><br><br>Corra!", name, 280, 150, 270)
end
end

tfm.exec.disableAutoShaman(true);

function eventChatCommand(name, comando)
if comando=="report" then
ui.addPopup(0, 2, "Denúncia:<br>Digite o <b>nome</b> e o <b>motivo</b> da denúncia!")
end
end

function eventPopupAnswer(ID, playerName, answer)
print(playerName.."Denunciou o jogador: "..answer)
end
translations={
EN={
help={
"<font size='25'><bv>Introdução</bv></font><br><br>Este é o <b>Cannon Meep Racing</b><br><br>Aqui você poderá se divertir com seus amigos, você só precisa pegar o queijo e não ser morto pelo <b>MEEP</b><br><br><br>Pessas com nome em <font color='#eb1d51'>vermelho</font> são <b>devs</b>, você tem que respeitá-los",
"<font size='25'><vp>Mapas</vp></font><br><br><br>@381043<br>@286333<br>@229834<br>@1643157<br>@3535192<br><br>",
"<font size='25'><j>Comandos</j></font><br><br><br><b>!mort</b> <i>(bugado)</i> - Para se matar<br><b>!cheeseadmin</b> <i>(bugado)</i>- para dar queijo à uma pessoa (uso permitido somente para admins)",
"<font size='25'><g>Sugestões</g></font><br><br>Caso você tenha alguma sugestão para o nosso Minigame, você pode ir até o <b>Fórum da Tribo</b> e dê sua sugestão no tópico do Minigame.",
"<font size='25' color='#eb1d51'>Devs</font><br><br><br><b>Tinittee</b> - Criador do jogo<br><b>Dedavii</b> - Co-criador do jogo<br>",
"<font size='25'><ch>Bugs</ch></font><br><br><br><j>• !fromage (!cheeseadmin) bugado<br>• !mort bugado<br>• !report bugado</j><br><br><br><br>",
"<font size='25'><r>Change Logs</r></font><br><br><br><v>[28/09]</v>• Minigame criado<br><v>[29/09]</v>• Script editado<br><v>[29/09]</v>• <b>Doneky</b> agora é <font color='#eb1d51'>admin</font><br><v>[30/09]</v> • Doneky saiu da equipe<br><v>[06/10]</v> • Comando <i>!help</i> substituido por <i>!page</i>",
"<font size='25' color='#D3A979'>Códigos</font><br><br><br>A cada semana teremos novos novos códigos para terem acesso à sala (ver o mapa), e nesses códigos terão dicas da resposta.<br><br>Esta semana, a dica do código é:<br><br>•Usado no nosso Minigame<br>•Usado em survivor<br><br><b>Resposta:</b> <i>meep</i><br><br><br><br><br><br><br>Dicas do <b>próximo</b> código:<br><br>• Onde são anunciados as novidades<br>• Usado por vários da tribo<br>• Tem um cargo com o pré-fixo 'Se'",
}
}
}

players={}
system.disableChatCommandDisplay("help")

textarea=ui.addTextArea
function ui.addTextArea(id,text,targetPlayer,x,y,width,height,backgroundColor,borderColor,backgroundAlpha,emboss)
--if not backgroundColor then backgroundColor=0x324650 end
--if not borderColor then borderColor=0x000001 end
if emboss then
textarea(6969+id,"",targetPlayer,x,y+1,width,height,0x000001,0x000001,backgroundAlpha)
textarea(7979+id,"",targetPlayer,x,y-1,width,height,0x6A8FA2,0x6A8FA2,backgroundAlpha)
end
textarea(id,text,targetPlayer,x,y,width,height,backgroundColor,borderColor,backgroundAlpha)
end

function eventNewPlayer(name)
players[name]={helpid=1}
ui.addTextArea(0,"<p align='center'><a href='event:help'><b>?</b></a></p>",name,780,374,16,16,nil,0x324650,nil,true)
end

for name,player in pairs(tfm.get.room.playerList) do
eventNewPlayer(name)
end

function trans(mes)
if translations[tfm.get.room.community] and translations[tfm.get.room.community][mes] then
return translations[tfm.get.room.community][mes]
else
return translations.EN[mes]
end
end

function eventChatCommand(name,command)
if command=="help" then
ui.addTextArea(1,trans("help")[players[name].helpid],name,250,50,300,300,nil,0x324650,nil,true)
ui.addTextArea(2,"<p align='center'><a href='event:previous'><b>←</b></a></p>",name,500,365,16,16,nil,0x324650,nil,true)
ui.addTextArea(3,"<p align='center'><a href='event:next'><b>→</b></a></p>",name,532,365,16,16,nil,0x324650,nil,true)
ui.addTextArea(4,"<p align='center'><a href='event:close'><b>x</b></a></p>",name,442,365,42,16,nil,0x324650,nil,true)
ui.addTextArea(5,"<p align='center'>"..players[name].helpid.."/"..#trans("help").."</p>",name,250,365,42,16,nil,0x324650,nil,true)
end
end

function eventTextAreaCallback(id,name,callback)
if callback=="help" then
eventChatCommand(name,callback)
elseif callback=="close" then
players[name].helpid=1
for id=1,5 do
ui.removeTextArea(id,name)
ui.removeTextArea(6969+id,name)
ui.removeTextArea(7979+id,name)
end
elseif callback=="next" and players[name].helpid<#trans("help") then
players[name].helpid=(players[name].helpid)+1
ui.updateTextArea(1,trans("help")[players[name].helpid],name)
ui.updateTextArea(5,"<p align='center'>"..players[name].helpid.."/"..#trans("help").."</p>",name)
elseif callback=="previous" and players[name].helpid>1 then
players[name].helpid=players[name].helpid-1
ui.updateTextArea(1,trans("help")[players[name].helpid],name)
ui.updateTextArea(5,"<p align='center'>"..players[name].helpid.."/"..#trans("help").."</p>",name)
end
end

↑
Fluffyshine
« Citoyen »
1381273800000
    • Fluffyshine#0000
    • Profil
    • Derniers messages
    • Tribu
#439
  0
Tinittee a dit :
↑

Still, everything works fine.
Bengalstar
« Citoyen »
1381273980000
    • Bengalstar#0000
    • Profil
    • Derniers messages
#440
  0
how can I make a popup only pop up for people who haven't viewed it already?
like at the start of a new round?
--
here's what I did (pls i have newbie skills at this)

function eventNewPlayer(name)
if player==true then
ui.addPopup(not going to copy and paste what this says)

it won't work though
  • Forums
  • /
  • Transformice
  • /
  • Modules
  • /
  • Lua Snippets
« ‹ 22 / 33 › »
© Atelier801 2018

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

Version 1.27