×

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] ¡Tic Tac Toe!
1 / 2 › »
[Script] ¡Tic Tac Toe!
Foorero
« Citoyen »
1381162440000
    • Foorero#0000
    • Profil
    • Derniers messages
    • Tribu
#1
  0
Este hilo ha sido traducido al español.
El juego es original de Baasbase
Topic-462899
http://i.imgur.com/r6Zyr.png

http://i.imgur.com/kyUagSR.png
El típico juego Tic Tac Toe está finalmente disponible en TFM.

Este script puede ser utilizado como un script de casa de tribu, aunque muy rápidamente se vuelve aburrido!

Espero que puedas aprender de esto, lo he programado de forma muy simple y mirando las funciones, debería ser suficiente para entender cómo funciona este script.

http://i.imgur.com/r6Zyr.png
¿Cómo se juega?

Es prácticamente lo mismo que jugar Tic Tac Toe o también conocido como "gato"
Dando click a la casilla en la que quieres poner el O/X

http://i.imgur.com/SNJH3Go.png
El jugador1 es el que inicia.

¿Cómo sé quién es el jugador1?

El punto de inicio del jugador1, es en la izquierda.

http://i.imgur.com/r6Zyr.png
PS: No detecta cuando hay un ganador, no sería demasiado duro para implementar eso, pero no sentía que hacerlo, tal vez uno de ustedes puede agregar.

http://i.imgur.com/r6Zyr.png
Comandos:

!new game: Inicia un nuevo juego.
!stop: Para el juego.
!new NombreDelJugador: Cambia el oponente actual con el jugador especificado. Ejemplo: !new Kura .Jugará una nueva partida con Kura


http://i.imgur.com/r6Zyr.png
Al cargar este script tienes que cambiar manualmente los jugadores que participarán en primer lugar. (Son los nombres que están en blanco en el script ↓)

Script a dit :

MAP = "<C><P /><Z><S><S X=\"400\" Y=\"390\" T=\"12\" H=\"30\" P=\"0,0,0.3,0.2,0,0,0,0\" L=\"800\" o=\"324650\" /><S X=\"400\" c=\"4\" Y=\"153\" T=\"12\" H=\"10\" P=\"0,0,0.3,0.2,0,0,0,0\" L=\"280\" o=\"324650\" /><S X=\"400\" c=\"4\" Y=\"246\" T=\"12\" H=\"10\" P=\"0,0,0.3,0.2,0,0,0,0\" L=\"280\" o=\"324650\" /><S X=\"353\" c=\"4\" Y=\"200\" T=\"12\" P=\"0,0,0.3,0.2,0,0,0,0\" H=\"280\" L=\"10\" o=\"324650\" /><S X=\"446\" c=\"4\" Y=\"200\" T=\"12\" H=\"280\" P=\"0,0,0.3,0.2,0,0,0,0\" L=\"10\" o=\"324650\" /></S><D /><O /></Z></C>"

PLAYERS = {
"Baasbase",
"Hobothehill"
}

GRID = {
{ 0, 0, 0 },
{ 0, 0, 0 },
{ 0, 0, 0 }
}

turn = 1

tfm.exec.disableAutoNewGame(true)
tfm.exec.disableAutoShaman(true)
tfm.exec.newGame(MAP)

function eventMouse(p, x, y)
if x > 260 and x <= 540 and y > 60 and y <= 340 then
for i,n in pairs(PLAYERS) do
if i == turn then
if p == n then
if getField(x, y) == 0 then
setField(x, y, (PLAYERS[1] == p and 1 or 2))
turn = turn + (turn == 1 and 1 or -1)
end
end
end
end
end
end

function translateX(x)
if x < (260 + 280/3) then
return 1
elseif x < (260 + (280/3)*2) then
return 2
else
return 3
end
end

function translateY(x)
if x < (60 + 280/3) then
return 1
elseif x < (60 + (280/3)*2) then
return 2
else
return 3
end
end

function getField(x, y)
return GRID[translateY(y)][translateX(x)]
end

function setField(x, y, value)
local tx = translateX(x)
local ty = translateY(y)
GRID[ty][tx] = value
ui.addTextArea(tx-1 + ty*3, "<p align=\"center\"><font size=\"70\">" .. (value == 1 and "O" or "X") .. "</font></p>", nil, tx * (280/3) + 260 - (280/3), ty * (280/3) + 60 - (280/3), 280/3, 280/3, 0, 0, 0)
end

function eventNewPlayer(p)
tfm.exec.respawnPlayer(p)
end

function eventPlayerDied(p)
tfm.exec.respawnPlayer(p)
end

function eventPlayerWon(p)
tfm.exec.respawnPlayer(p)
end

function eventNewGame()
if tfm.get.room.currentMap == "@0" then
tfm.exec.setGameTime(5, true)
turn = 1
for y,xs in pairs(GRID) do
for x in pairs(xs) do
GRID[y][x] = 0
end
end
for p in pairs(tfm.get.room.playerList) do
tfm.exec.movePlayer(p, (math.random(1,2) == 1 and 100 or 700), 300)
system.bindMouse(p, false)
end
tfm.exec.movePlayer(PLAYERS[1], 200, 300)
tfm.exec.movePlayer(PLAYERS[2], 600, 300)
for i,p in pairs(PLAYERS) do
system.bindMouse(p, true)
end
ui.addTextArea(1, "<p align=\"center\"><font size=\"35\">" .. PLAYERS[1] .. "</font></p>", nil, 50, 50, 200, 50, 0, 0, 0)
ui.addTextArea(2, "<p align=\"center\"><font size=\"35\">" .. PLAYERS[2] .. "</font></p>", nil, 550, 50, 200, 50, 0, 0, 0)
for i=3,11 do
ui.removeTextArea(i)
end
end
end

function eventChatCommand(p, c)
for i=1,2 do
if p == PLAYERS then
if c == "stop" then
system.exit()
elseif string.sub(c, 1, 3) == "new" then
local pl = tostring(PLAYERS[1]) -- test
PLAYERS[1] = PLAYERS[2]
PLAYERS[2] = pl

for n in pairs(tfm.get.room.playerList) do
if string.find(c, n) then
PLAYERS = n
end
end

tfm.exec.newGame(MAP)
return
end
end
end
end

http://i.imgur.com/r6Zyr.png
¡Disfruta el minijuego!

http://i.imgur.com/r6Zyr.png
Hikatory
« Citoyen »
1381162740000
    • Hikatory#0000
    • Profil
    • Derniers messages
    • Tribu
#2
  0
pensé que lo iba a explicar :[
Foorero
« Citoyen »
1381162860000
    • Foorero#0000
    • Profil
    • Derniers messages
    • Tribu
#3
  0
Hikatory a dit :
pensé que lo iba a explicar :[

Explicar como se juega?.
Lo haré!
Hikatory
« Citoyen »
1381163100000
    • Hikatory#0000
    • Profil
    • Derniers messages
    • Tribu
#4
  0
Foorero a dit :
Explicar como se juega?.
Lo haré!

Cómo funciona cada código.
Chamelinct
« Censeur »
1381175760000
    • Chamelinct#0000
    • Profil
    • Derniers messages
    • Tribu
#5
  0
Genial ^-^
Gane *U*
Yaizagoo
« Censeur »
1381177080000
    • Yaizagoo#0000
    • Profil
    • Derniers messages
    • Tribu
#6
  0
como se escribe la sala o.o
Fay
« Citoyen »
1381177080000
    • Fay#4086
    • Profil
    • Derniers messages
    • Tribu
#7
  0
Yaizagoo a dit :
como se escribe la sala o.o

Te da el script para que lo pongas en tu tribu.
Yaizagoo
« Censeur »
1381177200000
    • Yaizagoo#0000
    • Profil
    • Derniers messages
    • Tribu
#8
  0
Oldt a dit :
Te da el script para que lo pongas en tu tribu.

Gracias
Catroosdos
« Citoyen »
1381184340000
    • Catroosdos#0000
    • Profil
    • Derniers messages
    • Tribu
#9
  0
Yo juego esto en el celular.
Sinselosita
« Citoyen »
1381184460000
    • Sinselosita#0000
    • Profil
    • Derniers messages
    • Tribu
#10
  0
como pongo el script?
Gaston
« Censeur »
1381184640000
    • Gaston#1499
    • Profil
    • Derniers messages
    • Tribu
#11
  0
Sinselosita a dit :
como pongo el script?

Lo colocas en /lua y ya.
Mipmippp
« Citoyen »
1381673820000
    • Mipmippp#0000
    • Profil
    • Derniers messages
#12
  0
EDITADO-
Facuek
« Citoyen »
1381690200000
    • Facuek#0000
    • Profil
    • Derniers messages
    • Tribu
#13
  0
Me gusta editarlo y en lugar de X y O pongo Fa y Cu
Ya se, necesito amigos.
Agustinsupre
« Citoyen »
1381691520000
    • Agustinsupre#0000
    • Profil
    • Derniers messages
    • Tribu
#14
  0
solo voy a la casa pongo /lua y eso y ya? xd
Bigotesgj
« Citoyen »
1381694580000
    • Bigotesgj#0000
    • Profil
    • Derniers messages
    • Tribu
#15
  0
no entiendo lo de lua :p
Kirisamekuro
« Citoyen »
1383526380000
    • Kirisamekuro#0000
    • Profil
    • Derniers messages
#16
  0
Quisiera poder jugar esto, ah D:
Begoxary
« Citoyen »
1383592800000
    • Begoxary#0000
    • Profil
    • Derniers messages
    • Tribu
#17
  0
Kirisamekuro a dit :
Quisiera poder jugar esto, ah D:

Puedes, sólo copia el código dicho y pegalo en el texto del comando /lua en la casa de tu tribu.
Didigox
1391947740000
    • Didigox#0000
    • Profil
    • Derniers messages
    • Tribu
#18
[Modéré par Modrogon, raison : Flood + Ofensas + Homofobia + Spam.]
Fabiokla
1391988480000
    • Fabiokla#0000
    • Profil
    • Derniers messages
    • Tribu
#19
[Modéré par Shyraa]
Dadalope
« Citoyen »
1394857980000
    • Dadalope#0000
    • Profil
    • Derniers messages
    • Tribu
#20
  0
No sirve, deberias de explicar como se hace , osea basicamente poner que es el script,porque hay gente que quiere poner y no sabe lo que es, y tambien poner directamente como se hace, osea los pasos
  • Forums
  • /
  • Transformice
  • /
  • Modules
  • /
  • [Script] ¡Tic Tac Toe!
1 / 2 › »
© Atelier801 2018

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

Version 1.27