imbuedl

Bank Clip Script (from on top of bank) (in progress)

Jan 1st, 2019
61
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 25.26 KB | None | 0 0
  1. itools = dofile('lib_input_tools.lua')
  2. core = dofile('lib_core.lua')
  3.  
  4. N = 9 -- number of visual frames to advance before assuming link does not clip out of bounds
  5. M = 10 -- number of visual frames to advance before assuming link does not land out of bounds
  6.  
  7. function i_advance(amount)
  8.     for i = 1, amount, 1 do
  9.         itools.iframe_advance()
  10.     end
  11. end
  12.  
  13. function v_advance(amount)
  14.     for i = 1, amount, 1 do
  15.         itools.vframe_advance()
  16.     end
  17. end
  18.  
  19. function v_advance_press_A(amount)
  20.     for i = 1, amount, 1 do
  21.         itools.vframe_advance({['A']=true})
  22.     end
  23. end
  24.  
  25. function v_advance_press_Z(amount)
  26.     for i = 1, amount, 1 do
  27.         itools.vframe_advance({['Z']=true})
  28.     end
  29. end
  30.  
  31. function v_advance_press_R(amount)
  32.     for i = 1, amount, 1 do
  33.         itools.vframe_advance({['R']=true})
  34.     end
  35. end
  36.  
  37. function v_advance_hold_up(amount)
  38.     for i = 1, amount, 1 do
  39.         itools.vframe_advance({['X Axis']=0,['Y Axis']=127})
  40.     end
  41. end
  42.  
  43. function v_advance_hold_up_and_target(amount)
  44.     for i = 1, amount, 1 do
  45.         itools.vframe_advance({['X Axis']=0,['Y Axis']=127,['Z']=true})
  46.     end
  47. end
  48.  
  49. function set_down_isg()
  50.  
  51.     -- set down a bomb (on C-Down) and get isg
  52.     -- This takes a total of 42 visual frames
  53.    
  54.     itools.vframe_advance({['C Down']=true})
  55.     itools.clear_inputs()
  56.    
  57.     v_advance(1)
  58.     itools.vframe_advance({['A']=true})
  59.     itools.clear_inputs()
  60.    
  61.     v_advance_press_R(12)
  62.     itools.vframe_advance({['R']=true,['B']=true})
  63.     itools.clear_inputs()
  64.    
  65.     v_advance_press_R(6)
  66.     itools.vframe_advance({['R']=true,['A']=true})
  67.     itools.clear_inputs()
  68.    
  69.     v_advance(19)
  70.    
  71.     -- can perform the first input to walk somewhere (for example) on the next frame
  72.    
  73.  
  74. end
  75.  
  76. function shield_drop_isg()
  77.  
  78.     -- frame perfectly shield drop a bomb (on C-Down) and get isg off of it
  79.     -- This takes a total of 34 visual frames
  80.    
  81.     itools.vframe_advance({['C Down']=true})
  82.     itools.clear_inputs()
  83.    
  84.     v_advance(2)
  85.     v_advance_press_R(4)
  86.    
  87.     itools.vframe_advance({['R']=true,['B']=true})
  88.     itools.clear_inputs()
  89.    
  90.     v_advance_press_R(6)
  91.     itools.vframe_advance({['R']=true,['A']=true})
  92.     itools.clear_inputs()
  93.    
  94.     v_advance(19)
  95.    
  96.     -- can perform the first input to walk somewhere (for example) on the next frame
  97.  
  98. end
  99.  
  100. function set_down_bomb()
  101.    
  102.     itools.clear_inputs()
  103.    
  104.     v_advance_press_A(1)
  105.     itools.clear_inputs()
  106.    
  107.     v_advance(11)
  108.     itools.clear_inputs()
  109.    
  110. end
  111.  
  112. function set_down_bomb_target()
  113.    
  114.     itools.clear_inputs()
  115.    
  116.     v_advance_press_A(1)
  117.     itools.clear_inputs()
  118.    
  119.     v_advance_press_Z(11)
  120.     itools.clear_inputs()
  121.    
  122. end
  123.  
  124. -- Define functions to perform each movement option (except for 'Nothing')
  125.  
  126. -- Movement_Options = ['Untargeted Horizontal Slash',
  127. -- 'Untargeted Horizontal Slash, Shield', 'Targeted Vertical Slash', 'Targeted Vertical Slash, Untarget ASAP',
  128. -- 'Untargeted Right Slash', 'Untargeted Right Slash, Shield', 'Targeted Forward Thrust',
  129. -- 'Targeted Forward Thrust, Untarget ASAP', 'Nothing']
  130.  
  131.  
  132.  
  133. function Untargeted_Horizontal_Slash()
  134.    
  135.     itools.clear_inputs()
  136.    
  137.     v_advance(2)
  138.    
  139.     itools.vframe_advance({['B']=true})
  140.    
  141.     itools.clear_inputs()
  142.    
  143.     v_advance(15)
  144.    
  145. end
  146.  
  147. function Untargeted_Horizontal_Slash_Shield()
  148.    
  149.     itools.clear_inputs()
  150.    
  151.     itools.vframe_advance()
  152.    
  153.     itools.vframe_advance({['B']=true})
  154.    
  155.     itools.clear_inputs()
  156.    
  157.     v_advance_press_R(10)
  158.    
  159.     itools.clear_inputs()
  160.    
  161.     v_advance(8)
  162.    
  163. end
  164.  
  165. function Targeted_Vertical_Slash()
  166.    
  167.     itools.clear_inputs()
  168.    
  169.     itools.vframe_advance()
  170.    
  171.     itools.vframe_advance({['B']=true, ['Z']=true})
  172.    
  173.     v_advance_press_Z(8)
  174.    
  175.     itools.clear_inputs()
  176.    
  177.     v_advance(7)
  178.    
  179.     itools.clear_inputs()
  180.    
  181.     itools.vframe_advance()
  182. end
  183.  
  184. function Targeted_Vertical_Slash_Untarget_ASAP()
  185.    
  186.     itools.clear_inputs()
  187.    
  188.     itools.vframe_advance()
  189.    
  190.     itools.vframe_advance({['B']=true, ['Z']=true})
  191.    
  192.     itools.clear_inputs()
  193.    
  194.     v_advance(14)
  195.    
  196. end
  197.  
  198. function Untargeted_Right_Slash()
  199.    
  200.     itools.clear_inputs()
  201.    
  202.     itools.vframe_advance()
  203.    
  204.     itools.vframe_advance({['Z']=true})
  205.    
  206.     itools.clear_inputs()
  207.    
  208.     v_advance(5)
  209.    
  210.     itools.vframe_advance({['X Axis']=127,['Y Axis']=0,['B']=true})
  211.    
  212.     itools.clear_inputs()
  213.    
  214.     v_advance(17)
  215.    
  216. end
  217.  
  218. function Untargeted_Right_Slash_Shield()
  219.    
  220.     itools.clear_inputs()
  221.    
  222.     itools.vframe_advance()
  223.    
  224.     itools.vframe_advance({['Z']=true})
  225.    
  226.     itools.clear_inputs()
  227.    
  228.     v_advance(5)
  229.    
  230.     itools.vframe_advance({['X Axis']=127,['Y Axis']=0,['B']=true})
  231.    
  232.     itools.clear_inputs()
  233.    
  234.     v_advance_press_R(9)
  235.    
  236.     itools.clear_inputs()
  237.    
  238.     v_advance(8)
  239.    
  240. end
  241.  
  242. function Targeted_Forward_Thrust()
  243.    
  244.     itools.clear_inputs()
  245.    
  246.     itools.vframe_advance()
  247.    
  248.     itools.vframe_advance()
  249.    
  250.     itools.vframe_advance({['Z']=true})
  251.    
  252.     itools.clear_inputs()
  253.    
  254.     v_advance(5)
  255.    
  256.     itools.vframe_advance({['X Axis']=0,['Y Axis']=127,['B']=true,['Z']=true})
  257.    
  258.     itools.clear_inputs()
  259.    
  260.     v_advance_press_Z(8)
  261.    
  262.     itools.clear_inputs()
  263.    
  264.     v_advance(5)
  265.    
  266. end
  267.  
  268. function Targeted_Forward_Thrust_Untarget_ASAP()
  269.    
  270.     itools.clear_inputs()
  271.    
  272.     itools.vframe_advance()
  273.    
  274.     itools.vframe_advance({['Z']=true})
  275.    
  276.     itools.clear_inputs()
  277.    
  278.     v_advance(5)
  279.    
  280.     itools.vframe_advance({['X Axis']=0,['Y Axis']=127,['B']=true,['Z']=true})
  281.    
  282.     itools.clear_inputs()
  283.    
  284.     v_advance(12)
  285.    
  286. end
  287.  
  288.  
  289. file = io.open('bank clip permutations 4 options test1.txt')
  290. contents = file:read('*a')
  291. file:close()
  292.  
  293. function split(input)
  294.     local t={} ; i=1
  295.     for str in string.gmatch(input, '([^\n]+)') do
  296.         t[i] = str
  297.         i = i + 1
  298.     end
  299.     return t
  300. end
  301.  
  302. perms = split(contents)
  303. file_write = io.open('bank clip permutations 4 options data.txt', 'w+')
  304.  
  305. Clip_Exists = false
  306. Setup_Exists = false
  307. Line_Count = 1
  308.  
  309. ikeeta = 1
  310. while ikeeta <= table.getn(perms) do
  311.    
  312.     line = perms[ikeeta]
  313.    
  314.     itools.clear_inputs()
  315.    
  316.     -- STUFF HERE
  317.     print('Line: ' .. Line_Count .. '    Clip Exists ' .. tostring(Clip_Exists) .. '    Setup Exists ' .. tostring(Setup_Exists))
  318.    
  319.     Valid_Position = false
  320.     Valid_A_Action = false
  321.     Got_ISG = false
  322.     Valid_Bomb_Position_1 = false
  323.     Valid_Bomb_Position_2 = false
  324.     Valid_Bomb_Position_3 = false
  325.     Clip_Successful_1 = false
  326.     Clip_Successful_2 = false
  327.     Clip_Successful_3 = false
  328.     Setup_Successful_1 = false
  329.     Setup_Successful_2 = false
  330.     Setup_Successful_3 = false
  331.    
  332.     itools.clear_inputs()
  333.  
  334.     -- load save state (3)
  335.     itools.load_state(3)
  336.    
  337.     -- Perform the movements in a given permutation
  338.     previous_index = 1
  339.     for i = 1, string.len(line), 1 do
  340.         if string.sub(line, i, i) == '&' then
  341.            
  342.             if string.sub(line, previous_index, i-1) == 'Untargeted Horizontal Slash' then
  343.                
  344.                 Untargeted_Horizontal_Slash()
  345.  
  346.             elseif string.sub(line, previous_index, i-1) == 'Untargeted Horizontal Slash, Shield' then
  347.                
  348.                 Untargeted_Horizontal_Slash_Shield()
  349.                
  350.             elseif string.sub(line, previous_index, i-1) == 'Targeted Vertical Slash' then
  351.                
  352.                 Targeted_Vertical_Slash()
  353.                
  354.             elseif string.sub(line, previous_index, i-1) == 'Targeted Vertical Slash, Untarget ASAP' then
  355.                
  356.                 Targeted_Vertical_Slash_Untarget_ASAP()
  357.            
  358.             elseif string.sub(line, previous_index, i-1) == 'Untargeted Right Slash' then
  359.                
  360.                 Untargeted_Right_Slash()
  361.            
  362.             elseif string.sub(line, previous_index, i-1) == 'Untargeted Right Slash, Shield' then
  363.                
  364.                 Untargeted_Right_Slash_Shield()
  365.            
  366.             elseif string.sub(line, previous_index, i-1) == 'Targeted Forward Thrust' then
  367.            
  368.                 Targeted_Forward_Thrust()
  369.            
  370.             elseif string.sub(line, previous_index, i-1) == 'Targeted Forward Thrust, Untarget ASAP' then
  371.                
  372.                 Targeted_Forward_Thrust_Untarget_ASAP()
  373.                
  374.             end
  375.            
  376.             previous_index = i + 1
  377.         end
  378.     end
  379.    
  380.     -- Update Y Position
  381.     Y_Position = core.read_float_be(0x3FFDD8,'RDRAM')
  382.     if Y_Position == 133 then
  383.         Valid_Position = true
  384.     end
  385.    
  386.     -- Check if 'Speak' is on the A Button (value of 15 corresponds to 'Speak')
  387.     A_Action = memory.readbyte(0x3FD71D,'RDRAM')
  388.     if A_Action ~= 15 then
  389.         Valid_A_Action = true
  390.     end
  391.    
  392.    
  393.     -- Continue if link is on top of the banker and if cannot 'Speak' to the banker
  394.     if Valid_Position == true and Valid_A_Action == true then
  395.        
  396.         -- Get shield drop ISG and create a savestate
  397.         shield_drop_isg()
  398.         itools.save_state(4)
  399.        
  400.         Sword_Active = memory.read_u8(0x40088B, 'RDRAM')
  401.         if Sword_Active == 1 then
  402.             Got_ISG = true
  403.         end
  404.  
  405.         -- Check if link has ISG
  406.        
  407.         if Got_ISG == true then
  408.            
  409.             -- first set down the bomb without targeting and then walk forward without targeting
  410.            
  411.             -- goal: count how many frames it takes to hit -2 Y Velocity after setting down the bomb
  412.            
  413.             set_down_bomb()
  414.            
  415.             Bomb_Y_Position = core.read_float_be(0x410628,'RDRAM')
  416.            
  417.             if Bomb_Y_Position < 133 then
  418.                 Valid_Bomb_Position_1 = true
  419.             end
  420.            
  421.            
  422.             if Valid_Bomb_Position_1 == true then
  423.                
  424.                 found_y_velocity = false
  425.                 reach_y_velocity_time = 0
  426.                 while found_y_velocity == false and reach_y_velocity_time <= 16 do
  427.                    
  428.                     reach_y_velocity_time = reach_y_velocity_time + 1
  429.                     v_advance_hold_up(1)
  430.                     Y_Velocity = core.read_float_be(0x3FFE18,'RDRAM')
  431.                    
  432.                     if Y_Velocity == -2 then
  433.                         found_y_velocity = true
  434.                     end
  435.                    
  436.                 end
  437.                
  438.                 -- shield drop isg takes 34 visual frames (including the frame to input C Down for bombs)
  439.                 -- and setting down the bomb takes 12 visual frames
  440.                 -- including inputting C Down for bombs, advancing 74 visual frames brings you to the first input frame of the visual frame corresponding to the first explosion frame
  441.                 -- now load newly created save state and attempt bank clip
  442.                 -- reach_y_velocity_time + 12 brings us to -14 y velocity, which we want to be the first bomb explosion frame
  443.                 -- 74 - 34 = 40. 40 - 12 = 28. 28 - 12 = 16 (takes 12 frames to get from -2 to -14 Y Velocity). Wait time = 16 - reach_y_velocity_time
  444.                
  445.                 Wait_Time_1 = 16 - reach_y_velocity_time
  446.                
  447.                 itools.load_state(4)
  448.                
  449.                 set_down_bomb()
  450.                
  451.                 v_advance(Wait_Time_1)
  452.                
  453.                 -- hold up until you reach -11 Y Velocity (9 frames after reaching -2 Y Velocity)
  454.                 v_advance_hold_up(reach_y_velocity_time + 9)
  455.                 itools.clear_inputs()
  456.                
  457.                 v_advance_press_R(2)
  458.                 itools.clear_inputs()
  459.                
  460.                 v_advance(1)
  461.                
  462.                 -- now have -14 y velocity unless midframe change
  463.                
  464.                 Movement_Angle_1 = memory.read_s16_be(0x400884,'RDRAM')
  465.                
  466.                 i_advance(1)
  467.                
  468.                 Movement_Angle_2 = memory.read_s16_be(0x400884,'RDRAM')
  469.                
  470.                 if Movement_Angle_1 == Movement_Angle_2 then
  471.                    
  472.                     Midframe_Change_1 = false
  473.                    
  474.                 elseif Movement_Angle_1 ~= Movement_Angle_2 then
  475.                    
  476.                     Midframe_Change_1 = true
  477.                
  478.                 end
  479.                
  480.                 i_advance(2)
  481.                
  482.                 -- Check if link clips
  483.                
  484.                 for i = 1, N, 1 do
  485.                
  486.                     itools.vframe_advance()
  487.                    
  488.                     -- Check if link's Y Position is less than 60
  489.                     if(core.read_float_be(0x3FFDD8,'RDRAM') < 60) then
  490.                        
  491.                         Clip_Successful_1 = true
  492.                         Clip_Exists = true
  493.                         print('Clip111111111111111111111111111')
  494.                        
  495.                         break
  496.                                    
  497.                     end
  498.                    
  499.                 end
  500.                
  501.                 -- If clip is successful, check if JS can land
  502.                
  503.                 if Clip_Successful_1 == true then
  504.                    
  505.                     itools.load_state(4)
  506.                    
  507.                     set_down_bomb()
  508.                    
  509.                     v_advance(Wait_Time_1)
  510.                    
  511.                     -- hold up until you reach -11 Y Velocity (9 frames after reaching -2 Y Velocity)
  512.                     v_advance_hold_up(reach_y_velocity_time + 9)
  513.                     itools.clear_inputs()
  514.                    
  515.                     v_advance_press_R(2)
  516.                     itools.clear_inputs()
  517.                    
  518.                     v_advance(1)
  519.                    
  520.                     -- now have -14 y velocity unless midframe change
  521.  
  522.                     if Midframe_Change_1 == true then
  523.                        
  524.                         i_advance(2)
  525.                        
  526.                         itools.iframe_advance({['X Axis']=-128,['Y Axis']=0,['B']=true})
  527.        
  528.                         for j = 1, M, 1 do
  529.                        
  530.                             itools.vframe_advance()
  531.                            
  532.                             -- Check if link's Y Position is 133, which is the height of the bank
  533.                             if(core.read_float_be(0x3FFDD8,'RDRAM') == 133) then
  534.                                
  535.                                 Setup_Successful_1 = true
  536.                                 Setup_Exists = true
  537.                                 print('SUCCESS111111111111111')
  538.                                
  539.                                 break
  540.                                
  541.                             end
  542.                            
  543.                         end
  544.                        
  545.                     elseif Midframe_Change_1 == false then
  546.                        
  547.                         itools.vframe_advance({['X Axis']=-128,['Y Axis']=0,['B']=true})
  548.                        
  549.                         for j = 1, M, 1 do
  550.                        
  551.                             itools.vframe_advance()
  552.                            
  553.                             -- Check if link's Y Position is 133, which is the height of the bank
  554.                             if(core.read_float_be(0x3FFDD8,'RDRAM') == 133) then
  555.                                
  556.                                 Setup_Successful_1 = true
  557.                                 Setup_Exists = true
  558.                                 print('SUCCESS111111111111111')
  559.                                
  560.                                 break
  561.                                
  562.                             end
  563.                            
  564.                         end
  565.                            
  566.                     end
  567.                    
  568.                 end
  569.                
  570.             end
  571.            
  572.            
  573.             -----------------------------------------------------------------------------------------------
  574.            
  575.            
  576.             -- second set down the bomb with targeting and then walk forward with targeting
  577.            
  578.             -- goal: count how many frames it takes to hit -2 Y Velocity after setting down the bomb
  579.            
  580.             itools.load_state(4)
  581.            
  582.             set_down_bomb_target()
  583.            
  584.             Bomb_Y_Position = core.read_float_be(0x410628,'RDRAM')
  585.            
  586.             if Bomb_Y_Position < 133 then
  587.                 Valid_Bomb_Position_2 = true
  588.             end
  589.            
  590.            
  591.             if Valid_Bomb_Position_2 == true then
  592.                
  593.                 found_y_velocity = false
  594.                 reach_y_velocity_time = 0
  595.                 while found_y_velocity == false and reach_y_velocity_time <= 16 do
  596.                    
  597.                     reach_y_velocity_time = reach_y_velocity_time + 1
  598.                     v_advance_hold_up_and_target(1)
  599.                     Y_Velocity = core.read_float_be(0x3FFE18,'RDRAM')
  600.                    
  601.                     if Y_Velocity == -2 then
  602.                         found_y_velocity = true
  603.                     end
  604.                    
  605.                 end
  606.                
  607.                 -- shield drop isg takes 34 visual frames (including the frame to input C Down for bombs)
  608.                 -- and setting down the bomb takes 12 visual frames
  609.                 -- including inputting C Down for bombs, advancing 74 visual frames brings you to the first input frame of the visual frame corresponding to the first explosion frame
  610.                 -- now load newly created save state and attempt bank clip
  611.                 -- reach_y_velocity_time + 12 brings us to -14 y velocity, which we want to be the first bomb explosion frame
  612.                 -- 74 - 34 = 40. 40 - 12 = 28. 28 - 12 = 16 (takes 12 frames to get from -2 to -14 Y Velocity). Wait time = 16 - reach_y_velocity_time
  613.                
  614.                 Wait_Time_2 = 16 - reach_y_velocity_time
  615.                
  616.                 itools.load_state(4)
  617.                
  618.                 set_down_bomb_target()
  619.                
  620.                 v_advance_press_Z(Wait_Time_2)
  621.                
  622.                 -- hold up until you reach -11 Y Velocity (9 frames after reaching -2 Y Velocity)
  623.                 v_advance_hold_up_and_target(reach_y_velocity_time + 9)
  624.                 itools.clear_inputs()
  625.                
  626.                 v_advance_press_R(2)
  627.                 itools.clear_inputs()
  628.                
  629.                 v_advance(1)
  630.                
  631.                 -- now have -14 y velocity unless midframe change
  632.                
  633.                 Movement_Angle_1 = memory.read_s16_be(0x400884,'RDRAM')
  634.                
  635.                 i_advance(1)
  636.                
  637.                 Movement_Angle_2 = memory.read_s16_be(0x400884,'RDRAM')
  638.                
  639.                 if Movement_Angle_1 == Movement_Angle_2 then
  640.                    
  641.                     Midframe_Change_2 = false
  642.                    
  643.                 elseif Movement_Angle_1 ~= Movement_Angle_2 then
  644.                    
  645.                     Midframe_Change_2 = true
  646.                
  647.                 end
  648.                
  649.                 i_advance(2)
  650.                
  651.                 -- Check if link clips
  652.                
  653.                 for i = 1, N, 1 do
  654.                
  655.                 itools.vframe_advance()
  656.                    
  657.                     -- Check if link's Y Position is less than 60
  658.                     if(core.read_float_be(0x3FFDD8,'RDRAM') < 60) then
  659.                        
  660.                         Clip_Successful_2 = true
  661.                         Clip_Exists = true
  662.                         print('Clip222222222222222222222222222')
  663.                        
  664.                         break
  665.                                    
  666.                     end
  667.                    
  668.                 end
  669.                
  670.                 -- If clip is successful, check if JS can land
  671.                
  672.                 if Clip_Successful_2 == true then
  673.                    
  674.                     itools.load_state(4)
  675.                    
  676.                     set_down_bomb_target()
  677.                    
  678.                     v_advance_press_Z(Wait_Time_2)
  679.                    
  680.                     -- hold up until you reach -11 Y Velocity (9 frames after reaching -2 Y Velocity)
  681.                     v_advance_hold_up_and_target(reach_y_velocity_time + 9)
  682.                     itools.clear_inputs()
  683.                    
  684.                     v_advance_press_R(2)
  685.                     itools.clear_inputs()
  686.                    
  687.                     v_advance(1)
  688.                    
  689.                     -- now have -14 y velocity unless midframe change
  690.  
  691.                     if Midframe_Change_2 == true then
  692.                        
  693.                         i_advance(2)
  694.                        
  695.                         itools.iframe_advance({['X Axis']=-128,['Y Axis']=0,['B']=true})
  696.        
  697.                         for j = 1, M, 1 do
  698.                        
  699.                             itools.vframe_advance()
  700.                            
  701.                             -- Check if link's Y Position is 133, which is the height of the bank
  702.                             if(core.read_float_be(0x3FFDD8,'RDRAM') == 133) then
  703.                                
  704.                                 Setup_Successful_2 = true
  705.                                 Setup_Exists = true
  706.                                 print('SUCCESS222222222222222222222')
  707.                                
  708.                                 break
  709.                                
  710.                             end
  711.                            
  712.                         end
  713.                        
  714.                     elseif Midframe_Change_2 == false then
  715.                        
  716.                         itools.vframe_advance({['X Axis']=-128,['Y Axis']=0,['B']=true})
  717.                        
  718.                         for j = 1, M, 1 do
  719.                        
  720.                             itools.vframe_advance()
  721.                            
  722.                             -- Check if link's Y Position is 133, which is the height of the bank
  723.                             if(core.read_float_be(0x3FFDD8,'RDRAM') == 133) then
  724.                                
  725.                                 Setup_Successful_2 = true
  726.                                 Setup_Exists = true
  727.                                 print('SUCCESS222222222222222222222')
  728.                                
  729.                                 break
  730.                                
  731.                             end
  732.                            
  733.                         end
  734.                            
  735.                     end
  736.                    
  737.                 end
  738.                
  739.             end
  740.            
  741.             -------------------------------------------------------------------------------------------------
  742.            
  743.             -- third set down the bomb without targeting and then walk forward with targeting (start walking and targeting at the same time)
  744.            
  745.             -- goal: count how many frames it takes to hit -2 Y Velocity after setting down the bomb
  746.            
  747.             itools.load_state(4)
  748.            
  749.             set_down_bomb()
  750.            
  751.             Bomb_Y_Position = core.read_float_be(0x410628,'RDRAM')
  752.            
  753.             if Bomb_Y_Position < 133 then
  754.                 Valid_Bomb_Position_3 = true
  755.             end
  756.            
  757.            
  758.             if Valid_Bomb_Position_3 == true then
  759.                
  760.                 found_y_velocity = false
  761.                 reach_y_velocity_time = 0
  762.                 while found_y_velocity == false and reach_y_velocity_time <= 16 do
  763.                    
  764.                     reach_y_velocity_time = reach_y_velocity_time + 1
  765.                     v_advance_hold_up_and_target(1)
  766.                     Y_Velocity = core.read_float_be(0x3FFE18,'RDRAM')
  767.                    
  768.                     if Y_Velocity == -2 then
  769.                         found_y_velocity = true
  770.                     end
  771.                    
  772.                 end
  773.                
  774.                 -- shield drop isg takes 34 visual frames (including the frame to input C Down for bombs)
  775.                 -- and setting down the bomb takes 12 visual frames
  776.                 -- including inputting C Down for bombs, advancing 74 visual frames brings you to the first input frame of the visual frame corresponding to the first explosion frame
  777.                 -- now load newly created save state and attempt bank clip
  778.                 -- reach_y_velocity_time + 12 brings us to -14 y velocity, which we want to be the first bomb explosion frame
  779.                 -- 74 - 34 = 40. 40 - 12 = 28. 28 - 12 = 16 (takes 12 frames to get from -2 to -14 Y Velocity). Wait time = 16 - reach_y_velocity_time
  780.                
  781.                 Wait_Time_3 = 16 - reach_y_velocity_time
  782.                
  783.                 itools.load_state(4)
  784.                
  785.                 set_down_bomb()
  786.                
  787.                 v_advance(Wait_Time_3)
  788.                
  789.                 -- hold up until you reach -11 Y Velocity (9 frames after reaching -2 Y Velocity)
  790.                 v_advance_hold_up_and_target(reach_y_velocity_time + 9)
  791.                 itools.clear_inputs()
  792.                
  793.                 v_advance_press_R(2)
  794.                 itools.clear_inputs()
  795.                
  796.                 v_advance(1)
  797.                
  798.                 -- now have -14 y velocity unless midframe change
  799.                
  800.                 Movement_Angle_1 = memory.read_s16_be(0x400884,'RDRAM')
  801.                
  802.                 i_advance(1)
  803.                
  804.                 Movement_Angle_2 = memory.read_s16_be(0x400884,'RDRAM')
  805.                
  806.                 if Movement_Angle_1 == Movement_Angle_2 then
  807.                    
  808.                     Midframe_Change_3 = false
  809.                    
  810.                 elseif Movement_Angle_1 ~= Movement_Angle_2 then
  811.                    
  812.                     Midframe_Change_3 = true
  813.                
  814.                 end
  815.                
  816.                 i_advance(2)
  817.                
  818.                 -- Check if link clips
  819.                
  820.                 for i = 1, N, 1 do
  821.                
  822.                 itools.vframe_advance()
  823.                    
  824.                     -- Check if link's Y Position is less than 60
  825.                     if(core.read_float_be(0x3FFDD8,'RDRAM') < 60) then
  826.                        
  827.                         Clip_Successful_3 = true
  828.                         Clip_Exists = true
  829.                         print('Clip3333333333333333333333333333333333')
  830.                        
  831.                         break
  832.                                    
  833.                     end
  834.                    
  835.                 end
  836.                
  837.                 -- If clip is successful, check if JS can land
  838.                
  839.                 if Clip_Successful_3 == true then
  840.                    
  841.                     itools.load_state(4)
  842.                    
  843.                     set_down_bomb()
  844.                    
  845.                     v_advance(Wait_Time_3)
  846.                    
  847.                     -- hold up until you reach -11 Y Velocity (9 frames after reaching -2 Y Velocity)
  848.                     v_advance_hold_up_and_target(reach_y_velocity_time + 9)
  849.                     itools.clear_inputs()
  850.                    
  851.                     v_advance_press_R(2)
  852.                     itools.clear_inputs()
  853.                    
  854.                     v_advance(1)
  855.                    
  856.                     -- now have -14 y velocity unless midframe change
  857.  
  858.                     if Midframe_Change_3 == true then
  859.                        
  860.                         i_advance(2)
  861.                        
  862.                         itools.iframe_advance({['X Axis']=-128,['Y Axis']=0,['B']=true})
  863.        
  864.                         for j = 1, M, 1 do
  865.                        
  866.                             itools.vframe_advance()
  867.                            
  868.                             -- Check if link's Y Position is 133, which is the height of the bank
  869.                             if(core.read_float_be(0x3FFDD8,'RDRAM') == 133) then
  870.                                
  871.                                 Setup_Successful_3 = true
  872.                                 Setup_Exists = true
  873.                                 print('SUCCESS33333333333333333333333333333')
  874.                                
  875.                                 break
  876.                                
  877.                             end
  878.                            
  879.                         end
  880.                        
  881.                     elseif Midframe_Change_3 == false then
  882.                        
  883.                         itools.vframe_advance({['X Axis']=-128,['Y Axis']=0,['B']=true})
  884.                        
  885.                         for j = 1, M, 1 do
  886.                        
  887.                             itools.vframe_advance()
  888.                            
  889.                             -- Check if link's Y Position is 133, which is the height of the bank
  890.                             if(core.read_float_be(0x3FFDD8,'RDRAM') == 133) then
  891.                                
  892.                                 Setup_Successful_3 = true
  893.                                 Setup_Exists = true
  894.                                 print('SUCCESS33333333333333333333333333333')
  895.                                
  896.                                 break
  897.                                
  898.                             end
  899.                            
  900.                         end
  901.                            
  902.                     end
  903.                    
  904.                 end
  905.                
  906.             end
  907.            
  908.             -------------------------------------------------------------------------------------------------
  909.            
  910.         end
  911.     end
  912.     file_write:write('Permutation = ' .. line .. '\n')
  913.    
  914.     if Valid_Position == true then
  915.    
  916.         file_write:write('Valid Position?: Yes\n')
  917.    
  918.     elseif Valid_Position == false then
  919.        
  920.         file_write:write('Valid Position?: No\n')
  921.        
  922.     end
  923.    
  924.     if Valid_A_Action == true then
  925.    
  926.         file_write:write('Valid A Action?: Yes\n')
  927.    
  928.     elseif Valid_A_Action == false then
  929.        
  930.         file_write:write('Valid A Action?: No\n')
  931.        
  932.     end
  933.    
  934.     if Got_ISG == true then
  935.        
  936.         file_write:write('Got ISG?: Yes\n')
  937.    
  938.     elseif Got_ISG == false then
  939.        
  940.         file_write:write('Got ISG?: No\n')
  941.        
  942.     end
  943.    
  944.     if Valid_Bomb_Position_1 == true then
  945.        
  946.         file_write:write('Valid Bomb Position Untargeted?: Yes\n')
  947.    
  948.     elseif Valid_Bomb_Position_1 == false then
  949.        
  950.         file_write:write('Valid Bomb Position Untargeted?: No\n')
  951.        
  952.     end
  953.    
  954.     if Valid_Bomb_Position_2 == true then
  955.        
  956.         file_write:write('Valid Bomb Position Targeted?: Yes\n')
  957.    
  958.     elseif Valid_Bomb_Position_2 == false then
  959.        
  960.         file_write:write('Valid Bomb Position Targeted?: No\n')
  961.        
  962.     end
  963.    
  964.     if Valid_Bomb_Position_3 == true then
  965.        
  966.         file_write:write('Valid Bomb Position Target and Up Same Time?: Yes\n')
  967.    
  968.     elseif Valid_Bomb_Position_3 == false then
  969.        
  970.         file_write:write('Valid Bomb Position Target and Up Same Time?: No\n')
  971.        
  972.     end
  973.    
  974.     file_write:write('Wait Time (Visual Frames) Untargeted = ' .. Wait_Time_1 .. '\n')
  975.     file_write:write('Wait Time (Visual Frames) Targeted = ' .. Wait_Time_2 .. '\n')
  976.     file_write:write('Wait Time (Visual Frames) Target and Up Same Time = ' .. Wait_Time_3 .. '\n')
  977.    
  978.     if Midframe_Change_1 == true then
  979.        
  980.         file_write:write('Midframe Change Untargeted?: Yes\n')
  981.        
  982.     elseif Midframe_Change_1 == false then
  983.        
  984.         file_write:write('Midframe Change Untargeted?: No\n')
  985.        
  986.     end
  987.    
  988.     if Midframe_Change_2 == true then
  989.        
  990.         file_write:write('Midframe Change Targeted?: Yes\n')
  991.        
  992.     elseif Midframe_Change_2 == false then
  993.        
  994.         file_write:write('Midframe Change Targeted?: No\n')
  995.        
  996.     end
  997.    
  998.     if Midframe_Change_3 == true then
  999.        
  1000.         file_write:write('Midframe Change Target and Up Same Time?: Yes\n')
  1001.        
  1002.     elseif Midframe_Change_3 == false then
  1003.        
  1004.         file_write:write('Midframe Change Target and Up Same Time?: No\n')
  1005.        
  1006.     end
  1007.    
  1008.     if Clip_Successful_1 == true then
  1009.        
  1010.         file_write:write('Clip Successful Untargeted?: Yes\n')
  1011.    
  1012.     elseif Clip_Successful_1 == false then
  1013.        
  1014.         file_write:write('Clip Successful Untargeted?: No\n')
  1015.    
  1016.     end
  1017.    
  1018.     if Clip_Successful_2 == true then
  1019.        
  1020.         file_write:write('Clip Successful Targeted?: Yes\n')
  1021.    
  1022.     elseif Clip_Successful_2 == false then
  1023.        
  1024.         file_write:write('Clip Successful Targeted?: No\n')
  1025.    
  1026.     end
  1027.    
  1028.     if Clip_Successful_3 == true then
  1029.        
  1030.         file_write:write('Clip Successful Target and Up Same Time?: Yes\n')
  1031.    
  1032.     elseif Clip_Successful_3 == false then
  1033.        
  1034.         file_write:write('Clip Successful Target and Up Same Time?: No\n')
  1035.    
  1036.     end
  1037.    
  1038.     if Setup_Successful_1 == true then
  1039.        
  1040.         file_write:write('Jumpslash Successful Untargeted?: Yes\n')
  1041.    
  1042.     elseif Setup_Successful_1 == false then
  1043.        
  1044.         file_write:write('Jumpslash Successful Untargeted?: No\n')
  1045.    
  1046.     end
  1047.    
  1048.     if Setup_Successful_2 == true then
  1049.        
  1050.         file_write:write('Jumpslash Successful Targeted?: Yes\n')
  1051.    
  1052.     elseif Setup_Successful_2 == false then
  1053.        
  1054.         file_write:write('Jumpslash Successful Targeted?: No\n')
  1055.    
  1056.     end
  1057.    
  1058.     if Setup_Successful_3 == true then
  1059.        
  1060.         file_write:write('Jumpslash Successful Target and Up Same Time?: Yes\n')
  1061.    
  1062.     elseif Setup_Successful_3 == false then
  1063.        
  1064.         file_write:write('Jumpslash Successful Target and Up Same Time?: No\n')
  1065.    
  1066.     end
  1067.    
  1068.     file_write:write('---\n')
  1069.    
  1070.     Line_Count = Line_Count + 1
  1071.     -- END
  1072.  
  1073.     ikeeta = ikeeta + 1
  1074. end
  1075.  
  1076. file_write:close()
  1077. print('done')
Add Comment
Please, Sign In to add comment