vincoreprograms

vmail_offical

Dec 25th, 2014
265
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 6.94 KB | None | 0 0
  1. --Variables
  2. _logo = paintutils.loadImage("vmail_logo")
  3. Space = " "
  4. from_string = "From: "
  5. Version = "Released"
  6. Last_Updated = "1/1/15"
  7.  
  8. --Functions
  9. function test()
  10. --Test for mouse functions
  11. term.setCursorPos(10,10)
  12. write("TEST")
  13. end
  14.  
  15. function update()
  16. local pastebinProgram = "gFfr4jkU"
  17. local pastebinLogo = "1ncH36PP"
  18.  
  19. drawColors()
  20. fs.delete("vmail_logo")
  21. shell.run("pastebin", "get", pastebinLogo, "vmail_logo")
  22. fs.delete("vmail")
  23. shell.run("pastebin", "get", pastebinProgram, "vmail")
  24. end
  25.  
  26. function back()
  27. clean()
  28. draw()
  29. while true do
  30. parallel.waitForAny(listen, mouse_main)
  31. return
  32. end
  33. end
  34.  
  35. function new()
  36. --Start
  37. clean()
  38. drawColors()
  39. term.setCursorPos(45,1)
  40. write("[Quit]")
  41. term.setCursorPos(10,1)
  42. write("[Send]")
  43. term.setCursorPos(1,1)
  44. write("[Cancel]")
  45. term.setBackgroundColor(colors.cyan)
  46. term.setCursorPos(1,6)
  47. write("Message:")
  48. term.setCursorPos(1,4)
  49. write("From: ")
  50. term.setCursorPos(1,3)
  51. write("ID: ")
  52. term.setCursorPos(5,3)
  53. to_input = read()
  54. term.setCursorPos(7,4)
  55. from_input = read()
  56. term.setCursorPos(10,6)
  57. message_input = read()
  58. mouse_new()
  59. end
  60.  
  61. function mouse_new()
  62. while true do
  63. local event, button, xPos, yPos = os.pullEvent("mouse_click")
  64. if _ms == 0 and button == 1 and xPos < 9 and yPos == 1 then
  65. back()
  66. end
  67.  
  68. if _ms == 0 and button == 1 and xPos < 16 and xPos > 8 and yPos == 1 then
  69. send()
  70. end
  71.  
  72. if _ms == 0 and button == 1 and xPos >= 45 and xPos <= 50 and yPos == 1 then
  73. quit()
  74. end
  75. end
  76. end
  77.  
  78. function mouse_bugs()
  79. while true do
  80. local event, button, xPos, yPos = os.pullEvent("mouse_click")
  81. if _ms == 0 and button == 1 and xPos <= 6 and yPos == 1 then
  82. back()
  83. end
  84.  
  85. if _ms == 0 and button == 1 and xPos >= 8 and xPos <= 15 and yPos == 1 then
  86. email_bugs()
  87. end
  88. end
  89. end
  90.  
  91. function mouse_help()
  92. while true do
  93. local event, button, xPos, yPos = os.pullEvent("mouse_click")
  94. if _ms == 0 and button == 1 and xPos <= 7 and yPos == 1 then
  95. back()
  96. end
  97.  
  98. if _ms == 0 and button == 1 and xPos >= 45 and xPos <= 50 and yPos == 1 then
  99. quit()
  100. end
  101.  
  102. if _ms == 0 and button == 1 and xPos >= 1 and xPos <= 13 and yPos == 3 then
  103. email_bugs()
  104. end
  105. end
  106. end
  107.  
  108. function mouse_main()
  109. _ms = 0
  110. while true do
  111. local event, button, xPos, yPos = os.pullEvent("mouse_click")
  112.  
  113. if _ms == 0 and button == 1 and xPos < 6 and yPos == 1 then
  114. new()
  115. end
  116.  
  117. if _ms == 0 and button == 1 and xPos >= 45 and xPos <= 50 and yPos == 1 then
  118. quit()
  119. end
  120.  
  121. if _ms == 0 and button == 1 and xPos >= 9 and xPos <= 15 and yPos == 1 then
  122. restart()
  123. end
  124.  
  125. if _ms == 0 and button == 1 and xPos >= 19 and xPos <= 28 and yPos == 1 then
  126. help()
  127. end
  128.  
  129. if _ms == 0 and button == 1 and xPos >= 28 and xPos <= 34 and yPos == 1 then
  130. bugs()
  131. end
  132.  
  133. if _ms == 0 and button == 1 and xPos >= 36 and xPos <= 43 and yPos == 1 then
  134. clean()
  135. draw()
  136. while true do
  137. parallel.waitForAny(listen, mouse_main)
  138. end
  139. end
  140. end
  141. end
  142.  
  143. function mouse_email_bugs()
  144. _ms = 0
  145. while true do
  146. local event, button, xPos, yPos = os.pullEvent("mouse_click")
  147. if _ms == 0 and button == 1 and xPos < 9 and yPos == 1 then
  148. back()
  149. end
  150.  
  151. if _ms == 0 and button == 1 and xPos < 16 and xPos > 8 and yPos == 1 then
  152. send_email()
  153. end
  154.  
  155. if _ms == 0 and button == 1 and xPos >= 45 and xPos <= 50 and yPos == 1 then
  156. quit()
  157. end
  158. end
  159. end
  160.  
  161. function clean()
  162. term.clear()
  163. term.setCursorPos(1,1)
  164. end
  165.  
  166. function listen()
  167. local counter = 2
  168. local Event, ID, Message, Distance = os.pullEvent("rednet_message")
  169. clean()
  170. draw()
  171. term.setCursorPos(1, 5)
  172. write("Sender's ID: " ..ID .."\n" ..Message)
  173. return
  174. end
  175.  
  176. function help()
  177. clean()
  178. drawColors()
  179. term.setCursorPos(45,1)
  180. write("[Quit]")
  181. term.setCursorPos(1,1)
  182. write("[Back]")
  183. term.setBackgroundColor(colors.cyan)
  184. term.setCursorPos(1,3)
  185. write("[EMAIL DEVS]")
  186. mouse_help()
  187. end
  188.  
  189. function start()
  190. clean()
  191. drawColors()
  192. paintutils.drawImage(_logo, 10, 5)
  193. sleep(1)
  194. end
  195.  
  196. function quit()
  197. clean()
  198. drawColors()
  199. term.setCursorPos(1,1)
  200. write("Thank you for using VinCore Programs")
  201. sleep(1)
  202. os.reboot()
  203. end
  204.  
  205. function email_bugs()
  206. clean()
  207. drawColors()
  208. term.setCursorPos(45,1)
  209. write("[Quit]")
  210. term.setCursorPos(10,1)
  211. write("[Send]")
  212. term.setCursorPos(1,1)
  213. write("[Cancel]")
  214. term.setBackgroundColor(colors.cyan)
  215. term.setCursorPos(1,5)
  216. write("Message/Bug:")
  217. term.setCursorPos(1,4)
  218. write("Your Email: ")
  219. term.setCursorPos(1,3)
  220. write("From:")
  221. term.setCursorPos(7,3)
  222. from_email_input = read()
  223. term.setCursorPos(13, 4)
  224. email_from_user = read()
  225. term.setCursorPos(14,5)
  226. message_email_input = read()
  227. mouse_email_bugs()
  228. end
  229.  
  230. function bugs()
  231. clean()
  232. drawColors()
  233. term.setCursorPos(1,1)
  234. write("[Back]")
  235. term.setCursorPos(8,1)
  236. write("[Email]")
  237. term.setBackgroundColor(colors.cyan)
  238. term.setCursorPos(1,3)
  239. write("Please email us by click [Email] on the top of the screen!")
  240. term.setCursorPos(1,6)
  241. write("I will try to put out an update ASAP with that bug fixed if it is a major problem with the program.")
  242. term.setCursorPos(1,8)
  243. write("You may also ask any questions on this email.")
  244. term.setCursorPos(1,10)
  245. write("WARNING: If you abuse the email system it will be taken down.")
  246. term.setCursorPos(1,13)
  247. write("Thanks for reporting the bug!")
  248. mouse_bugs()
  249. end
  250.  
  251. function draw()
  252. clean()
  253. drawColors()
  254. term.setCursorPos(45,1)
  255. write("[Quit]")
  256. term.setCursorPos(1,1)
  257. write("[New]")
  258. term.setCursorPos(9, 1)
  259. write("[Reset]") --25
  260. term.setCursorPos(19, 1)
  261. write("[Help]")
  262. term.setCursorPos(28, 1)
  263. write("[Bugs]")
  264. term.setCursorPos(10,10)
  265. term.setCursorPos(36, 1)
  266. write("[Clear]") --7
  267. term.setCursorPos(1,3)
  268. term.setBackgroundColor(colors.cyan)
  269. write("Mail: ")
  270. end
  271.  
  272. function restart()
  273. clean()
  274. shell.run("vmail")
  275. end
  276.  
  277. function send()
  278. Send_String = "From: " ..from_input .."\n" .."Message: " .."\n" .."\n" ..message_input
  279. sendingN = tonumber(to_input)
  280. rednet.send(sendingN, Send_String)
  281. clean()
  282. drawColors()
  283. term.setCursorPos(1,1)
  284. write("Message sent...")
  285. sleep(1)
  286. back()
  287. end
  288.  
  289. function send_email()
  290. email = "From: " ..from_email_input .. "\n" .."Email: " ..email_from_user.."\n" .."\n".."Bug/Message: " .."\n" .."\n" ..message_email_input
  291. http.post(
  292. "http://vincoreprograms.host22.com/vmail_email_bugs.php?message=" ..textutils.urlEncode(tostring(email))
  293. )
  294. clean()
  295. drawColors()
  296. term.setCursorPos(1,1)
  297. write("Bug/Message has been emailed to the developer!")
  298. sleep(1)
  299. back()
  300. end
  301.  
  302. function drawColors()
  303. paintutils.drawLine(1, 1, 100, 1, colors.blue)
  304. for i = 1,19 do
  305. i = i + 1
  306. paintutils.drawLine(1, i, 100, i, colors.cyan)
  307. end
  308. paintutils.drawLine(1, 19, 100, 19, colors.blue)
  309. term.setCursorPos(1,19)
  310. write("Last Update: " ..Last_Updated)
  311. end
  312.  
  313. function main()
  314. update()
  315. start()
  316. clean()
  317. draw()
  318. while true do
  319. parallel.waitForAny(listen, mouse_main)
  320. end
  321. end
  322.  
  323. --Main
  324. main()
Advertisement
Add Comment
Please, Sign In to add comment