Advertisement
Kaztalek

Rate of Time Manipulation Script

Mar 14th, 2015
397
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 1.17 KB | None | 0 0
  1. --"time.lua"
  2. --For use in MM (U) on BizHawk 1.9.1
  3. --Z to go back in time
  4. --X to go forward in time
  5. --C to toggle between normal rate of time and inverted rate of time
  6. --Keep in mind that time is separate from day, trying to go back a day will instead take you forward one.
  7. --
  8. --Addresses:
  9. --0x1EF684 determines if ISoT has been played
  10. --0x1EF686 is Rate of Time
  11.  
  12. local rate = 1
  13. local accel = 1.1
  14. local cap = 300
  15. local pastDir = 0
  16. local default = memory.read_u16_be(0x1EF686)+1
  17. local held = false
  18. function ChooseRate(dir)
  19.     if dir ~= pastDir then
  20.         rate = 1
  21.         pastDir = dir
  22.     elseif rate < cap then
  23.         rate = accel*rate
  24.         if rate > cap then
  25.             rate = cap
  26.         end
  27.     end
  28. end
  29.  
  30. memory.write_u16_be(0x1EF684,65535) --ensures clock will be correct color
  31. while true do
  32.     if input.get().C == true then
  33.         if not held then
  34.             held = true
  35.             default = default*-1
  36.         end
  37.     elseif held then
  38.         held = false
  39.     end
  40.     if input.get().Z == true then
  41.         ChooseRate(0)
  42.         memory.write_u16_be(0x1EF686,-2-rate)
  43.     elseif input.get().X == true then
  44.         ChooseRate(1)
  45.         memory.write_u16_be(0x1EF686,rate)
  46.     else
  47.         rate = 1
  48.         memory.write_u16_be(0x1EF686,default-1)
  49.     end
  50.     emu.frameadvance()
  51. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement