Advertisement
Llamas117

Traductor Jé

Jun 30th, 2015
289
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 2.45 KB | None | 0 0
  1. local words_to_mox = {
  2. ["A"] = "a4H",
  3. ["B"] = "bB",
  4. ["C"] = "cc",
  5. ["D"] = "dd",
  6. ["E"] = "3eE",
  7. ["F"] = "ff",
  8. ["G"] = "J",
  9. ["H"] = "H",
  10. ["I"] = "ii",
  11. ["J"] = "g",
  12. ["K"] = "Q",
  13. ["L"] = "Lll",
  14. ["M"] = "mMm",
  15. ["N"] = "Ñ",
  16. ["Ñ"] = "N",
  17. ["O"] = "o0O",
  18. ["P"] = "9",
  19. ["Q"] = "K",
  20. ["R"] = "rrR",
  21. ["S"] = "zS",
  22. ["T"] = "7T",
  23. ["U"] = "uU",
  24. ["V"] = "V",
  25. ["W"] = "ww",
  26. ["X"] = "xxX",
  27. ["Y"] = "iIii",
  28. ["Z"] = "sSS"
  29. }
  30. local words_to_flai = {
  31. ["A"] = "áá",
  32. ["B"] = "v",
  33. ["C"] = "C",
  34. ["D"] = "D",
  35. ["E"] = "è",
  36. ["F"] = "F",
  37. ["G"] = "G",
  38. ["H"] = "",
  39. ["I"] = "ííí",
  40. ["J"] = "J",
  41. ["K"] = "K",
  42. ["L"] = "L",
  43. ["M"] = "M",
  44. ["N"] = "N",
  45. ["Ñ"] = "Ñ",
  46. ["O"] = "ó",
  47. ["P"] = "P",
  48. ["Q"] = "Q",
  49. ["R"] = "r",
  50. ["S"] = "z",
  51. ["T"] = "T",
  52. ["U"] = "úú",
  53. ["V"] = "b",
  54. ["W"] = "W",
  55. ["X"] = "X",
  56. ["Y"] = "Y",
  57. ["Z"] = "Z"
  58. }
  59.  
  60. function show_ui(name)
  61.         ui.addTextArea(0, "<p align='center'><a href='event:mox_trad'><b>Traductor M0X0</b></a></p>", name, 5, 370, 70, 30, 0x4c6570, 0x3e545e, 0.6, true)
  62.         ui.addTextArea(1, "<p align='center'><a href='event:flai_trad'><b>Traductor Flaite</b></a></p>", name, 689, 370, 70, 30, 0x4c6570, 0x3e545e, 0.6, true)
  63. end
  64.  
  65. function eventTextAreaCallback(id, name, callback)
  66.         if id >= 0 and id <= 1 then
  67.                 ui.addPopup(id, 2, "Texto a traducir", name, 40, 120, 250)
  68.                 ui.addTextArea(2, "", name, 400, 120, 250, 80, 0x4c6570, 0x3e545e, 0.6, true)
  69.                 ui.addTextArea(3, "<p align='center'><b>Traducción<b></p>", name, 400, 95, 250, 15, 0x4c6570, 0x3e545e, 0.6, true)
  70.         end
  71. end
  72.  
  73. function eventPopupAnswer(id, name, answer)
  74.         if id == 0 then
  75.                 answer = answer:upper()
  76.                 out = answer:gsub("(.)",
  77.                 function(c)
  78.                         if words_to_mox[c] then return words_to_mox[c] else return c end
  79.                 end
  80.                 )
  81.                 print('Texto de '..name..': '..out)            
  82.                 ui.updateTextArea(2, out, name)
  83.         elseif id == 1 then
  84.                 answer = answer:upper()
  85.                 out = answer:gsub("(.)",
  86.                 function(c)
  87.                         if words_to_flai[c] then return words_to_flai[c] else return c end
  88.                 end
  89.                 )
  90.                 out = out:gsub("óLáá", "WèNáá")
  91.                 print('Texto de '..name..': '..out)
  92.                 ui.updateTextArea(2, out, name)
  93.         end
  94. end
  95.  
  96. show_ui(nil)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement