×

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
  • /
  • Códigos útiles de LUA.
« ‹ 2 / 4 › »
Códigos útiles de LUA.
Saintgio
« Consul »
1489704480000
    • Saintgio#0000
    • Profil
    • Derniers messages
    • Tribu
#21
  0
Añadiendo a lo que dijo Tocutoeltuco, el único pero del script sería que le falta detectar las emociones que agregaron más recientemente.
Tocutoeltuco
« Censeur »
1489782240000
    • Tocutoeltuco#0000
    • Profil
    • Derniers messages
#22
  0
Saintgio a dit :
Añadiendo a lo que dijo Tocutoeltuco, el único pero del script sería que le falta detectar las emociones que agregaron más recientemente.

Pero el script en sí funciona perfecto
Beri_sodii
« Citoyen »
1490533020000
    • Beri_sodii#0000
    • Profil
    • Derniers messages
#23
  0
Hola, ¿Como hago para borrar un valor determinado de una tabla?, Me explico.

Tengo una tabla NOMBRES que guarda nombres de usuarios.
Al ejecutar el comando !sacar NOMBRE, quiero que me lo expulse de la tabla NOMBRES.
Pero el table.remove(NOMBRES, usuario) no sirve, porque para remover en una tabla necesitas la ubicación exacta de donde se encuentra

Acá dejo una parte del código:

elseif args[1] == "sacar" then
if args[2] and args[3] then

if args[2] == "equipo1" then
table.remove(args, 1)
table.remove(args, 1)
for index, player in pairs(args) do
player = string.title(player)
table.remove(equipos[1], player)
juega[player] = false
end
end

if args[2] == "equipo2" then
table.remove(args, 1)
table.remove(args, 1)
for index, player in pairs(args, 3) do
player = string.title(player)
table.remove(equipos[2], player)
juega[player] = false
end
end
end
end

Lo que me devuelve el error

Runtime Error : org.luaj.vm2.LuaError: Beri_sodii.lua:561: bad argument: number expected, got string
Tocutoeltuco
« Censeur »
1490537400000
    • Tocutoeltuco#0000
    • Profil
    • Derniers messages
#24
  0
Beri_sodii a dit :
Hola, ¿Como hago para borrar un valor determinado de una tabla?, Me explico.

Tengo una tabla NOMBRES que guarda nombres de usuarios.
Al ejecutar el comando !sacar NOMBRE, quiero que me lo expulse de la tabla NOMBRES.
Pero el table.remove(NOMBRES, usuario) no sirve, porque para remover en una tabla necesitas la ubicación exacta de donde se encuentra

Acá dejo una parte del código:

elseif args[1] == "sacar" then
if args[2] and args[3] then

if args[2] == "equipo1" then
table.remove(args, 1)
table.remove(args, 1)
for index, player in pairs(args) do
player = string.title(player)
table.remove(equipos[1], player)
juega[player] = false
end
end

if args[2] == "equipo2" then
table.remove(args, 1)
table.remove(args, 1)
for index, player in pairs(args, 3) do
player = string.title(player)
table.remove(equipos[2], player)
juega[player] = false
end
end
end
end

Lo que me devuelve el error

Runtime Error : org.luaj.vm2.LuaError: Beri_sodii.lua:561: bad argument: number expected, got string

table.remove no funciona con el string, boolean o demás, funciona con el index del valor
Es decir:
equipos={{"Tocutoeltuco","Saintgio"},{"Beri_sodii","+Minstens"}}
No puedes usar table.remove(equipos[1],"Tocutoeltuco"), debes usar table.remove(equipos[1],1)
Hay un script que hizo Bolodefchoco sobre table.destroy, que funciona como tú quieres. No tengo el script ahora mismo pero te haré algo parecido
Code Lua

1
2
3
4
5
6
7
function table.destroy(table,value)
for i,v in pairs(table) do
if v==value then
table.remove(table,i)
end
end
end
Trolleandolo
« Citoyen »
1491142920000
    • Trolleandolo#0000
    • Profil
    • Derniers messages
    • Tribu
#26
  0

▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬ஜ۩۞۩ஜ▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬


LUA VS EN LA CASA DE LA TRIBU



▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬ஜ۩۞۩ஜ▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬



❖MODO DEATHMATCH (TODOS VS TODOS)❖
❖MODO BOOTCAMP❖
❖MODO RACING❖
❖MODO MIX❖
❖4 TEAMS❖
❖AGREGAR Y QUITAR JUGADORES CUANDO QUIERAS❖
❖CAMBIAR EL PUNTAJE DE UN EQUIPO O PERSONA❖
❖CAMBIAR EL PUNTAJE PARA GANAR❖
❖CREAR LOS TEAMS CON SOLO UN COMANDO❖
❖COMANDO !SALTAR PARA SALTAR EL MAPA❖
❖AÑADIR UN MAPA A LA COLA DE ESPERA CON !NP @CODIGO❖
❖BOTÓN PARA LLENAR AUTOMATICAMENTE LOS 4 EQUIPOS❖
❖PODES USAR TANTO 4 EQUIPOS COMO 3 O 2❖
❖COMANDO !PUNTAJE PARA VER EL PUNTAJE [SOLO EN MODO DEATHMATCH]❖



▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬ஜ۩۞۩ஜ▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬


No olvides cambiar el nombre del administrador por tu nombre en la Linea 32. - Click aquí para ver como


[LUA] 4 TEAMS
[LUA] 4 TEAMS + Deathmatch
[LUA] Deathmatch
[LUA] Elimination
[LUA] 8 TEAMS + Deathmatch + Modo azar

Click aquí para entrar al link del LUA


▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬ஜ۩۞۩ஜ▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬


Comandos:
!saltar - Para cambiar de mapa
!puntos - Para cambiar el puntaje, ej: !puntos team1 5
!np @codigo - Para poner cualquier mapa
!pausa - Para pausar el juego
!team - Para asignar jugadores a un equipo, ej: !team1 Trolleandolo
!d NUMERO - Asigna el puntaje para ganar, ej: !d 20
!añadir team nick - Añade un jugador a el equipo especificado, ej: !añadir team4 Trolleandolo
!reset - Resetea el juego
!quitar NOMBRE - saca a un jugador del juego
!puntaje - para ver el puntaje [SOLO EN MODO DEATHMATCH]

▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬ஜ۩۞۩ஜ▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬


Dernière modification le 1495692660000
Trolleandolo
« Citoyen »
1491142980000
    • Trolleandolo#0000
    • Profil
    • Derniers messages
    • Tribu
#27
  0
Hola, ¿hay alguna forma con LUA de reproducir un video?
Tocutoeltuco
« Censeur »
1491146580000
    • Tocutoeltuco#0000
    • Profil
    • Derniers messages
#28
  1
Trolleandolo a dit :

▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬ஜ۩۞۩ஜ▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬


LUA [BUG] DE DESCONEXIÓN


Al ingresar [url=]ESTE LUA[/url] desconectas a todos los jugadores de la sala


▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬ஜ۩۞۩ஜ▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬


No es un bug, es un script crash. Te pido por favor que quites el código de ahí.

Trolleandolo a dit :
Hola, ¿hay alguna forma con LUA de reproducir un video?

No la hay.

Dernière modification le 1491146640000
Obemice
« Sénateur »
1491613080000
    • Obemice#0095
    • Profil
    • Derniers messages
    • Tribu
#30
  1
Si bien en el juego está prohibido crashear salas, consideramos que publicar este tipo de scripts no va contra la reglas.

Lo que sí, sepan que este script produce un crash dentro del juego. Tengan cuidado al usarlo.
Minstens
« Censeur »
1493219700000
    • Minstens#0000
    • Profil
    • Derniers messages
    • Tribu
#31
  1

http://i.imgur.com/cuc02Tm.gif


Cartel LED de flechas que se mueven hacia la derecha:
https://gist.github.com/Minstfm/1899979f9afff82949141e3538e69687
--

http://i.imgur.com/FQ33qlP.gif


Cartel LED con texto que se mueve hacia la derecha:
https://gist.github.com/Minstfm/7426c3a1e2de2d2db3f38fccc5f9982c

Dernière modification le 1493305500000
Miiiclaroo
« Citoyen »
1494603960000
    • Miiiclaroo#0000
    • Profil
    • Derniers messages
    • Tribu
#32
  0
No sé si esto les sirva de algo pero lo dejaré por aquí ^^

modifiqué un poco la idea de minstens ^^'
Texto Móvil
Intasmg
« Citoyen »
1494831480000
    • Intasmg#0000
    • Profil
    • Derniers messages
    • Tribu
#33
  2
me aburría, hice un "escapa de la lava"

http://i.imgur.com/qmPeiyY.gif


se supone que ganas cuando pasas la nube, y pierdes cuando te toca la lava

Code Lua

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
local map = [[<C><P /><Z><S><S L="800" P="0,0,0.3,0.2,0,0,0,0" T="0" Y="400" H="30" X="400" /><S L="10" P="0,0,0.3,0.2,0,0,0,0" T="0" Y="185" H="400" X="400" /><S L="308" P="0,0,0.3,0.2,0,0,0,0" T="0" Y="81" H="10" X="156" /><S L="308" P="0,0,0.3,0.2,0,0,0,0" T="0" Y="81" X="646" H="10" /><S L="308" P="0,0,0.3,0.2,0,0,0,0" T="0" Y="5" X="156" H="10" /><S L="10" P="0,0,0.3,0.2,0,0,0,0" T="0" Y="43" H="65" X="5" /><S L="308" P="0,0,0.3,0.2,0,0,0,0" T="0" Y="5" H="10" X="646" /><S L="10" P="0,0,0.3,0.2,0,0,0,0" T="0" Y="43" X="795" H="65" /><S L="800" P="0,0,0.3,0.2,0,0,0,0" T="8" Y="40" H="10" X="395" /><S L="10" P="0,0,0,0,0,0,0,0" o="6a7495" T="12" Y="300" X="5" H="171" /><S L="10" o="6a7495" P="0,0,0,0,0,0,0,0" T="12" Y="300" X="795" H="171" /></S><D><DS X="45" Y="368" /><DS X="755" Y="368" /></D><O /></Z></C>]]
local start = false
local timer = 7
local tick = 0
local amount = 0

local SCORES = {16, 12, 10} --El primero gana +16, el segundo +12 y así
local pos = 0
local yScore = 20

local yGround = 735

local bodyDef = {
type=3, width=800, height=700,
foreground=true, friction=0,
restitution=0, angle=0, color=0,
miceCollision=false, groundCollision=false}

local mice = {}

function main()
for name in pairs(tfm.get.room.playerList) do
mice[name] = {x = 50, y = 370, score = 0} --Esto es solo para inicializar, Y DEBE SER LA MISMA Y DEL SPAWN
end
tfm.exec.disableAutoShaman()
tfm.exec.disableAutoNewGame()
tfm.exec.newGame(map)
tfm.exec.setGameTime(1)
end

function eventNewGame()
for name in pairs (tfm.get.room.playerList) do
amount = amount + 1
for _, key in ipairs({0,1,2,3}) do
mice[name].x, mice[name].y = 50, 370
if mice[name].score == nil then mice[name].score = 0; end
system.bindKeyboard (name, key, true, true)
end
end
end

function eventKeyboard(name, key, down, x, y) --Las coordenadas se actualizan cada vez que se toque una tecla
if not tfm.get.room.playerList[name].isDead then
mice[name].x = x
mice[name].y = y
end
end

function createLava(t)
if t == 1 then
tfm.exec.addPhysicObject (0, 400, yGround, bodyDef)
yGround = yGround - math.random(30, 50)
return true
end
return false
end

function eventTextAreaCallback(id, name, event)
if event == "reset" then
ui.removeTextArea(0)
for i=1, pos do
ui.removeTextArea(i)
end
yScore = 20
pos = 0
tfm.exec.newGame(map)
tfm.exec.setGameTime(1)
yGround = 735
timer = 7
end
end

function checkPlayers()
if amount == 0 or yGround-318 <= 85 then
start = false
ui.addTextArea(0, "<a href='event:reset'>Reset</a>", nil, 380, 100)
end
end

function eventPlayerDied()
amount = amount - 1
checkPlayers()
end

function eventPlayerWon(name)
pos = pos + 1
if pos <= 3 then
mice[name].score = mice[name].score + SCORES[pos]
else
mice[name].score = mice[name].score + 10
end
ui.addTextArea(pos, "<font size='10'>"..pos..". "..name..": "..mice[name].score.."\n", nil, 20, yScore)
yScore = yScore + 35
amount = amount - 1
checkPlayers()
end

function checkCoord()
for name in pairs(tfm.get.room.playerList) do
if mice[name].y >= yGround-318 then --Como la pos y es el centro del suelo[cita requerida], le restamos 318 para que de aprox el borde superior
tfm.exec.killPlayer(name)
end
if mice[name].y <= 79 then --llegó al final?
tfm.exec.giveCheese(name)
tfm.exec.playerVictory(name)
end
end
end

function eventLoop()
if start then
checkCoord()
tick = tick + .5
if createLava(tick) then
tick = 0
end
end
if timer > 0 then --Textarea timer
ui.addTextArea (-1, "<font size='50'>"..math.ceil(timer).."</font>", nil, 380, 100, nil, nil, nil, nil, 0)
timer = timer - .5
elseif timer == 0 and not start and amount ~= 0 then --Empieza a subir la lava
ui.removeTextArea(-1)
start = true
end
end

main()
Saintgio
« Consul »
1495344420000
    • Saintgio#0000
    • Profil
    • Derniers messages
    • Tribu
#34
  4
Un ejemplo muy básico de uso de objetos.
Miiiclaroo
« Citoyen »
1495384260000
    • Miiiclaroo#0000
    • Profil
    • Derniers messages
    • Tribu
#35
  0
Saintgio a dit :
Un ejemplo muy básico de uso de objetos.

Está muy genial el ejemplo creo que a muchos nos podría servir

Dernière modification le 1495386960000
Saintgio
« Consul »
1495405620000
    • Saintgio#0000
    • Profil
    • Derniers messages
    • Tribu
#36
  0
https://image.prntscr.com/image/297e4ca9836b45098c61bf6276232beb.pnghttps://image.prntscr.com/image/04a2524676a44053879a6f1bde175b23.png


Simple fuente anaglifo con tres TextArea.

Código.

Dernière modification le 1495407120000
Riiukk
1495674840000
    • Riiukk#0000
    • Profil
    • Derniers messages
    • Tribu
#37
[Modéré par Ratacp, raison : Fuera de tema | Si tienes una pregunta relacionada a los módulos o a LUA en general, puedes utilizar el siguiente tema: Preguntas y Respuestas - Lua]
Conejo_malo
1499125380000
    • Conejo_malo#9471
    • Profil
    • Derniers messages
#38
[Modéré par Bog, raison : Innecesario. Sin relación al tema.]
Hemonio
1499213160000
    • Hemonio#0000
    • Profil
    • Derniers messages
#39
[Modéré par Bog, raison : Por favor usa el hilo de preguntas y respuestas.]
Smasherklol
1502924940000
    • Smasherklol#0000
    • Profil
    • Derniers messages
    • Tribu
#40
[Modéré par Obemice, raison : Fuera de tema.]
  • Forums
  • /
  • Transformice
  • /
  • Modules
  • /
  • Códigos útiles de LUA.
« ‹ 2 / 4 › »
© Atelier801 2018

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

Version 1.27