Advertisement
Gekkeiju

Bootcamp Relay Check Point Editor

Oct 21st, 2015
375
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 9.37 KB | None | 0 0
  1. --Put the script runner's name here
  2. runner = "Gekkeiju"
  3.  
  4. ---last update: 24/10/2015
  5. --If you have map list, put it here. You can load them by the button "next". I gathered all the P3 maps here on 24/10/2015.
  6. maps = {"@213755", "@213752", "@209848", "@208653", "@205506", "@205240", "@204647", "@204488", "@203664", "@202574", "@201000", "@195672", "@193662", "@192560", "@192158", "@191443", "@191203", "@191177", "@185428", "@183139", "@182769", "@180801", "@176507", "@175204", "@172951", "@172520", "@172512", "@172501", "@171148", "@169076", "@166430", "@163159", "@160841", "@157960", "@157203", "@157004", "@151655", "@2329940", "@4445580", "@886744", "@330933", "@842019", "@3668888", "@179807", "@177652", "@1646448", "@206396", "@179488", "@1427980", "@815336", "@161434", "@216173", "@172621", "@592189", "@3908151", "@168754", "@512887", "@306365", "@1384078", "@2130169", "@410045", "@186066", "@2242899", "@3038589", "@2636519", "@263819", "@4067327", "@528032", "@511136", "@295932", "@271193", "@3988424", "@166032", "@460961", "@315666", "@162482", "@316012", "@304861", "@257218", "@232469", "@183141", "@423311", "@293559", "@2846829", "@458528", "@231137", "@320483", "@684566", "@2795201", "@4114521", "@3690269", "@167903", "@2416969", "@171480", "@171482", "@868262", "@166271", "@380516", "@368839", "@315800", "@297442", "@270143", "@189819", "@214631", "@281948", "@1256085", "@1410539", "@190996", "@424685", "@375455", "@182370", "@435812", "@3456260", "@257715", "@587501", "@1647131", "@3199998", "@2989803", "@2574744", "@438449", "@976944", "@1595965", "@277824", "@467137", "@1303323", "@1807217", "@164916", "@174223", "@161023", "@1111252", "@279337", "@408643", "@191642", "@1014313", "@319443", "@155765", "@176729", "@397478", "@1733211", "@365061", "@1657819", "@541223", "@306384", "@504485", "@496886", "@444589", "@551317", "@523270", "@2451444", "@153996", "@1580356", "@454049", "@1503203", "@1255359", "@506940", "@399364", "@2311703", "@155606", "@232675", "@1955745", "@586901", "@163531", "@149422", "@431749", "@1788490", "@514311", "@277513", "@272689", "@2794566", "@197229", "@2788517", "@113156", "@541729", "@172976", "@1156092", "@1989803", "@412467", "@333002", "@337644", "@1809410", "@2469365", "@556575", "@1226207", "@506613", "@1403454", "@1130256", "@596239", "@457726", "@898934", "@2520540", "@191205", "@496610", "@2914456", "@159145", "@394132", "@500748", "@223947", "@268915", "@1164086", "@166333", "@2040569", "@531084", "@1225867", "@5404791", "@263926", "@259319", "@167075", "@455271", "@500000", "@1990413", "@1580835", "@327354", "@1242584", "@1265789", "@172547", "@1620703", "@173623", "@564198", "@158417", "@1615753", "@169139", "@150651", "@1157281", "@170514", "@2024960", "@3551333", "@424900", "@834297", "@476706", "@3136410", "@2423300", "@721319", "@722837", "@557074", "@970919", "@1435902", "@158345", "@124000", "@568122", "@1722755", "@1046877", "@1390405", "@372255", "@149451", "@1000006", "@403755", "@1678634", "@1615949", "@1540221", "@302080", "@213874", "@1004622", "@1494499", "@1066607", "@593431", "@322582", "@156720", "@543010", "@1383297", "@500690", "@801683", "@593530", "@217261", "@222910", "@1333846", "@618999", "@1398609", "@395216", "@500894", "@329571", "@378704", "@235037", "@329200", "@354984", "@159932", "@401630", "@1162831", "@999963", "@163596", "@152260", "@373105", "@1593066", "@264091", "@1531604", "@1526894", "@552986", "@1323048", "@301610", "@199710", "@199210", "@424604", "@173816", "@299983", "@439092", "@654894", "@571683", "@152733", "@560526", "@166361", "@159187", "@236768", "@184817", "@176710", "@179492", "@1301649", "@410040", "@562897", "@449496", "@163172", "@4000000", "@3326197", "@563436", "@403940", "@593164", "@397467", "@208373", "@166805", "@374995", "@163506", "@159298", "@2932238", "@3133917", "@172605", "@155480", "@155628", "@361500", "@155611", "@919484", "@842167", "@758595", "@254785", "@214755", "@208940", "@185887", "@179005", "@176253", "@171776", "@169110", "@169059", "@158909", "@192255", "@343456", "@299942", "@208056", "@168204", "@881158", "@492399", "@505619", "@729863", "@184648", "@541693", "@258192", "@165186", "@163094", "@169228", "@556841", "@195116", "@391924", "@438333", "@420877", "@783547", "@303939", "@510996", "@185873", "@272402", "@692740", "@692650", "@184868", "@612415", "@605255", "@608368", "@313216", "@575497", "@522719", "@506032", "@220352", "@185529", "@185289", "@164544", "@397469", "@3380788", "@1266330", "@330967", "@584783", "@157805", "@237091", "@574183", "@176619", "@190646", "@549666", "@242291", "@295465", "@332906", "@557066", "@150664", "@560583", "@329318", "@342035", "@331344", "@175280", "@536905", "@192959", "@166056", "@1018394", "@3333223", "@3668866", "@499986", "@497965", "@492222", "@3242049", "@478236", "@447805", "@438364", "@432501", "@431433", "@425884", "@422981", "@419635", "@419369", "@419335", "@412913", "@408577", "@395961", "@395310", "@392240", "@376704", "@372419", "@336305", "@332130", "@331988", "@327743", "@320626", "@318129", "@314743", "@307324", "@305820", "@305614", "@305567", "@303151", "@295630", "@3734991", "@289865", "@286254", "@282584", "@277427", "@272518", "@271411", "@270924", "@3295967", "@261814", "@261298", "@258908", "@257324", "@250153", "@2178800", "@232678", "@231921", "@230588", "@227093", "@226266", "@225744", "@222377", "@216171"}
  7.  
  8.  
  9. ------------------------------------
  10.  
  11. cp = {}
  12. ccp = 1
  13. map = ""
  14.  
  15. index = 0
  16. log = {}
  17.  
  18. current = nil
  19. keyCodes = {space=32, ctrl = 17, ccp = 67}
  20. for i = 1, 10 do
  21.     keyCodes[i] = 47 + i
  22. end
  23.  
  24. tfm.exec.disableAutoNewGame(true)
  25. tfm.exec.disableAutoShaman(true)
  26. tfm.exec.disableAfkDeath(true)
  27. tfm.exec.disableAutoTimeLeft(true)
  28.  
  29. system.bindMouse(runner, true)
  30. for key, value in pairs(keyCodes) do
  31.     tfm.exec.bindKeyboard(runner, value, true, true)
  32.     tfm.exec.bindKeyboard(runner, value, false, true)
  33. end
  34.  
  35. ui.addTextArea(100, "<font color=\"#5555FF\"><a href=\"event:next\">next</a></font>", runner, 803, 0, 35, 18, 0xAAAAAA, 0x666666, 1, true)
  36. ui.addTextArea(101, "<font color=\"#5555FF\"><a href=\"event:save\">save</a></font>", runner, 803, 27, 35, 18, 0xAAAAAA, 0x666666, 1, true)
  37. ui.addTextArea(102, "<font color=\"#5555FF\"><a href=\"event:print\">print</a></font>", runner, 803, 54, 35, 18, 0xAAAAAA, 0x666666, 1, true)
  38.  
  39.  
  40.  
  41.  
  42. function eventKeyboard(name, code, down)
  43.     if down then
  44.         current = code
  45.         if code == keyCodes.ccp then
  46.             ccp = #cp + 1
  47.             draw()
  48.         end
  49.     else
  50.         if code == current then
  51.             current = nil
  52.         end
  53.     end
  54. end
  55.  
  56. function eventMouse(name, x, y)
  57.     if current == nil then return end
  58.     if current >= keyCodes[1] and current <= keyCodes[10] then
  59.         for i, xy in pairs(cp) do
  60.             if (xy[1] - x)^2 + (xy[2] - y)^2 < 225 then
  61.                 return
  62.             end
  63.         end
  64.         local ind = current - keyCodes[1] + 1
  65.         if ind > #cp + 1 then
  66.             ind = #cp + 1
  67.         end
  68.         table.insert(cp, ind, {x, y})
  69.         if ind <= ccp then
  70.             ccp = ccp + 1
  71.         end
  72.         if #cp==11 then
  73.             table.remove(cp, 11)
  74.         end
  75.         draw()
  76.     elseif current==keyCodes.ctrl then
  77.         tfm.exec.movePlayer(runner, x, y)
  78.     elseif current == keyCodes.ccp then
  79.         for i, xy in pairs(cp) do
  80.             if (xy[1] - x)^2 + (xy[2] - y)^2 < 225 then
  81.                 ccp = i
  82.                 draw()
  83.                 break
  84.             end
  85.         end
  86.     elseif current == keyCodes.space then
  87.         for i, xy in pairs(cp) do
  88.             if (xy[1] - x)^2 + (xy[2] - y)^2 < 225 then
  89.                 table.remove(cp, i)
  90.                 if i < ccp then
  91.                     ccp = ccp - 1
  92.                 end
  93.                 draw()
  94.                 return
  95.             end
  96.         end
  97.     end
  98. end
  99.  
  100. function draw()
  101.     for i = 1, 10 do
  102.         ui.removeTextArea(i, runner)
  103.     end
  104.     for i = 1, ccp - 1 do
  105.         ui.addTextArea(i, tostring(i - 1), runner, cp[i][1] - 12, cp[i][2] - 12, 25, 25, 0x91A918, 0xFFFFFF, 0.5)
  106.     end
  107.     for i = ccp, #cp do
  108.         ui.addTextArea(i, "C"..(i - 1), runner, cp[i][1] - 12, cp[i][2] - 12, 25, 25, 0x91A918, 0xFFFFFF, 0.5)
  109.     end
  110. end
  111.  
  112. function eventChatCommand(name, message)
  113.     if name~=runner then return end
  114.         local args={}
  115.         for arg in message:gmatch("[^%s]+") do
  116.                 table.insert(args,arg:lower())
  117.         end
  118.     if args[1] == "save" then
  119.         for i, data in pairs(log) do
  120.             if data[1] == map then
  121.                 table.remove(log, i)
  122.                 break
  123.             end
  124.         end
  125.         table.insert(log, {map, cp, ccp})
  126.         print("Check point saved: " .. getMapString({map, cp, ccp}))
  127.     elseif args[1] == "next" then
  128.         index = index + 1
  129.         if index <= #maps then
  130.             tfm.exec.newGame(maps[index])
  131.         else
  132.             print("no more map in the list")
  133.         end
  134.     elseif args[1] == "print" then
  135.         local str={}
  136.         for i, data in pairs(log) do
  137.             table.insert(str, getMapString(data))
  138.         end
  139.         print("{" .. table.concat(str, ", ") .. "}")
  140.     elseif args[1] == "clear" then
  141.         log = {}
  142.     elseif args[1] == "delete" and args[2] then
  143.         for i, data in pairs(log) do
  144.             if data[1] == args[2] then
  145.                 table.remove(log, i)
  146.                 break
  147.             end
  148.         end
  149.     end
  150. end
  151.  
  152. function getMapString(data)
  153.     local str = {}
  154.     local cp = data[2]
  155.     for i = 1, #(cp) do
  156.         table.insert(str, "{" .. cp[i][1] .. ", " .. cp[i][2] .. "}")
  157.     end
  158.     str = table.concat(str, ", ")
  159.     return "{\"@" .. data[1] .. "\", {" .. str .. "}, " .. data[3] .. "}"
  160. end
  161.  
  162. function eventNewGame()
  163.     cp = {}
  164.     ccp = 1
  165.     map = tfm.get.room.xmlMapInfo.mapCode
  166.     for i, data in pairs(log) do
  167.         if data[1] == map then
  168.             cp = data[2]
  169.             ccp = data[3]
  170.             break
  171.         end
  172.     end
  173.     draw()
  174. end
  175.  
  176. function eventPlayerDied(name)
  177.     tfm.exec.respawnPlayer(name)
  178. end
  179.  
  180. function eventTextAreaCallback(id, name, text)
  181.     eventChatCommand(name, text)
  182. end
  183.  
  184. function eventPlayerWon(name)
  185.     eventPlayerDied(name)
  186. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement