Advertisement
redslash

CTautotext

May 30th, 2016
139
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 1.29 KB | None | 0 0
  1. local BIZ = false           -- set to false for Snes9x
  2. local confirm_button = 4    -- see below (X=3,A=4)
  3.  
  4.  
  5. local button =  {'R','L','X','A','right','left','down','up','start','select','Y','B'}
  6. if BIZ then
  7.     button = {'P1 R','P1 L','P1 X','P1 A','P1 Right','P1 Left','P1 Down','P1 Up','P1 Start','P1 Select','P1 Y','P1 B'}
  8. end
  9. function ReadByte(i)
  10.     if BIZ then return mainmemory.read_u8(i)
  11.     else return memory.readbyte(0x7e0000 + i) end
  12. end
  13. function Pause()
  14.     if BIZ then return client.pause()
  15.     else return emu.pause() end
  16. end
  17.  
  18. local autoText = {[button[confirm_button]]=true}
  19. local gametime = ReadByte(0x0400)
  20.  
  21. local tapheld = false
  22. local tapframe = 0
  23. local tapcount = 0
  24. while true do
  25.     emu.frameadvance()
  26.     userin = joypad.get()
  27.     if tapcount % 2 == 1 then
  28.         if tapframe < 30 then
  29.             tapframe = tapframe + 1
  30.         else
  31.             tapframe = 0
  32.             tapcount = tapcount + 1
  33.         end
  34.     end
  35.     if userin[button[confirm_button]] then
  36.         if tapheld == false then
  37.             if tapcount % 2 == 1 then
  38.                 print(tapframe)
  39.                 tapframe = 0
  40.             end
  41.             tapcount = tapcount + 1
  42.             tapheld = true
  43.         end
  44.     else tapheld = false end
  45.    
  46.     if gametime == ReadByte(0x0400) and userin[button[10]] then
  47.         Pause()
  48.     end
  49.     gametime = ReadByte(0x0400)
  50.     if ReadByte(0x0129) == 7 and userin[button[10]] then
  51.         joypad.set(autoText)
  52.     end
  53. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement