Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- --Creator: Bolodefchoco
- --Made in: 17/07/2015
- --Last update: 20/10/2019
- --[[ Notes:
- Does:
- Captura o XML de um mapa (Exceto vanillas)
- Keys:
- P --> Recarrega o mapa atual.
- Espaço --> Captura o XML e imprime-o em #lua
- ]]--
- do
- local _, err = pcall(nil)
- local roomOwner = string.match(err, "(.-)%.")
- system.bindKeyboard(roomOwner, 32, true)
- system.bindKeyboard(roomOwner, 80, true)
- end
- tfm.exec.newGame("#1")
- eventKeyboard = function(_, key)
- if key == 80 then -- P, loads the same map
- tfm.exec.newGame(tfm.get.room.currentMap)
- else -- Space, print XML
- local xml = tfm.get.room.xmlMapInfo
- if xml then
- xml = xml.xml
- -- Minify
- xml = string.gsub(xml, ",0,", ",,")
- xml = string.gsub(xml, "([^%.%d])0+", "%1")
- xml = string.gsub(xml, "(%D)0(%.)", "%1%2")
- -- Fix
- xml = string.gsub(xml, "<", "<")
- -- Display
- print("<R>" .. tfm.get.room.currentMap .. "'s XML:")
- for s = 1, #xml, 4500 do
- print(string.sub(xml, s, s + 4499))
- end
- end
- end
- end
Add Comment
Please, Sign In to add comment