Advertisement
Kirkq

Quest 64 Lua Script 2/4/17

Feb 4th, 2017
255
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 19.02 KB | None | 0 0
  1. function round(num, numDecimalPlaces)
  2. local mult = 10^(numDecimalPlaces or 0)
  3. return math.floor(num * mult + 0.5) / mult
  4. end
  5.  
  6. function printMemoryDomains(x,y)
  7. local list = {}
  8. list = memory.getmemorydomainlist()
  9. local curr = memory.getcurrentmemorydomain()
  10. local num = table.getn(list)
  11. local i
  12. gui.text(x,y,"Current: " .. curr)
  13. for i=0,num do
  14. gui.text(x,y + 15*(i+1),list[i])
  15. end
  16. end
  17.  
  18. function printLocation(x,y)
  19. --0x7BABC related to movement startup
  20. XSpeed = memory.readfloat(0x7BAE4, true, "RDRAM")
  21. YSpeed = memory.readfloat(0x7BAEC, true, "RDRAM")
  22. Speed = math.sqrt(XSpeed * XSpeed + YSpeed * YSpeed)
  23. gui.text(x,y + 0,"X: " .. round(memory.readfloat(0x7BACC, true, "RDRAM"),4))
  24. gui.text(x,y+15,"Y: " .. round(memory.readfloat(0x7BAD4, true, "RDRAM"),4))
  25. gui.text(x,y+30,"XSpeed: " .. round(XSpeed,4))
  26. gui.text(x,y+45,"YSpeed: " .. round(YSpeed,4))
  27. gui.text(x,y+60,"Speed: " .. round(Speed,4))
  28. end
  29. --84EE6 and 84EEE strongly related to "area/zone or maybe music"
  30. --memory.write_u16_be(0x084EE6, 2, "RDRAM")
  31. --memory.write_u16_be(0x084EEE, 2, "RDRAM")
  32. --memory.write_u16_be(0x08536A, 2, "RDRAM")
  33.  
  34. function printItems(x,y)
  35. for i=1,30 do
  36. Item = memory.readbyte(0x8CF78 + (i -1), "RDRAM")
  37. if Item ~= 255 then
  38. gui.text(x,y + 15*(i-1), "Item:" .. globalItemList[Item+1])
  39. end
  40. end
  41. end
  42.  
  43. function printAgility (x,y)
  44. --gui.text(x,y + 15*0,"Agi(?): " .. round(memory.readfloat(0x7BC14, true, "RDRAM"),4))
  45. --gui.text(x+200,y + 15*0,"/800")
  46. gui.text(x,y + 15*1,"AgiField: " .. round(memory.readfloat(0x7BC18, true, "RDRAM"),4))
  47. gui.text(x+200,y + 15*1,"/1000")
  48. gui.text(x,y+15*2,"AgiTown: " .. round(memory.readfloat(0x7BC1C, true, "RDRAM"),4))
  49. gui.text(x+200,y + 15*2,"/2000")
  50. gui.text(x,y+15*3,"AgiBattle:" .. round(memory.readfloat(0x7BCA0, true, "RDRAM"),4))
  51. gui.text(x+200,y + 15*3,"/50")
  52. gui.text(x,y+15*4,"MPRecharge: " .. round(memory.readfloat(0x7BC0C, true, "RDRAM"),4))
  53. gui.text(x+200,y + 15*4,"/35")
  54.  
  55. --gui.text(x,y+15*3,"Camera: " .. round(memory.readfloat(0x85D3C, true, "RDRAM"),4))
  56. --gui.text(x,y+15*4,"Camera: " .. round(memory.readfloat(0x85DAC, true, "RDRAM"),4))
  57. --gui.text(x,y+15*5,"Camera: " .. round(memory.readfloat(0x85DE4, true, "RDRAM"),4))
  58. --gui.text(x,y+15*6,"Camera: " .. round(memory.readfloat(0x85E54, true, "RDRAM"),4))
  59. gui.text(x,y+15*7,"BattleLastX: " .. round(memory.readfloat(0x86B18, true, "RDRAM"),4))
  60. --gui.text(x,y+15*8,"BattleLastZ: " .. round(memory.readfloat(0x86B1C, true, "RDRAM"),4))
  61. gui.text(x,y+15*8,"BattleLastY: " .. round(memory.readfloat(0x86B20, true, "RDRAM"),4))
  62. gui.text(x,y+15*9,"CameraCenteredHereX: " .. round(memory.readfloat(0x86DD8, true, "RDRAM"),4))
  63. --gui.text(x,y+15*9,"CameraCenteredHereZ: " .. round(memory.readfloat(0x86DDC, true, "RDRAM"),4))
  64. gui.text(x,y+15*10,"CameraCenteredHereY: " .. round(memory.readfloat(0x86DE0, true, "RDRAM"),4))
  65. --gui.text(x,y+15*9,"ArenaX: " .. round(memory.readfloat(0x88188, true, "RDRAM"),4))
  66. --gui.text(x,y+15*10,"ArenaX: " .. round(memory.readfloat(0x881B8, true, "RDRAM"),4))
  67. --gui.text(x,y+15*11,"ArenaX: " .. round(memory.readfloat(0x8C5A4, true, "RDRAM"),4))
  68. end
  69.  
  70. function printEncounterCounter(x,y)
  71. gui.text(x,y,"EncCount: " .. memory.read_u16_be(0x8C578, "RDRAM"))
  72. gui.text(x+190,y,"/2000")
  73. gui.text(x,y + 15,"Increment: " .. round(memory.readfloat(0x8C574, true, "RDRAM"),4))
  74. end
  75.  
  76. function freezeEncounterCounter()
  77. memory.write_u16_be(0x8C578, 0, "RDRAM")
  78. memory.writefloat(0x8C574, 0, true, "RDRAM")
  79. end
  80.  
  81. function highEncounterCounter()
  82. memory.write_u16_be(0x8C578, 1800,"RDRAM")
  83. end
  84.  
  85. function printEnemyStats(x,y)
  86. EnemiesLeft = memory.readbyte(0x07C993, "RDRAM")
  87. TimeUntilYouAct = memory.read_u16_be(0x07C99A, "RDRAM")
  88.  
  89. gui.text(x,y,"ToAct:" .. TimeUntilYouAct)
  90.  
  91. NumEnemies = EnemiesLeft -- For Now, Not Ideal
  92. if NumEnemies > 0 then
  93. for i=1,NumEnemies do
  94. Base = 0x07C99C --next = 0x07CAC4
  95. WalkDec1 = memory.read_u16_be(0x07C99C + 296*(i-1), "RDRAM")
  96. RelatedToAttacking = memory.read_u16_be(0x07C99E + 296*(i-1), "RDRAM")
  97. RelatedToAttacking2 = memory.read_u16_be(0x07C9A0 + 296*(i-1), "RDRAM")
  98. FloatSomething = memory.readfloat(0x7C9A8 + 296*(i-1), true, "RDRAM")
  99. CurrHP = memory.read_u16_be(0x07C9A2 + 296*(i-1), "RDRAM") --9A2 and ACA and BF2 --7C993 = dead? 3 = alive, 2 = dead? (296 = 0x128)
  100. MaxHP = memory.read_u16_be(0x07C9A4 + 296*(i-1), "RDRAM")
  101. X = memory.readfloat(0x7C9BC + 296*(i-1), true, "RDRAM")
  102. Z = memory.readfloat(0x7C9C0 + 296*(i-1), true, "RDRAM")
  103. Y = memory.readfloat(0x7C9C4 + 296*(i-1), true, "RDRAM")
  104.  
  105. RapidlyChanging1 = memory.read_u16_be(0x07C9C6 + 296*(i-1), "RDRAM")
  106. RapidlyChanging2 = memory.read_u16_be(0x07C9D4 + 296*(i-1), "RDRAM")
  107. RapidlyChanging3 = memory.read_u16_be(0x07C9D6 + 296*(i-1), "RDRAM")
  108. RapidlyChanging4 = memory.read_u16_be(0x07C9DC + 296*(i-1), "RDRAM")
  109. RapidlyChanging5 = memory.read_u16_be(0x07C9DE + 296*(i-1), "RDRAM")
  110.  
  111. SizeModifier = memory.readfloat(0x7C9E0 + 296*(i-1), true, "RDRAM")
  112. --memory.writefloat(0x7C9E0, 0.4, true, "RDRAM") -- Meme Address
  113. TrueSize = memory.readfloat(0x7C9E4 + 296*(i-1), true, "RDRAM")
  114. Float3 = memory.readfloat(0x7C9E8 + 296*(i-1), true, "RDRAM")
  115. Float4 = memory.readfloat(0x7C9EC + 296*(i-1), true, "RDRAM")
  116. Float5 = memory.readfloat(0x7C9F0 + 296*(i-1), true, "RDRAM")
  117.  
  118.  
  119. --Hell Hound: Anything below 20.9 distance from center to center."
  120. --Were Hare less than 15.6 hits. Difference of 5.3
  121.  
  122. --Hell Hound sphere of influence is about 27.0
  123. -- 0.084
  124. -- 130
  125. -- 130 * 0.084 = 10.92
  126. -- -1.428
  127. -- 1
  128. -- 120
  129.  
  130. -- 0.07
  131. -- 80
  132. -- 80 * 0.07 = 5.6
  133. -- 0.2275
  134. -- 1
  135. -- 120
  136.  
  137.  
  138. ID = memory.readbyte(0x07CA0D + 296*(i-1), "RDRAM") --A0D
  139.  
  140. RapidlyChanging6 = memory.read_u16_be(0x07CA10 + 296*(i-1), "RDRAM")
  141. RapidlyChanging7 = memory.read_u16_be(0x07CA12 + 296*(i-1), "RDRAM")
  142. RelatedToAttacking3 = memory.readbyte(0x07CA19+ 296*(i-1), "RDRAM")
  143. Dunno1 = memory.readbyte(0x07CA1B+ 296*(i-1), "RDRAM")
  144. Atk = memory.read_u16_be(0x07CAAC + 296*(i-1), "RDRAM")
  145. Agi = memory.read_u16_be(0x07CAAE + 296*(i-1), "RDRAM")
  146. Def= memory.read_u16_be(0x07CAB0 + 296*(i-1), "RDRAM")
  147. --Exp does not appear to be here. Total Exp for battle maybe?
  148.  
  149. gui.text(x+100*(i-1),y+15,"HP:" .. CurrHP .. "/" .. MaxHP)
  150. gui.text(x+100*(i-1),y+30,"At:" .. Atk)
  151. gui.text(x+100*(i-1),y+45,"De:" .. Def)
  152. gui.text(x+100*(i-1),y+60,"Ag:" .. Agi)
  153. gui.text(x+100*(i-1),y+75,"ID:" .. ID)
  154. gui.text(x+100*(i-1),y+90,"WalkDec:" .. WalkDec1)
  155. gui.text(x+100*(i-1),y+105,"Size:" .. round(SizeModifier*TrueSize,4))
  156. --gui.text(x+100*(i-1),y+120,"3:" .. Dunno3)
  157. end
  158. end
  159. end
  160.  
  161.  
  162. --Solvaring
  163. --Zelse
  164. --Nepty
  165. --Shilf
  166. --Fargo
  167. --Guilty
  168. --Beigis Stats in ROM at D87944
  169. --Mammon in ROM at D8797C --Offset is 0x38
  170. --*
  171. --*
  172. --6 areas and bosses
  173. --
  174. --0x112664 07D0BF 07D0AF 07D0AE 07D0AD 07D0AA 07D0A9
  175. --1 96 68 9 39 8 39
  176. --0 116 112 90 41 89 41
  177. --255 136 184 144 38 144 38
  178. --0 156 164 32 40 31 40
  179. --0 176 192 140 39 140 39
  180.  
  181. --39 39 39 39 39 8 144 39 9 68 96 65 141
  182. --41 41 41 41 41 89 144 41 90 112 116 129 147
  183.  
  184. --Were Hare ADC094 80, 140, 0.07
  185. --Hell Hound 130, 170, 0.084
  186. --Man Eater 115, 135, 0.084
  187. --Big Mouth ADC13C 130, 70, 0.105
  188. --Parassault 90, 150, 0.077
  189. --Orc Jr 90, 150, 0.077
  190. --Gremlin 90, 140, 0.084
  191. --Skeleton 90, 135, 0.084
  192. --Ghost Hound 90, 238, 0.084
  193. --Merrow 130, 170, 0.084
  194. --Wolf Goat 80, 125, 0.084, 130, 170, 0.091
  195. --*
  196. --Goblin B6337C
  197. --Frog King
  198. --Apophis
  199. --Mad Doll
  200. --Death Hugger
  201. --Kobold
  202. --Man Trap
  203. --Bat
  204. --Frog Knight
  205. --Marionasty
  206. --Dark Goblin
  207. --Hot Lips
  208. --Ghost Stalker B6361C
  209. --Treant
  210. --Cockatrice
  211. --*
  212. --Multi-Optics BBDE9C
  213. --Mimic
  214. --Crawler
  215. --Scorpion
  216. --Scare Crow
  217. --Wyvern
  218. --Skelebat
  219. --Cryshell BBE024
  220. --Blood Jell
  221. --Caterpillar (9) -- C7D935 is interesting, may be red herring
  222. --Fish Man
  223. --*
  224. --Sandman (ID 0) C317EC
  225. --Werecat
  226. --Nightmare
  227. --Blue Man
  228. --Winged Sunfish
  229. --Gloon Wing
  230. --Ogre (ID 6)
  231. --Rocky (ID 7)
  232. --Red Wyvern
  233. --FlamedMane
  234. --Magma Fish
  235. --RedRose (ID 11)
  236. --WhiteRoseKnight: C31A8C
  237. --*
  238. --Orc C9BE54
  239. --Ghost C9BE8C
  240. --Will o Wisp
  241. --Sprite
  242. --JackoLantern
  243. --Arachnoid
  244. --Lamia
  245. --Temptress
  246. --Pixie
  247. --Grangach
  248. --Thunder Jell
  249. --Termant
  250. --*
  251. --Judgment HP: CC443C
  252. --Pin Head HP: CC44AC
  253. --Pale Rider: CC4474
  254. --Spriggan: CC44E4
  255.  
  256. --RNG ROM
  257. --023BE2 =16838 and 023BE6 = 20077
  258. --41C64E6Dh + 3039h
  259. --12345 or 13345 ??
  260. --023BE4
  261.  
  262. --RNG RAM
  263. --022FE0
  264. --memory.write_u16_be(0x22FE2, 0, "RDRAM")
  265. --memory.write_u16_be(0x22FE4, 300, "RDRAM")
  266. --memory.write_u16_be(0x22FE6, 0, "RDRAM")
  267.  
  268. --Avalanche Y starts at 0x86F2C
  269.  
  270. function printStats(x,y)
  271. local Exp = memory.read_u32_be(0x07BA90, "RDRAM")
  272. local HPLv = memory.readbyte(0x07BAB0, "RDRAM")
  273. local MPLv = memory.readbyte(0x07BAB1, "RDRAM")
  274. local AgiLv = memory.readbyte(0x07BAB2, "RDRAM")
  275. local DefLv = memory.readbyte(0x07BAB3, "RDRAM")
  276. local Lv = memory.readbyte(0x07BAB4, "RDRAM")
  277. local CurrHP = memory.read_u16_be(0x7BA84, "RDRAM")
  278. local MaxHP = memory.read_u16_be(0x7BA86, "RDRAM")
  279. local HPSub = memory.readbyte(0x7BAA9, "RDRAM")
  280. local CurrMP = memory.read_u16_be(0x7BA88, "RDRAM")
  281. local MaxMP = memory.read_u16_be(0x7BA8A, "RDRAM")
  282. local MPSub = memory.readbyte(0x7BAAB, "RDRAM")
  283. local Def = memory.readbyte(0x7BA8F, "RDRAM")
  284. local DefSub = memory.readbyte(0x7BAAF, "RDRAM")
  285. local Agi = memory.readbyte(0x7BA8D, "RDRAM")
  286. local AgiSub = memory.readbyte(0x7BAAD, "RDRAM")
  287. gui.text(x,y+0,"HP: " .. CurrHP .. "/" .. MaxHP .. " (" .. HPSub .. "/" .. globalStatTable[HPLv+1] ..")")
  288. gui.text(x,y+15,"MP: " .. CurrMP .. "/" .. MaxMP .. " (" .. MPSub .. "/" .. 4*globalStatTable[MPLv+1] ..")")
  289. gui.text(x,y+30,"Def: " .. Def .. " (" .. DefSub .. "/" .. 2*globalStatTable[DefLv+1] ..")")
  290. gui.text(x,y+45,"Agi: " .. Agi .. " (" .. AgiSub .. "/" .. globalStatTable[AgiLv+1] ..")")
  291. gui.text(x,y+60,"Lv: " .. Lv .. " (" .. Exp .. "/" .. globalLvTable[Lv+1] .. ")")
  292. end
  293.  
  294. function HP50()
  295. memory.write_u16_be(0x7BA84, 50, "RDRAM")
  296. end
  297. function setSpirits(f,e,wa,wi)
  298. memory.writebyte(0x7BAA4, f, "RDRAM")
  299. memory.writebyte(0x7BAA5, e, "RDRAM")
  300. memory.writebyte(0x7BAA6, wa, "RDRAM")
  301. memory.writebyte(0x7BAA7, wi, "RDRAM")
  302. end
  303. function setStats(HP,MP,De,Ag)
  304. memory.write_u16_be(0x7BA86, HP, "RDRAM")
  305. memory.write_u16_be(0x7BA8A, MP, "RDRAM")
  306. memory.writebyte(0x7BA8F, De, "RDRAM")
  307. memory.writebyte(0x7BA8D, Ag, "RDRAM")
  308. end
  309. function stackOfJewelsAndWings()
  310. --Earth Orb opens Connor Fortress door.
  311. --Wind Jade opens door to access Blue Cave.
  312. --Water Jewel reopens ship.
  313. memory.writebyte(0x8CF78, 20, "RDRAM")
  314. memory.writebyte(0x8CF79, 21, "RDRAM")
  315. memory.writebyte(0x8CF7A, 22, "RDRAM")
  316. memory.writebyte(0x8CF7B, 14, "RDRAM")
  317. memory.writebyte(0x8CF7C, 15, "RDRAM")
  318. memory.writebyte(0x8CF7D, 16, "RDRAM")
  319. memory.writebyte(0x8CF7E, 17, "RDRAM")
  320. memory.writebyte(0x8CF7F, 18, "RDRAM")
  321. memory.writebyte(0x8CF80, 19, "RDRAM")
  322. end
  323.  
  324. function setupLvTable(tmpTable)
  325. --This table is calculated off the current level.
  326. local i
  327. for i=1,99 do
  328. tmpTable[i] = memory.read_u32_be(0x05493C+4*(i-1),"ROM")
  329. end
  330. return tmpTable
  331. end
  332. function printLvTable(x,y,tmpTable)
  333. local i
  334. for i=1,99 do
  335. gui.text(x,y+i*15,tmpTable[i])
  336. end
  337. end
  338. function setupStatTable(tmpTable1)
  339. --This table is calculated off the concept of numStatLevels, not current level.
  340. local i
  341. for i=1,70 do
  342. tmpTable1[i] = memory.read_u16_be(0x054ACC+2*(i-1),"ROM")
  343. end
  344. return tmpTable1
  345. end
  346. function printStatTable(x,y,tmpTable1)
  347. --ROM 0x054909 is starting stats I think?
  348. local i
  349. for i=1,70 do
  350. gui.text(x,y+i*15,tmpTable1[i])
  351. end
  352. end
  353.  
  354. function printObjectCoordinates(x,y)
  355. --memory.writefloat(0x86F2C, 1600, true, "RDRAM")
  356. BrianX = memory.readfloat(0x7BACC, true, "RDRAM")
  357. BrianY = memory.readfloat(0x7BAD4, true, "RDRAM")
  358.  
  359. i = 1 --Enemy number 1 (starting at 1)
  360. EnemyX = memory.readfloat(0x7C9BC + 296*(i-1), true, "RDRAM")
  361. EnemyY = memory.readfloat(0x7C9C4 + 296*(i-1), true, "RDRAM")
  362.  
  363. for i=1,10 do
  364. --memory.writefloat(0x86F24 + 60*(i-1), -20, true, "RDRAM") --X
  365. --memory.writefloat(0x86F2C + 60*(i-1), -350, true, "RDRAM") --Y
  366.  
  367. --RightSide -1367,930
  368. --LeftSide -1327, 930
  369. --BackSide -1347, 948
  370. --FrontSide -1347, 908
  371.  
  372. --Hell Hound: Anything below 20.9 distance from center to center."
  373. --Were Hare less than 15.6 hits.
  374. --
  375. --Solvaring 10 + 8.4 Note: Solvaring is moving about half a pixel during standing.
  376. --Zelse 10 + 5.6 (Investigate Zelse Mid-Range) Zelse moves about 0.4 pixels during standing. He recoils a couple pixels when hit.
  377. --Nepty 10 + 4.9 Nepty moves about 0.4 px during standing.
  378. --Shilf 10 + 4.9 Shilf moves about 0.05
  379. --Fargo 10 + 7 moves about 0.05
  380. --Guilty 10 + 9.52 No movement
  381. --Beigis 10 + 6.3 No movement
  382. --Mammon 10 + 94.5 Moves around 0.6 px.
  383.  
  384. Timer = memory.read_u16_be(0x86F1C + 60*(i-1), "RDRAM")
  385. X = memory.readfloat(0x86F24 + 60*(i-1), true, "RDRAM")
  386. Z = memory.readfloat(0x86F28 + 60*(i-1), true, "RDRAM")
  387. Y = memory.readfloat(0x86F2C + 60*(i-1), true, "RDRAM")
  388. XDiff= BrianX - X
  389. YDiff= BrianY - Y
  390. D = math.sqrt(XDiff*XDiff + YDiff*YDiff)
  391. A = math.atan2(XDiff,YDiff)*(180/(math.pi))
  392. EnemyXDiff = EnemyX - X
  393. EnemyYDiff = EnemyY - Y
  394. EnemyD = math.sqrt(EnemyXDiff*EnemyXDiff + EnemyYDiff*EnemyYDiff)
  395. EnemyA = math.atan2(EnemyXDiff,EnemyYDiff)*(180/(math.pi))
  396.  
  397.  
  398.  
  399. j=0
  400. if i > 5 then
  401. j=1
  402. end
  403.  
  404. if (Timer > 0) then
  405. gui.text(x+140*(i-j*5-1),y+0*15 + j*100,"Timer: " .. Timer)
  406. gui.text(x+140*(i-j*5-1),y+1*15 + j*100,"X: " .. round(X,3))
  407. gui.text(x+140*(i-j*5-1),y+2*15 + j*100,"Z: " .. round(Z,3))
  408. gui.text(x+140*(i-j*5-1),y+3*15 + j*100,"Y: " .. round(Y,3))
  409. gui.text(x+140*(i-j*5-1),y+4*15 + j*100,"D: " .. round(D,3))
  410. gui.text(x+140*(i-j*5-1),y+5*15 + j*100,"A: " .. round(A,3)) --16 angles
  411. --gui.text(x+140*(i-j*5-1),y+4*15 + j*100,"D: " .. round(EnemyD,3))
  412. --gui.text(x+140*(i-j*5-1),y+5*15 + j*100,"A: " .. round(EnemyA,3))
  413. end
  414. end
  415.  
  416.  
  417. --F1C Timer
  418. --F24 X
  419. --F28 Z
  420. --F2C Y
  421.  
  422. --F60 X
  423. --F64 Z
  424. --F68 Y
  425. end
  426.  
  427. function rocksBrianToEnemy(BrianX1,BrianY1,EnemyX1,EnemyY1,Size1)
  428.  
  429. numRocks1 = 0
  430.  
  431. --textfile = "BizDump2"
  432. --dumpfile = textfile..".txt"
  433. --io.output(dumpfile)
  434.  
  435.  
  436. for i=0,15 do --Angles
  437. for j=20,39 do --Distances
  438. thisRockX1= BrianX1 + j*math.cos(i*22.5*math.pi/180)
  439. thisRockY1= BrianY1 + j*math.sin(i*22.5*math.pi/180)
  440.  
  441. XDiff1= thisRockX1 - EnemyX1
  442. YDiff1= thisRockY1 - EnemyY1
  443. D1 = math.sqrt(XDiff1*XDiff1 + YDiff1*YDiff1)
  444. if D1 <= Size1 + 10 then
  445. numRocks1 = numRocks1 + 1
  446. --io.write(thisRockX1, " ", thisRockY1, " ", i, " ", j, "\n")
  447. end
  448.  
  449. end
  450. end
  451.  
  452. --io.output():close()
  453.  
  454. return numRocks1
  455. end
  456.  
  457. function howManyRocksCurrently(x,y)
  458. BrianX = memory.readfloat(0x7BACC, true, "RDRAM")
  459. BrianY = memory.readfloat(0x7BAD4, true, "RDRAM")
  460. i = 1 --Enemy number 1 (starting at 1)
  461. EnemyX = memory.readfloat(0x7C9BC + 296*(i-1), true, "RDRAM")
  462. EnemyY = memory.readfloat(0x7C9C4 + 296*(i-1), true, "RDRAM")
  463. SizeModifier = memory.readfloat(0x7C9E0 + 296*(i-1), true, "RDRAM")
  464. TrueSize = memory.readfloat(0x7C9E4 + 296*(i-1), true, "RDRAM")
  465. Size = SizeModifier*TrueSize
  466. XDiff= BrianX - EnemyX
  467. YDiff= BrianY - EnemyY
  468. D = math.sqrt(XDiff*XDiff + YDiff*YDiff)
  469. A = math.atan2(XDiff,YDiff)*(180/(math.pi))
  470.  
  471. R = rocksBrianToEnemy(BrianX,BrianY,EnemyX,EnemyY,Size)
  472.  
  473. gui.text(x,y+15*0,"D: " .. round(D,3))
  474. gui.text(x,y+15*1,"A: " .. round(A,3))
  475. gui.text(x,y+15*2,"Size:" .. round(Size))
  476. gui.text(x,y+15*3,"NumRocks:" .. R)
  477. gui.text(x,y+15*4,"BrianX:" .. BrianX)
  478. gui.text(x,y+15*5,"BrianY:" .. BrianY)
  479. gui.text(x,y+15*6,"EnemyX:" .. EnemyX)
  480. gui.text(x,y+15*7,"EnemyY:" .. EnemyY)
  481.  
  482. end
  483.  
  484. function heatMapGenerator()
  485. MapSize = 120
  486. BrianX = math.floor(MapSize/2)
  487. BrianY = math.floor(MapSize/2)
  488. Size = 6.3
  489. --Solvaring 10 + 8.4 Note: Solvaring is moving about half a pixel during standing.
  490. --Zelse 10 + 5.6 (Investigate Zelse Mid-Range) Zelse moves about 0.4 pixels during standing. He recoils a couple pixels when hit.
  491. --Nepty 10 + 4.9 Nepty moves about 0.4 px during standing.
  492. --Shilf 10 + 4.9 Shilf moves about 0.05
  493. --Fargo 10 + 7 moves about 0.05
  494. --Guilty 10 + 9.52 No movement
  495. --Beigis 10 + 6.3 No movement
  496. --Mammon 10 + 94.5 Moves around 0.6 px.
  497. heatTextfile = "HeatMap"
  498. heatDumpfile = heatTextfile..".txt"
  499. io.output(heatDumpfile)
  500.  
  501. Max = 0
  502.  
  503. for EnemyX=0,MapSize do
  504. for EnemyY=MapSize,0,-1 do
  505. R = rocksBrianToEnemy(BrianX,BrianY,EnemyX,EnemyY,Size)
  506. if R > Max then
  507. Max = R
  508. end
  509. io.write(string.format("%02X ", R))
  510. end
  511. io.write("\n")
  512. end
  513.  
  514. io.write("\n")
  515. io.write("EnemySize: " .. Size)
  516. io.write("\n")
  517. io.write("Max: ", string.format("%02X", Max))
  518. io.write("\n")
  519. io.write("MapSize: " .. MapSize+1)
  520.  
  521. io.output():close()
  522.  
  523.  
  524. end
  525.  
  526. globalItemList = {
  527. "0. Spirit Light",
  528. "1. Fresh Bread",
  529. "2. Honey Bread",
  530. "3. Healing Potion",
  531. "4 Dragon's Potion",
  532. "5. Dew Drop",
  533. "6. Mint Leaves",
  534. "7. Heroes Drink",
  535. "8. Silent Flute",
  536. "9.Celine's Bell",
  537. "10.Replica",
  538. "11.Giant's Shoes",
  539. "12.Silver Amulet",
  540. "13.Golden Amulet",
  541. "14.White Wings",
  542. "15.Yellow Wings",
  543. "16.Blue Wings",
  544. "17.Green Wings",
  545. "18.Red Wings",
  546. "19.Black Wings",
  547. "20.Earth Orb",
  548. "21.Wind Jade",
  549. "22.Water Jewel",
  550. "23.Fire Ruby",
  551. "24.Eletale Book",
  552. "25.Dark Gaol Key",
  553. }
  554.  
  555. -- Initializations
  556. local i
  557. globalLvTable = {}
  558. globalLvTable = setupLvTable(globalLvTable)
  559. globalStatTable = {}
  560. globalStatTable = setupStatTable(globalStatTable)
  561. memory.usememorydomain("RDRAM")
  562.  
  563. ----------------------------
  564. --Changes go down here.--
  565. ----------------------------
  566.  
  567. local tmp
  568. --for i=0x1,0xFFFF00 do
  569. --if memory.readbyte(i) == 9 then
  570. --if memory.readbyte(i+1) == 9 and memory.readbyte(i+2) == 9 and memory.readbyte(i+3) == 9 then
  571. --end
  572. --end
  573.  
  574. --memory.writebyte(0x07BAB4, 10, "RDRAM")
  575. --HP50()
  576. setSpirits(38,39,40,41)
  577. setStats(200,100,250,250)
  578. --heatMapGenerator()
  579. while true do
  580. --memory.write_u32_be(0x7508C, 0, "RDRAM") -- did this do something?
  581. --memory.write_u16_be(0x22FE2, 0, "RDRAM")
  582. --memory.write_u16_be(0x22FE4, 0, "RDRAM")
  583. --memory.write_u16_be(0x22FE6, 0, "RDRAM")
  584. --4 same as 0
  585.  
  586. --RNG increment 0,N,1 rotates in a circle around you.
  587. --RNG increment 0,0,0 stays in one spot
  588.  
  589. --Thing1
  590. --memory.writefloat(0x86FA4, 1600, true, "RDRAM")
  591.  
  592. stackOfJewelsAndWings()
  593. HP50()
  594. --highEncounterCounter()
  595. --memory.writebyte(0x07CAB2,0,"RDRAM")
  596. --memory.writebyte(0x07CAB5,0,"RDRAM")
  597. --memory.writebyte(0x07CAB4,0,"RDRAM")
  598. --memory.writebyte(0x07CAB3,0,"RDRAM")
  599. --freezeEncounterCounter()
  600. --printEnemyStats(50,10)
  601. printObjectCoordinates(50,10)
  602. --printEncounterCounter(100,500)
  603. printStats(100,420)
  604. --printLocation(100,150)
  605. printAgility(100,230)
  606. printItems(400,250)
  607. howManyRocksCurrently(500,100)
  608. --printMemoryDomains(100,115)
  609. --printLvTable(100,115,globalLvTable)
  610. --printStatTable(100,115,globalStatTable)
  611.  
  612.  
  613. emu.frameadvance()
  614. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement