×

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] Script for testing and map review. (Plus a handy screenshot feature.)
[Script] Script for testing and map review. (Plus a handy screenshot feature.)
Mikuhl
« Citoyen »
1383622620000
    • Mikuhl#3311
    • Profil
    • Derniers messages
    • Tribu
#1
  0
I was with Shamousey as he was doing his Map Crew duties, and I thought it was helpful if there was a lua script that could make map reviewing easier. After learning regex (super hard) I created an simple script that will help people test and review maps.

It is pretty much #utility without all the un needed features. But I also added in a !screenshot command, that will allow you to screenshot the map without having you or other mice block the way. Plus you can include the info bar in your screenshot because it is redone with all the map attributes (if it has any) and the Perm Number, and the useless stuff like time and the shaman name are hidden!

http://pastebin.com/raw.php?i=UMG2wVPf

a dit :


tfm.exec.disableAutoShaman(true)
tfm.exec.newGame("@630022")
tfm.exec.disableAutoShaman(false)
tfm.exec.disableAfkDeath(true)
tfm.exec.disableAutoNewGame(true)
tfm.exec.disableAutoTimeLeft(true)

local devide = "<font size='13' color='#52607B'> | </font>"

function eventNewGame()
if tfm.get.room.currentMap == "@630022" then
tfm.exec.setUIMapName("<G>Testing Lobby. Use <J>!help<G> to see a list of commands.\n")
elseif tfm.get.room.currentMap:sub(0,1) == "@" then
local mapSettings = {}
if tfm.get.room.xmlMapInfo.xml:match('<P[^/]+G="([^"]+),[^"]+"[^/]+/>') ~= (nil and "0") then
table.insert(mapSettings, "Wind: <G>"..tfm.get.room.xmlMapInfo.xml:match('<P[^/]+G="([^"]+),[^"]+"[^/]+/>').."<J>")
end
if tfm.get.room.xmlMapInfo.xml:match('<P[^/]+G="[^"]+,([^"]+)"[^/]+/>') ~= (nil and "10") then
table.insert(mapSettings, "Gravity: <G>"..tfm.get.room.xmlMapInfo.xml:match('<P[^/]+G="[^"]+,([^"]+)"[^/]+/>').."<J>")
end
if tfm.get.room.xmlMapInfo.xml:match('<P[^/]+(N="")[^/]+/>') == 'N=""' then
table.insert(mapSettings, "Night")
end
if tfm.get.room.xmlMapInfo.xml:match('<P[^/]+(C="")[^/]+/>') == 'C=""' then
table.insert(mapSettings, "Collision")
end
if tfm.get.room.xmlMapInfo.xml:match('<P[^/]+(A="")[^/]+/>') == 'A=""' then
table.insert(mapSettings, "Soulmate")
end
if tfm.get.room.xmlMapInfo.xml:match('<P[^/]+(P="")[^/]+/>') == 'P=""' then
table.insert(mapSettings, "Portals")
end
tfm.exec.setUIMapName(tfm.get.room.xmlMapInfo.author.."<G> - @"..tfm.get.room.xmlMapInfo.mapCode.."<J>"..devide.."P"..tfm.get.room.xmlMapInfo.permCode..devide..table.concat(mapSettings, " ").."\n")
end
end

function eventChatCommand(name, cmd)
if cmd:sub(1,4) == "help" then
print("Script for testing and map review:\n\n<J>!map @code <G>: Plays a @Editor Map\n<J>!map ID <G>: Plays a Vanilla Map\n<J>!screenshot <G>: Puts everyone in screenshot mode.")
elseif cmd:sub(1,3) == "map" then
tfm.exec.newGame(cmd:sub(5))
screenshot = false
elseif cmd:sub(1,10) == "screenshot" then
for name, player in pairs(tfm.get.room.playerList) do
if screenshot == false or screenshot == nil then
tfm.exec.movePlayer(name, -1000, -1000)
screenshot = true
elseif screenshot == true then
screenshot = false
tfm.exec.respawnPlayer(name)
end
end
end
end

function eventPlayerDied(name)
if screenshot == false then
tfm.exec.respawnPlayer(name)
end
end

function eventPlayerGetCheese(name)
if tfm.get.room.currentMap == "@630022" then
tfm.exec.killPlayer(name)
tfm.exec.respawnPlayer(name)
end
end

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

(The help command will only appear for the one who ran the script.)
Championrs
« Citoyen »
1383632100000
    • Championrs#0000
    • Profil
    • Derniers messages
#2
  0
Hmm does it work for deathmatch reviews?
Deathmatic
« Citoyen »
1383652860000
    • Deathmatic#0000
    • Profil
    • Derniers messages
#3
  0
Despit what the doc says, tfm.exec.newGame("#permCategoryNumber") doesn't work.
A big gap for some mini-games that need to play a special category !
Abdeltif
« Citoyen »
1383655920000
    • Abdeltif#0000
    • Profil
    • Derniers messages
    • Tribu
#4
  0
AWESOME !
I'l be using this for my life <3
Shamousey
« Consul »
1383656700000
    • Shamousey#0095
    • Profil
    • Derniers messages
    • Tribu
#5
  0
Your code could be improved in places. Is there any need for the variables like n="Night"? Even so, they should be local.

Championrs a dit :
Hmm does it work for deathmatch reviews?

It wouldn't have the cannon shooting but that's easy enough to implement ;)

Deathmatic a dit :
Despit what the doc says, tfm.exec.newGame("#permCategoryNumber") doesn't work.
A big gap for some mini-games that need to play a special category !

At least it'll be ready for when that works!
Deathmatic
« Citoyen »
1383660660000
    • Deathmatic#0000
    • Profil
    • Derniers messages
#6
  0
Jaackster, you can remove the "!map #category" from the help ! ^^

Shamousey a dit :
At least it'll be ready for when that works!

Yes, but meanwhile we have to put each map one by one in a table. :(
Mikuhl
« Citoyen »
1383687120000
    • Mikuhl#3311
    • Profil
    • Derniers messages
    • Tribu
#7
  0
Shamousey a dit :
Your code could be improved in places. Is there any need for the variables like n="Night"? Even so, they should be local.

It was late at night, don't judge me. ;-;
But I fixed it anyway, and I made it so if the wind was 0 or the gravity was 10 it wouldnt show. (Since those are the normal variables.)

Edit: Whoops I fixed it again. I put 'or' instead of 'and'!
Mikuhl
1383782100000
    • Mikuhl#3311
    • Profil
    • Derniers messages
    • Tribu
#8
[Modéré par Bolinboy, raison : double post]
Andleandle
« Citoyen »
1385892060000
    • Andleandle#0000
    • Profil
    • Derniers messages
#9
  0
a dit :
tfm.exec.disableAutoShaman(true)
tfm.exec.newGame("@630022")
tfm.exec.disableAutoShaman(false)
tfm.exec.disableAfkDeath(true)
tfm.exec.disableAutoNewGame(true)
tfm.exec.disableAutoTimeLeft(true)

local devide = "<font size=%%quo1%% color=%%quo1%%> | </font>"

function eventNewGame()
if tfm.get.room.currentMap == "@630022" then
tfm.exec.setUIMapName("<G>Testing Lobby. Use <J>!help<G> to see a list of commands.\n")
elseif tfm.get.room.currentMap:sub(0,1) == "@" then
local mapSettings = {}
if tfm.get.room.xmlMapInfo.xml:match('13') ~= (nil and "0") then
table.insert(mapSettings, "Wind: <G>"..tfm.get.room.xmlMapInfo.xml:match('#52607B').."<J>")
end
if tfm.get.room.xmlMapInfo.xml:match('<P[^/]+G="([^"]+),[^"]+"[^/]+/>') ~= (nil and "10") then
table.insert(mapSettings, "Gravity: <G>"..tfm.get.room.xmlMapInfo.xml:match('<P[^/]+G="([^"]+),[^"]+"[^/]+/>').."<J>")
end
if tfm.get.room.xmlMapInfo.xml:match('<P[^/]+G="[^"]+,([^"]+)"[^/]+/>') == '<P[^/]+G="[^"]+,([^"]+)"[^/]+/>' then
table.insert(mapSettings, "Night")
end
if tfm.get.room.xmlMapInfo.xml:match('<P[^/]+(N="")[^/]+/>') == 'N=""' then
table.insert(mapSettings, "Collision")
end
if tfm.get.room.xmlMapInfo.xml:match('<P[^/]+(C="")[^/]+/>') == 'C=""' then
table.insert(mapSettings, "Soulmate")
end
if tfm.get.room.xmlMapInfo.xml:match('<P[^/]+(A="")[^/]+/>') == 'A=""' then
table.insert(mapSettings, "Portals")
end
tfm.exec.setUIMapName(tfm.get.room.xmlMapInfo.author.."<G> - @"..tfm.get.room.xmlMapInfo.mapCode.."<J>"..devide.."P"..tfm.get.room.xmlMapInfo.permCode..devide..table.concat(mapSettings, " ").."\n")
end
end

function eventChatCommand(name, cmd)
if cmd:sub(1,4) == "help" then
print("Script for testing and map review:\n\n<J>!map @code <G>: Plays a @Editor Map\n<J>!map ID <G>: Plays a Vanilla Map\n<J>!screenshot <G>: Puts everyone in screenshot mode.")
elseif cmd:sub(1,3) == "map" then
tfm.exec.newGame(cmd:sub(5))
screenshot = false
elseif cmd:sub(1,10) == "screenshot" then
for name, player in pairs(tfm.get.room.playerList) do
if screenshot == false or screenshot == nil then
tfm.exec.movePlayer(name, -1000, -1000)
screenshot = true
elseif screenshot == true then
screenshot = false
tfm.exec.respawnPlayer(name)
end
end
end
end

function eventPlayerDied(name)
if screenshot == false then
tfm.exec.respawnPlayer(name)
end
end

function eventPlayerGetCheese(name)
if tfm.get.room.currentMap == "@630022" then
tfm.exec.killPlayer(name)
tfm.exec.respawnPlayer(name)
end
end

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

Colored :)
  • Forums
  • /
  • Transformice
  • /
  • Modules
  • /
  • [Script] Script for testing and map review. (Plus a handy screenshot feature.)
© Atelier801 2018

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

Version 1.27