Advertisement
Guest User

Survival Kids Lua script for TAS VBA v24

a guest
Apr 28th, 2015
353
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 4.70 KB | None | 0 0
  1. local togglecamhack = false
  2. local toggleeditstats = false
  3.  
  4. editStats = function()
  5.  
  6. memory.writebyte(0xc5ee, 99) -- life
  7. memory.writebyte(0xc5f0, 99) -- hunger
  8. memory.writebyte(0xc5f2, 99) -- water
  9. memory.writebyte(0xc5f4, 0) -- fatigue
  10. memory.writebyte(0xc19d,1) -- time
  11.  
  12.  
  13. end
  14.  
  15. displaceStuff = function()
  16.  
  17. --overwrite cam pos:
  18.  
  19.            -- maze forest: -46 -72        
  20.            -- before cave:  -60 +48
  21.            -- swamp: -66 +96(or 80)
  22.  
  23. ynew=ypos*8      - 66      
  24. xnew=xpos*8     + 80      
  25.  
  26.     memory.writebyte(0xc126,ynew) --ycam (mostly reliable)
  27.     memory.writebyte(0xc127,xnew) --xcam (mostly reliable)
  28.  
  29.   --memory.writebyte(0xff86,ypos*8 - 64) --ymap (kinda glitchy)
  30.  
  31. --draw player sprite displaced:
  32.  
  33.     memory.writebyte(0xdc04,80) --yleft1
  34.     memory.writebyte(0xdc00,80) --yright1
  35.     memory.writebyte(0xdd04,80) --yleft2
  36.     memory.writebyte(0xdd00,80) --yright2 (1 and 2 alternate)
  37.  
  38.     memory.writebyte(0xdc05,72) --xleft1
  39.     memory.writebyte(0xdc01,80) --xright1
  40.     memory.writebyte(0xdd05,72) --xleft2
  41.     memory.writebyte(0xdd01,80) --xright2 (1 and 2 alternate)
  42.  
  43. end
  44.  
  45.  
  46.  
  47. vba.registerbefore(function()
  48.  
  49. status = ""
  50.  
  51. if movie.active() == false then
  52. status = status .. "movie not recording!\n"
  53. end
  54.  
  55. if toggleeditstats == true then
  56. status = status .. "stats are being edited!\n"
  57. end
  58.  
  59. status = status .. vba.framecount() .. " : " ..vba.lagcount() .. "\n"
  60.  
  61. gui.text(1,1,status,"yellow")
  62.  
  63. end)
  64.  
  65.  
  66.  
  67.  
  68. while true do
  69.  
  70.  
  71. Daytimeid = memory.readbyte(0xc19e) --0 morn,  1 noon,  2 eve,   3 night
  72. if Daytimeid < 3 then Daytimelimit = 255 else Daytimelimit = 191 end
  73. if Daytimeid == 0 then Daytimename = "morning"
  74. elseif Daytimeid ==1 then Daytimename = "noon"
  75. elseif Daytimeid ==2 then Daytimename = "evening"
  76. elseif Daytimeid ==3 then Daytimename = "night" end
  77.  
  78. Animalspawn = 120 - memory.readbyte(0xc6fd)
  79. Day = memory.readbyte(0xcb9c)
  80. if Day > 9 then Day = 10 + Day%16 end-- this works until Day 19. When day 20 is reached, this is wrong.
  81. Time = memory.readbyte(0xc19d)
  82.  
  83. L = memory.readbyte(0xc5ee)
  84. H = memory.readbyte(0xc5f0)
  85. W = memory.readbyte(0xc5f2)
  86. F = memory.readbyte(0xc5f4)
  87. love = memory.readbyte(0xc5f6)
  88. Item1 = memory.readbyte(0xc700)
  89. Item2 = memory.readbyte(0xc701)
  90. Item3 = memory.readbyte(0xc702)
  91. Item4 = memory.readbyte(0xc703)
  92. Item5 = memory.readbyte(0xc704)
  93. Item6 = memory.readbyte(0xc705)
  94. Item7 = memory.readbyte(0xc706)
  95. Item8 = memory.readbyte(0xc707)
  96. Item9 = memory.readbyte(0xc708)
  97. Item10 = memory.readbyte(0xc709)
  98. Item11 = memory.readbyte(0xc70a)
  99. Item12 = memory.readbyte(0xc70b)
  100.  
  101. -- player position
  102. xplayer = memory.readbytesigned(0xc5c1)
  103. yplayer = memory.readbytesigned(0xc5c0)
  104.  
  105. -- player position on screen and in map
  106. xpos = memory.readbytesigned(0xd904)
  107. ypos = memory.readbytesigned(0xd905)
  108.  
  109. --cam pos
  110. xcam = memory.readbytesigned(0xc127)
  111. ycam = memory.readbytesigned(0xc126)
  112.  
  113. -- display
  114. gui.text(106,32, "X: " .. xpos)
  115. gui.text(106,40, "Y: " .. ypos)
  116. gui.text(106,56, "L: " .. L)
  117. gui.text(106,64, "H: " .. H)
  118. gui.text(106,72, "W: " .. W)
  119. gui.text(106,80, "F: " .. F)
  120. gui.text(106,88, "Love: " .. love)
  121. gui.text(106,96, "D " .. Day .. ", "  .. Time .. "/" .. Daytimelimit)
  122. gui.text(106,104, "Animal " .. Animalspawn .."/120")
  123.  
  124. gui.text(6,40, Item1)
  125. gui.text(6,48, Item2)
  126. gui.text(6,56, Item3)
  127. gui.text(6,64, Item4)
  128. gui.text(6,72, Item5)
  129. gui.text(6,80, Item6)
  130. gui.text(6,88, Item7)
  131. gui.text(6,96, Item8)
  132. gui.text(6,104, Item9)
  133. gui.text(6,112, Item10)
  134. gui.text(6,120, Item11)
  135. gui.text(6,128, Item12)
  136.  
  137. -- camhack
  138. gui.opacity(0.5)
  139. gui.drawbox(100,8,152,18, "red", "white")
  140. gui.opacity(1)
  141.  
  142. keytable = input.get() -- keys currently pressed on keyboard/mouse
  143. if keytable["xmouse"] > 100 and keytable["xmouse"] < 152 and keytable["ymouse"] > 8 and keytable["ymouse"] < 18 and keytable["leftclick"] == true then
  144. togglecamhack = not togglecamhack end
  145. if keytable["xmouse"] > 100 and keytable["xmouse"] < 152 and keytable["ymouse"] > 20 and keytable["ymouse"] < 30 and keytable["leftclick"] == true then
  146. toggleeditstats = not toggleeditstats end
  147.  
  148. if togglecamhack then
  149. displaceStuff() -- edits cam location and edits location of the drawn character sprite
  150.  
  151. gui.opacity(0.5)
  152. gui.drawbox(100,8,152,18, "#00ff00", "white")
  153. gui.opacity(1)
  154. gui.text(105,10,"camhack on")
  155.  
  156. else
  157.  
  158. gui.opacity(0.5)
  159. gui.drawbox(100,8,152,18, "red", "white")
  160. gui.opacity(1)
  161. gui.text(105,10,"camhack off")
  162.  
  163. end
  164.  
  165. -- edit stats
  166.  
  167. if toggleeditstats then
  168.  
  169. editStats()
  170.  
  171. gui.opacity(0.5)
  172. gui.drawbox(100,20,152,30, "#00ff00", "white")
  173. gui.opacity(1)
  174. gui.text(105,22,"stats on")
  175.  
  176. else
  177.  
  178. gui.opacity(0.5)
  179. gui.drawbox(100,20,152,30, "red", "white")
  180. gui.opacity(1)
  181. gui.text(105,22,"stats off")
  182.  
  183. end
  184.  
  185.  
  186.  
  187.  
  188. emu.frameadvance()
  189. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement