Advertisement
Guest User

autogreen script by @tetris

a guest
Nov 1st, 2024
2,515
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 12.21 KB | None | 0 0
  1. /*
  2. Made by @tetris
  3.  
  4. I've developed this script with the assistance of ChatGPT and Gemini. I made the idea, and they provided valuable coding support.
  5.  
  6. This script automates rhythm shooting in NBA 2K25 by remapping the right stick to the SQUARE/X button. While it doesn't guarantee green shots, it can help you execute rhythm shots more efficiently.
  7.  
  8. How it works: When you press and hold SQUARE/X, the script automatically flicks the right stick downwards. Releasing SQUARE/X flicks it upwards. Timing is crucial for success.
  9.  
  10. Timing tips:
  11. * Adjust your visual cue settings to "release."
  12. * In-game, shoot as if using "setpoint" for a perfect timing.
  13. * Experiment with the script's "28" line values to find the optimal tempo for your build and jumpshot. Decrease the value for slower tempos and increase it for faster ones.
  14. * Test the script in various scenarios like quickstops, off-the-dribble, catch-and-shoot, and pump fakes.
  15.  
  16. Additional notes:
  17. * Use L1/LB to press SQUARE/X for steals or normal shots.
  18.  
  19. SCRIPT CONTROLS:
  20. RHYTHM is activated by Holding LT/L2 and Pressing the MENU button
  21. UP OR DOWN ON D-PAD TO TURN RHYTHM ON OR OFF
  22. WHILE IN RHYTHM PRESS A BUTTON TO FOR WAIT TIME MENU
  23. LT and UP or DOWN D-PAD for +-1
  24. LT and LEFT OR RIGHT D-PAD for +-10
  25. Back out of the menu with the B button.
  26. MAKE SURE RHYTHM is ENABLED
  27. */
  28.  
  29.  
  30.  
  31.  
  32.  
  33. //██████████████████████████████████████████████████████████████████
  34. int square_button;
  35. int wait_time = 30;
  36. //██████████████████████████████████████████████████████████████████
  37.  
  38. const string Misc[] = { "On" , "Off" , "2K25" , "Made By" , "TETRIS" , "KillSwitch" , "Enabled" , "Disabled" , "" };
  39. const string ModNames[] = { "Rhythm","" };
  40. const string ValNames[] = { "wait_time","" };
  41. define AmountOfMods = 1
  42. define AmountOfValues = 3;
  43. int DisplayTitle = TRUE;
  44. int ScreenSaver, BlankScreen, ModMenu, DisplayMenu, EditMenu, Toggle, ValNameIdx, ModNameIdx, KillSwitch, Rhythm;
  45.  
  46.  
  47.  
  48. //////////////////////////////////////////////////////
  49. // MAIN BLOCK
  50. //
  51. /////////////////////////////////////////////////////
  52.  
  53. main{
  54. set_val(TRACE_1,wait_time);
  55.  
  56. if(get_ival(PS4_L2)) {
  57. if(event_press(PS4_OPTIONS)) {
  58. ModMenu = TRUE;
  59. DisplayMenu = TRUE;
  60. EditMenu = FALSE;
  61. if(!ModMenu) DisplayTitle = TRUE;}
  62. if(event_press(PS4_PS)){
  63. KillSwitch =! KillSwitch;
  64. combo_run(KillSwitch)}
  65. set_val(PS4_OPTIONS,0);
  66. set_val(PS4_PS,0);}
  67.  
  68. if(!DisplayTitle) {
  69. if(ModMenu) {
  70. ModNameIdx = MenuNavigation(ModNameIdx,0,0);
  71. Rhythm = ToggleSwitch(ModNameIdx == 0,Rhythm);
  72. }
  73. if(EditMenu) {
  74. ValNameIdx = MenuNavigation(ValNameIdx,0,0);
  75. wait_time = EditValues(ValNameIdx , 0, wait_time , 1, 2000);
  76. if(ModNameIdx == 0) ValNameIdx = cycle(ValNameIdx,0,0); } }
  77. if(DisplayMenu){
  78. cls_oled(OLED_BLACK);
  79. rect_oled(0, 0, OLED_WIDTH, OLED_HEIGHT, OLED_BLACK, OLED_WHITE);
  80. line_oled(0, 27, OLED_WIDTH - 1, 27, 1, OLED_WHITE);
  81. if(EditMenu) {
  82. print(center_x(get_valName_chars(ValNameIdx), OLED_FONT_MEDIUM_WIDTH),7,OLED_FONT_MEDIUM,OLED_WHITE,ValNames[ValNameIdx]); }
  83. else if(ModMenu) {
  84. print(center_x(get_modName_chars(ModNameIdx), OLED_FONT_MEDIUM_WIDTH),7,OLED_FONT_MEDIUM,OLED_WHITE,ModNames[ModNameIdx]);
  85. if(Toggle == 1)
  86. print(center_x(get_misc_chars(0), OLED_FONT_MEDIUM_WIDTH),37,OLED_FONT_MEDIUM,OLED_WHITE,Misc[0]);
  87. else if(Toggle == 0)
  88. print(center_x(get_misc_chars(1), OLED_FONT_MEDIUM_WIDTH),37,OLED_FONT_MEDIUM,OLED_WHITE,Misc[1]); }
  89. DisplayMenu = FALSE; }
  90. if(!ModMenu && !EditMenu) {
  91. if(DisplayTitle) {
  92. cls_oled(OLED_BLACK);
  93. rect_oled(0, 0, OLED_WIDTH, OLED_HEIGHT, OLED_BLACK, OLED_WHITE);
  94. print(center_x(get_misc_chars(2), OLED_FONT_SMALL_WIDTH),7,OLED_FONT_SMALL,OLED_WHITE,Misc[2]);
  95. print(center_x(get_misc_chars(3), OLED_FONT_SMALL_WIDTH),22,OLED_FONT_SMALL,OLED_WHITE,Misc[3]);
  96. print(center_x(get_misc_chars(4), OLED_FONT_SMALL_WIDTH),37,OLED_FONT_SMALL,OLED_WHITE,Misc[4]);
  97. print(center_x(get_misc_chars(5), OLED_FONT_SMALL_WIDTH),50,OLED_FONT_SMALL,OLED_WHITE,Misc[5]);
  98. DisplayTitle = FALSE;
  99. ScreenSaver = TRUE; }
  100. if(ScreenSaver) {
  101. BlankScreen += get_rtime();
  102. if(BlankScreen >= 5000) {
  103. cls_oled(OLED_BLACK);
  104. BlankScreen = 0;
  105. ScreenSaver = TRUE; } } }
  106. if(!KillSwitch){
  107. if(!Rhythm){colourled(0)}
  108. if(Rhythm){
  109. if (get_val(PS4_SQUARE)) {
  110. if (!square_button) {
  111. square_button = 1;
  112. }
  113.  
  114. set_val(PS4_RY, 100);
  115. set_val(PS4_SQUARE, 0);
  116. set_val(PS4_R2, 0);
  117. } else {
  118. if (square_button) {
  119. square_button = 0;
  120. set_val(PS4_RY, 0);
  121. combo_run(rs_up_combo);
  122. }
  123. set_val(PS4_SQUARE, 0);
  124. }
  125.  
  126.  
  127. if (get_val(PS4_L1)) {
  128. // Block L1 output
  129. set_val(PS4_L1, 0);
  130. // Activate SQUARE output
  131. set_val(PS4_SQUARE, 100);
  132. }
  133.  
  134.  
  135. if (!square_button) {
  136. set_val(PS4_RY, get_val(PS4_RY));
  137. }
  138. }
  139. if (Rhythm) { colourled(1) }
  140. }
  141. }
  142.  
  143.  
  144. /////////////////////////////////////////////////////////////////////////////
  145. /// COMBO BLOCK
  146. /////////////////////////////////////////////////////////////////////////////
  147.  
  148.  
  149. // Combo for RS Up with delay and display
  150. combo rs_up_combo {
  151. if (!DisplayMenu && !ModMenu && !EditMenu) {
  152. show_value_OLED (0, wait_time)
  153.  
  154. }
  155. wait(wait_time); // Use the adjustable wait_time here
  156. set_val(PS4_RY, -100); // Move RS Up
  157. wait(110); // Wait to ensure the game registers RS Up
  158. set_val(PS4_RY, 0); // Reset Right Stick to neutral after RS Up
  159. }
  160.  
  161. combo save {
  162. save_edit();
  163. }
  164.  
  165. /////////////////////////////////////////////////////////////////////////////
  166. /// FUNCTIONS
  167. /////////////////////////////////////////////////////////////////////////////
  168. function show_value_OLED (idPoswait_time, valuewait_time) {
  169. cls_oled(OLED_BLACK);
  170. rect_oled(0, 0, OLED_WIDTH, OLED_HEIGHT, OLED_BLACK, OLED_WHITE);
  171. line_oled(0, 27, OLED_WIDTH - 1, 27, 1, OLED_WHITE);
  172. print(center_x(get_valName_chars(idPoswait_time), OLED_FONT_MEDIUM_WIDTH),7,OLED_FONT_MEDIUM,OLED_WHITE,ValNames[idPoswait_time]);
  173.  
  174. number_to_string(valuewait_time,find_digits(valuewait_time))
  175. }
  176. function save_edit() {
  177. set_pvar(SPVAR_1, wait_time);
  178. }
  179.  
  180. function MenuNavigation(f_modorval, f_min, f_max) {
  181. if(get_val(PS4_L2) <= 50) {
  182. if(event_press(PS4_RIGHT)) {
  183. f_modorval = cycle(f_modorval + 1, f_min, f_max);
  184. DisplayMenu = TRUE;
  185. }
  186.  
  187. if(event_press(PS4_LEFT)) {
  188. f_modorval = cycle(f_modorval - 1, f_min, f_max);
  189. DisplayMenu = TRUE;
  190. }
  191.  
  192. set_val(PS4_RIGHT, 0);
  193. set_val(PS4_LEFT, 0);
  194. }
  195.  
  196. if(f_modorval == 0) {
  197. if(event_press(PS4_CROSS)) {
  198. ValNameIdx = AmountOfValues + 1;
  199. EditMenu = TRUE;
  200. ModMenu = FALSE;
  201. DisplayMenu = TRUE;
  202. }
  203.  
  204. set_val(PS4_CROSS, 0);
  205. }
  206.  
  207. if(ModMenu) {
  208. if(event_press(PS4_CIRCLE)) {
  209. DisplayTitle = TRUE;
  210. ModMenu = FALSE;
  211. DisplayMenu = FALSE;
  212. }
  213.  
  214. set_val(PS4_CIRCLE, 0);
  215. }
  216.  
  217. if(EditMenu) {
  218. if(event_press(PS4_CIRCLE)) {
  219. EditMenu = FALSE;
  220. ModMenu = TRUE;
  221. DisplayMenu = TRUE;
  222. }
  223.  
  224. set_val(PS4_CIRCLE, 0);
  225. }
  226.  
  227. return f_modorval;
  228. }
  229.  
  230. function ToggleSwitch(f_name, f_val) {
  231. if(f_name) {
  232. if(event_press(PS4_UP) || event_press(PS4_DOWN)) {
  233. f_val = !f_val;
  234. DisplayMenu = TRUE;
  235. }
  236.  
  237. Toggle = f_val;
  238. set_val(PS4_UP, 0);
  239. set_val(PS4_DOWN, 0);
  240. }
  241.  
  242. return f_val;
  243. }
  244.  
  245. function EditValues(f_idx, f_num, ValueIndex, ValueIndexMin, ValueIndexMax) {
  246. if(f_num == f_idx) {
  247. if(get_val(PS4_L2) >= 75) {
  248. if(event_press(PS4_UP)) {
  249. ValueIndex = cycle(ValueIndex + 1, ValueIndexMin, ValueIndexMax);
  250. DisplayMenu = TRUE;
  251. combo_run(save);
  252. }
  253.  
  254. if(event_press(PS4_DOWN)) {
  255. ValueIndex = cycle(ValueIndex - 1, ValueIndexMin, ValueIndexMax);
  256. DisplayMenu = TRUE;
  257. combo_run(save);
  258. }
  259.  
  260. set_val(PS4_UP, 0);
  261. set_val(PS4_DOWN, 0);
  262. }
  263.  
  264. if(get_ival(PS4_L2) >= 75) {
  265. if(event_press(PS4_RIGHT)) {
  266. ValueIndex = cycle(ValueIndex + 10, ValueIndexMin, ValueIndexMax);
  267. DisplayMenu = TRUE;
  268. combo_run(save);
  269. }
  270.  
  271. if(event_press(PS4_LEFT)) {
  272. ValueIndex = cycle(ValueIndex - 10, ValueIndexMin, ValueIndexMax);
  273. DisplayMenu = TRUE;
  274. combo_run(save);
  275. }
  276.  
  277. set_val(PS4_RIGHT, 0);
  278. set_val(PS4_LEFT, 0);
  279. }
  280.  
  281. number_to_string(ValueIndex, find_digits(ValueIndex));
  282. }
  283.  
  284. return ValueIndex;
  285. }
  286.  
  287. combo KillSwitch {
  288. cls_oled(OLED_BLACK);
  289.  
  290. if(KillSwitch) {
  291. print(center_x(get_misc_chars(6), OLED_FONT_SMALL_WIDTH), 15, OLED_FONT_SMALL, OLED_WHITE, Misc[6]);
  292. print(center_x(get_misc_chars(7), OLED_FONT_SMALL_WIDTH), 30, OLED_FONT_SMALL, OLED_WHITE, Misc[7]);
  293. }
  294.  
  295. if(!KillSwitch) {
  296. print(center_x(get_misc_chars(6), OLED_FONT_SMALL_WIDTH), 15, OLED_FONT_SMALL, OLED_WHITE, Misc[6]);
  297. print(center_x(get_misc_chars(8), OLED_FONT_SMALL_WIDTH), 30, OLED_FONT_SMALL, OLED_WHITE, Misc[8]);
  298. }
  299.  
  300. wait(1500);
  301. DisplayTitle = TRUE;
  302. }
  303.  
  304. function cycle(f_val, f_lo, f_hi) {
  305. if(f_val > f_hi) return f_lo;
  306. if(f_val < f_lo) return f_hi;
  307. return f_val;
  308. }
  309.  
  310. function get_misc_chars(f_idx) {
  311. if(Misc[f_idx + 1] != -1)
  312. return Misc[f_idx + 1] - Misc[f_idx] - 1;
  313. return sizeof(Misc) - Misc[f_idx];
  314. }
  315.  
  316. function get_modName_chars(f_idx) {
  317. if(ModNames[f_idx + 1] != -1)
  318. return ModNames[f_idx + 1] - ModNames[f_idx] - 1;
  319. return sizeof(ModNames) - ModNames[f_idx];
  320. }
  321.  
  322. function get_valName_chars(f_idx) {
  323. if(ValNames[f_idx + 1] != -1)
  324. return ValNames[f_idx + 1] - ValNames[f_idx] - 1;
  325. return sizeof(ValNames) - ValNames[f_idx];
  326. }
  327.  
  328. function center_x(f_chars, f_font) {
  329. return (OLED_WIDTH / 2) - ((f_chars * f_font) / 2);
  330. }
  331.  
  332. function number_to_string(value, f_digits) {
  333. i = 1;
  334. c_val = 10000;
  335.  
  336. if(value < 0) {
  337. putc_oled(i, 45);
  338. i += 1;
  339. value = abs(value);
  340. }
  341.  
  342. for(c = 5; c >= 1; c--) {
  343. if(f_digits >= c) {
  344. putc_oled(i, ASCII_NUM[value / c_val]);
  345. value = value % c_val;
  346. i += 1;
  347.  
  348. if(c == 4) {
  349. putc_oled(i, 44);
  350. i += 1;
  351. }
  352. }
  353.  
  354. c_val /= 10;
  355. }
  356.  
  357. puts_oled(center_x(i - 1, OLED_FONT_LARGE_WIDTH), 37, OLED_FONT_LARGE, i - 1, OLED_WHITE);
  358. }
  359.  
  360. function find_digits(f_num) {
  361. f_num = abs(f_num);
  362.  
  363. if(f_num / 10000 > 0) return 5;
  364. if(f_num / 1000 > 0) return 4;
  365. if(f_num / 100 > 0) return 3;
  366. if(f_num / 10 > 0) return 2;
  367.  
  368. return 1;
  369. }
  370.  
  371. const uint8 ASCII_NUM[] = {48, 49, 50, 51, 52, 53, 54, 55, 56, 57};
  372. int i;
  373. int c,c_val;
  374.  
  375. define ColorOFF = 0;
  376. define Blue = 1;
  377. define Red = 2;
  378. define Green = 3;
  379. define Pink = 4;
  380. define SkyBlue = 5;
  381. define Yellow = 6;
  382. define White = 7;
  383. data(
  384. 0,0,0, //0. ColorOFF
  385. 2,0,0, //1. Blue
  386. 0,2,0, //2. Red
  387. 0,0,2, //3. Green
  388. 2,2,0, //4. Pink
  389. 2,0,2, //5. SkyBlue
  390. 0,2,2, //6. Yellow
  391. 2,2,2 //7. White
  392. );
  393.  
  394. int data_indx;
  395. function colourled(color) {
  396. for( data_indx = 0; data_indx < 3; data_indx++ ) {
  397. set_led(data_indx,duint8 ((color * 3) + data_indx));
  398. }
  399. } //END
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement