Advertisement
blcd

isaac-afterbirthplus-j99.asl

Jul 5th, 2017
95
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 4.00 KB | None | 0 0
  1. // AutoSplitter for The Binding of Isaac: Afterbirth+
  2. // Code by Hyphen-ated
  3. // Checkpoint code & pointer annotations by blcd/Zamiel
  4.  
  5. state("isaac-ng", "1.06.J99")
  6. {
  7. // 0x004F8000 - GlobalsPtr
  8. int wins: 0x004F8000, 0x760;
  9. int character: 0x004F8000, 0x7a38;
  10. int winstreak: 0x004F8000, 0x1f0;
  11.  
  12. // 0x004F7FF4 - GamePtr (which is the same thing as the Lua "game" pointer)
  13. int timer: 0x004F7FF4, 0x00213b0c;
  14. int floor: 0x004F7FF4, 0x0;
  15. int curse: 0x004F7FF4, 0xC;
  16.  
  17. // Checkpoint is a custom item planted at the end of a run in the Racing+ mod
  18. int cpCount: 0x004F7FF4, 0x9b64, 0x0, 0x2764, 0x874; // "Checkpoint" (ID 541) count
  19.  
  20. // Off Limits is a custom item used by the Racing+ mod to signal the AutoSplitter that the mod is sending the player back to the first character
  21. int olCount: 0x004F7FF4, 0x9b64, 0x0, 0x2764, 0x86C; // "Off Limits" (ID 539) count
  22.  
  23. //Equivalent Lua: Game():GetPlayer(0):GetCollectibleNum(541)
  24. // 0x9b64 - PlayerVectorPtr
  25. // 0x0 - Player1
  26. // 0x2764 - Player1 CollectibleNum Vector Ptr
  27. // 0x864 - Item 541 count
  28. // 0x86C - Item 538 count
  29. }
  30.  
  31. startup
  32. {
  33. settings.Add("character_run", true, "Multi-character run");
  34. settings.SetToolTip("character_run", "Disables auto-resetting when you're past the first split.");
  35. settings.Add("racing_plus_custom_challenge", false, "You're using the Racing+ custom challenge for multi-character runs", "character_run");
  36. settings.Add("floor_splits", false, "Split on floors");
  37. settings.Add("grouped_floors", false, "Combine basement, caves, depths, and womb into one split each", "floor_splits");
  38. settings.Add("blck_cndl", false, "You're using blck_cndl mode", "floor_splits");
  39.  
  40. }
  41.  
  42. init
  43. {
  44. vars.timer_during_floor_change = 0;
  45. }
  46.  
  47. update
  48. {
  49. //print("wins: " + current.wins + ", floor: " + current.floor + ", character: " + current.character + ", timer: " + current.timer + ", curse: " + current.curse);
  50. //print("checkpointCount: " + current.checkpointCount);
  51. }
  52.  
  53. start
  54. {
  55. if (old.timer == 0 && current.timer != 0)
  56. {
  57. vars.timer_during_floor_change = 0;
  58. return true;
  59. }
  60. }
  61.  
  62. reset
  63. {
  64. //old.timer is 0 immediately during a reset, and also when you're on the main menu
  65. //this "current.timer < 10" is to stop a reset from happening when you s+q.
  66. // (unless you s+q during the first 1/3 second of the run, but why would you)
  67. if (old.timer == 0 && current.timer != 0 && current.timer < 10
  68. && (!settings["character_run"] || timer.CurrentSplitIndex == 0))
  69. {
  70. vars.timer_during_floor_change = 0;
  71. return true;
  72. }
  73.  
  74. if (settings["racing_plus_custom_challenge"] && current.olCount == 1 && old.olCount != 1)
  75. {
  76. return true;
  77. }
  78. }
  79.  
  80. split
  81. {
  82. if (current.wins == old.wins + 1)
  83. return true;
  84.  
  85. if (settings["racing_plus_custom_challenge"] && current.cpCount == 1 && old.cpCount != 1)
  86. return true;
  87.  
  88. if (settings["floor_splits"])
  89. {
  90. if (current.floor > old.floor && current.floor > 1 && old.floor > 0
  91. && (!settings["grouped_floors"] || (current.floor != 2 && current.floor != 4 && current.floor != 6 && current.floor != 8))) {
  92. //when using floor splits, if they just got into an xl floor, we are going to doublesplit
  93. vars.timer_during_floor_change = current.timer;
  94. return true;
  95. }
  96.  
  97. if (vars.timer_during_floor_change != -1
  98. && current.timer > vars.timer_during_floor_change)
  99. {
  100. vars.timer_during_floor_change = -1;
  101. //if they're in blck_cndl mode, there is no xl even if the xl curse looks like it's on
  102. //similarly, with grouped floors, there's no split to skip
  103. if(current.curse == 2 && !settings["blck_cndl"] && !settings["grouped_floors"]) {
  104. var model = new TimerModel { CurrentState = timer };
  105. model.SkipSplit();
  106. }
  107. }
  108. }
  109. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement