imbuedl

bank clip eng 2 slash lua

Dec 19th, 2018
58
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 4.14 KB | None | 0 0
  1. itools = dofile('lib_input_tools.lua')
  2. core = dofile('lib_core.lua')
  3.  
  4. N = 25 -- number of input frames to advance before assuming link does not clip out of bounds
  5. M = 30 -- number of input frames to advance before assuming link does not land out of bounds
  6.  
  7. file = io.open("bank_clip_angle_test_eng_2_slash.txt", "w+")
  8. --file = io.open("test_text.txt", "w+")
  9.  
  10. for x = -32768, 32767, 1 do
  11.  
  12. print("current iteration" .. x .. " ")
  13.  
  14. -- load save state (1)
  15. itools.load_state(1)
  16.  
  17. -- set Angle and Movement Angle equal to x
  18. memory.write_s16_be(0x3FFE6E,x,'RDRAM')
  19. memory.write_s16_be(0x400884,x,'RDRAM')
  20.  
  21. itools.clear_inputs()
  22.  
  23. -- start at input frame 44
  24.  
  25. itools.iframe_advance({['R']=true})
  26.  
  27. -- now at frame 45
  28.  
  29. itools.iframe_advance({['R']=true})
  30.  
  31. -- now at frame 46
  32.  
  33. itools.iframe_advance({['R']=true})
  34.  
  35. -- now at frame 47; clear inputs, then advance frames without any inputs
  36.  
  37. itools.clear_inputs()
  38. itools.iframe_advance()
  39.  
  40. -- now at frame 48
  41.  
  42. itools.iframe_advance()
  43.  
  44. -- now at frame 49
  45.  
  46. itools.iframe_advance()
  47.  
  48. -- now at frame 50
  49.  
  50. itools.iframe_advance()
  51.  
  52. -- now at frame 51
  53.  
  54. --- Record the values of relevant watches on input frame 51
  55.  
  56. De_Facto_Linear_Velocity = core.read_float_be(0x3FFE20,'RDRAM')
  57. Linear_Velocity = core.read_float_be(0x400880,'RDRAM')
  58. X_Velocity = core.read_float_be(0x3FFE14,'RDRAM')
  59. Z_Velocity = core.read_float_be(0x3FFE1C,'RDRAM')
  60. Y_Velocity = core.read_float_be(0x3FFE18,'RDRAM')
  61. Movement_Angle = memory.read_s16_be(0x400884,'RDRAM')
  62. X_Position = core.read_float_be(0x3FFDD4,'RDRAM')
  63. Z_Position = core.read_float_be(0x3FFDDC,'RDRAM')
  64. Y_Position = core.read_float_be(0x3FFDD8,'RDRAM')
  65. Angle = memory.read_s16_be(0x3FFE6E,'RDRAM')
  66.  
  67. file:write("Input = " .. x .. "\n")
  68. file:write("De Facto Linear Velocity: " .. De_Facto_Linear_Velocity .. "\n")
  69. file:write("Linear Velocity: " .. Linear_Velocity .. "\n")
  70. file:write("X Velocity: " .. X_Velocity .. "\n")
  71. file:write("Z Velocity: " .. Z_Velocity .. "\n")
  72. file:write("Y Velocity: " .. Y_Velocity .. "\n")
  73. file:write("Movement Angle: " .. Movement_Angle .. "\n")
  74. file:write("X Position: " .. X_Position .. "\n")
  75. file:write("Z Position: " .. Z_Position .. "\n")
  76. file:write("Y Position: " .. Y_Position .. "\n")
  77. file:write("Angle: " .. Angle .. "\n")
  78.  
  79.  
  80. Clips = false
  81. Lands = false
  82.  
  83. for i = 1, N, 1 do
  84.  
  85. itools.iframe_advance()
  86.  
  87. -- Check if link's Y Position is less than 60
  88. if(core.read_float_be(0x3FFDD8,'RDRAM') < 60) then
  89.  
  90. Clips = true
  91. file:write("Clips?: Yes \n")
  92.  
  93. break
  94.  
  95. end
  96.  
  97. if(i == N and Clips == false) then
  98.  
  99. file:write("Clips?: No \n")
  100. file:write("Lands?: No \n")
  101. file:write("--- \n")
  102.  
  103. end
  104.  
  105. end
  106.  
  107. -- Test if a jumpslash allows you to land on the banker
  108. if(Clips == true) then
  109.  
  110. itools.load_state(1)
  111.  
  112. -- set Angle and Movement Angle equal to x
  113. memory.write_s16_be(0x3FFE6E,x,'RDRAM')
  114. memory.write_s16_be(0x400884,x,'RDRAM')
  115.  
  116. itools.clear_inputs()
  117.  
  118. -- start at input frame 44
  119.  
  120. itools.iframe_advance({['R']=true})
  121.  
  122. -- now at frame 45
  123.  
  124. itools.iframe_advance({['R']=true})
  125.  
  126. -- now at frame 46
  127.  
  128. itools.iframe_advance({['R']=true})
  129.  
  130. -- now at frame 47; clear inputs, then advance frames without any inputs
  131.  
  132. itools.clear_inputs()
  133. itools.iframe_advance()
  134.  
  135. -- now at frame 48
  136.  
  137. itools.iframe_advance()
  138.  
  139. -- now at frame 49
  140.  
  141. itools.iframe_advance()
  142.  
  143. -- now at frame 50
  144.  
  145. itools.iframe_advance()
  146.  
  147. -- now at frame 51
  148.  
  149. itools.iframe_advance()
  150.  
  151. -- now at frame 52
  152.  
  153. itools.iframe_advance({['X Axis']=-128,['Y Axis']=0,['B']=true})
  154.  
  155. for j = 1, M, 1 do
  156.  
  157. itools.iframe_advance()
  158.  
  159. -- Check if link's Y Position is 133, which is the height of the bank
  160. if(core.read_float_be(0x3FFDD8,'RDRAM') == 133) then
  161.  
  162. Lands = true
  163. file:write("Lands?: Yes \n")
  164. file:write("--- \n")
  165.  
  166. break
  167.  
  168. end
  169.  
  170. if(j == M and Lands == false) then
  171.  
  172. file:write("Lands?: No \n")
  173. file:write("--- \n")
  174.  
  175.  
  176. end
  177.  
  178. end
  179.  
  180. end
  181.  
  182. end
  183.  
  184. file:close()
Add Comment
Please, Sign In to add comment