Advertisement
Arnethegreat

Please don't ruin my paste again, pastebin.

May 6th, 2012
71
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 14.82 KB | None | 0 0
  1. -- Version 0.21a
  2. -- OPTIONS -- OPTIONS -- OPTIONS -- Change to true or false
  3.  
  4. Level_Blitz = true
  5. NoLeftMode = false
  6. DrunkMode = false
  7. HardMode = false
  8. ForceRetry = false
  9. DeathTimer = false --combine with Hard Mode for Insane Mode (1-hit death)
  10. AlwaysExtendedFlutter = false
  11. NoFlutter = false
  12. NoTongue = false
  13. Velcro = false
  14. AlwaysFilledMouth = false -- Enter 2 for bubbles and 3 for melons. Enter false to disable
  15. FullEggsStart = false
  16. NumberOfEggs = 6 -- For FullEggsStart, how many to start with - choose between 1-6
  17. EggType = 39 -- What eggs to start with (34 = flashing egg - 35 = red - 36 = yellow - 37 = green - 39 = key - 40 = flashing egg - 43 = big egg
  18. FastModeX = false
  19. FastModeY = false
  20. SpeedBoostX = 5 -- For fast mode, enter 0-9 (higher is faster)
  21. SpeedBoostY = 5
  22.  
  23. -- Level Blitz Options -- Level Blitz Options --
  24.  
  25. AutoScrollers = false
  26. ExtraStages = false
  27. ExcludeStages = {68, 72} -- seperate by a comma, write stages like 54 for 5-4
  28. NormalFortressOrder = true
  29. NormalCastleOrder = true
  30. RandomSeed = 49494949
  31. SameStage = false
  32. Fortresses = true
  33. Castles = true
  34. World1 = false
  35. World2 = false
  36. World3 = true
  37. World4 = true
  38. World5 = true
  39. World6 = true
  40.  
  41. -- OPTIONS End -- OPTIONS End -- OPTIONS End --
  42.  
  43. -- !Instructions! Instructions! Instructions! Instructions!
  44. -- 1. You must use a lua compatible Snes9x emulator. Recommended is -> http://code.google.com/p/snes9x-rr/downloads/detail?name=snes9x-1.51-rerecording-svn147.zip&can=2&q=
  45. -- 2. Recommended ROM is (U) (1.0) (!) but others should work but they are untested
  46. -- 3. Change options above and replace with true or false, RandomSeed is a number though, if it's a word, it's just random
  47. -- 4. In Snes9x, load ROM then go File -> Lua Scripting -> New Lua Script Window... -> Load file -> Press Run
  48. -- 5. You know you have loaded it right when the Lua Script window outputs what modes are on and what are false
  49. -- 6. If you have changed the options, you have to restart the script for it to take effect
  50. -- Newest version is always found at http://pastebin.com/qCGDbZZZ
  51. ------------------------------------------------
  52. ------------------------------------------------
  53. ------------------------------------------------
  54. ----------------Script starts here--------------
  55. ------------------------------------------------
  56. ------------------------------------------------
  57. ------------------------------------------------
  58. ------------------------------------------------
  59. ------------------------------------------------
  60. function table.contains(table, element)
  61. for i, value in pairs(table) do
  62. if value == element then
  63. valpos = i
  64. return true
  65. end
  66. end
  67. return false
  68. end
  69.  
  70. function deepcopy(t)
  71. if type(t) ~= 'table' then return t end
  72. local mt = getmetatable(t)
  73. local res = {}
  74. for k,v in pairs(t) do
  75. if type(v) == 'table' then
  76. v = deepcopy(v)
  77. end
  78. res[k] = v
  79. end
  80. setmetatable(res,mt)
  81. return res
  82. end
  83.  
  84. function removetable(tab,tab2)
  85. table.sort(tab)
  86. table.sort(tab2)
  87. rem = 0
  88. tabcopy = deepcopy(tab)
  89. for cy, value in ipairs(tab) do
  90. for cx, value2 in ipairs (tab2) do
  91. if value == value2 then
  92. table.remove(tabcopy,cy - rem)
  93. rem = rem + 1
  94. end
  95. end
  96. end
  97. return tabcopy
  98. end
  99.  
  100. function convertstages(tablelist)
  101. for i, stg in pairs(tablelist) do
  102. worldnumber = math.floor(stg/10)
  103. levelnumber = stg - worldnumber*10
  104. realstagevalue = (worldnumber - 1)*12 + levelnumber - 1
  105. tablelist[i] = realstagevalue
  106. end
  107. end
  108. ------------------------------------------------
  109. ------------------------------------------------
  110. ------------------------------------------------
  111. print("Version 0.21a")
  112. NumberOfEggs = NumberOfEggs*2
  113. eggcount = 0
  114. keycount = 0
  115. mouth_var = 0
  116. instage = 0
  117. enteredstage = 0
  118. laststage = 0
  119. lastworld = 0
  120. stage = 0
  121. levelsplayed = {}
  122. scrollerslist = {4, 53, 64} -- This can be changed to include or exclude other stages depending on how you define an autoscroller
  123. extralist = {8, 20, 32, 44, 56, 68}
  124. castlelist = {7, 19, 31, 43, 55}
  125. castlelistcopy = {7, 19, 31, 43, 55}
  126. fortresslist = {3, 15, 27, 39, 51, 63}
  127. fortresslistcopy = {3, 15, 27, 39, 51, 63}
  128. world1list = {0, 1, 2, 3, 4, 5, 6, 7, 8 }
  129. world2list = {12, 13, 14, 15, 16, 17, 18, 19, 20}
  130. world3list = {24, 25, 26, 27, 28 ,29, 30, 31, 32}
  131. world4list = {36, 37, 38, 39, 40, 41, 42, 43, 44}
  132. world5list = {48, 49, 50, 51, 52, 53, 54, 55, 56}
  133. world6list = {60, 61, 62, 63, 64, 65, 66, 68}
  134. stageslist = {0, 1, 2, 3, 4, 5, 6, 7, 8, 12, 13, 14, 15, 16, 17, 18, 19, 20, 24, 25, 26, 27, 28 ,29, 30, 31, 32, 36, 37, 38, 39, 40, 41, 42, 43, 44, 48, 49, 50, 51, 52, 53, 54, 55, 56, 60, 61, 62, 63, 64, 65, 66, 68}
  135. -- Remove stages according to options
  136. if AutoScrollers == false then
  137. stageslist = removetable(stageslist, scrollerslist)
  138. end
  139.  
  140. if ExtraStages == false then
  141. stageslist = removetable(stageslist, extralist)
  142. end
  143.  
  144. if World1 == false then
  145. stageslist = removetable(stageslist, world1list)
  146. end
  147.  
  148. if World2 == false then
  149. stageslist = removetable(stageslist, world2list)
  150. end
  151.  
  152. if World3 == false then
  153. stageslist = removetable(stageslist, world3list)
  154. end
  155.  
  156. if World4 == false then
  157. stageslist = removetable(stageslist, world4list)
  158. end
  159.  
  160. if World5 == false then
  161. stageslist = removetable(stageslist, world5list)
  162. end
  163.  
  164. if World6 == false then
  165. stageslist = removetable(stageslist, world6list)
  166. end
  167.  
  168. if Fortresses == false or NormalFortressOrder == true then
  169. stageslist = removetable(stageslist, fortresslist)
  170. end
  171.  
  172. if Castles == false or NormalCastleOrder == true then
  173. stageslist = removetable(stageslist, castlelist)
  174. end
  175.  
  176. convertstages(ExcludeStages)
  177. stageslist = removetable(stageslist, ExcludeStages)
  178. castlelist = removetable(castlelist, ExcludeStages)
  179. fortresslist = removetable(fortresslist, ExcludeStages)
  180. --
  181. if RandomSeed ~= nil then
  182. math.randomseed(RandomSeed)
  183. end
  184. --
  185. ------------------------------------------------
  186. --------------------GAMEMODES-------------------
  187. ------------------------------------------------
  188. ------------------------------------------------
  189. if Level_Blitz == true then
  190. function LevelBlitz()
  191. levelamount = #stageslist
  192. stage = memory.readbyte(0x7E021A)
  193. stagenumber = memory.readbyte(0x7E1112) --//or memory.readbyte(0x7E112E)
  194. worldnumber= memory.readbyte(0x7E0218)
  195. overworld = memory.readbyte(0x7E0009)
  196. entering_stage = memory.readbyte(0x7E111D)
  197. titlescreen = memory.readbyte(0x7E011C)
  198. --
  199. if entering_stage == 1 and enteredstage == 0 and titlescreen == 12 then
  200. laststage = stagenumber
  201. lastworld = worldnumber
  202. if NormalFortressOrder == true and table.contains(fortresslistcopy, laststage+lastworld*6) == true then
  203. randstage = fortresslist[math.random(1,#fortresslist)]
  204. elseif NormalCastleOrder == true and table.contains(castlelistcopy, laststage+lastworld*6) == true then
  205. randstage = castlelist[math.random(1,#castlelist)]
  206. else
  207. randstage = stageslist[math.random(1,levelamount)]
  208. end
  209. memory.writebyte(0x7E021A,randstage )
  210. stagecompleted = stage + 1
  211. enteredstage = 1
  212. instage = 1
  213. print("Randomizes", randstage, " ", levelamount)
  214. elseif overworld == 126 then
  215. if SameStage == false and instage == 1 then
  216. table.insert(levelsplayed, stage)
  217. if NormalFortressOrder == true and table.contains(fortresslistcopy, laststage+lastworld*6) == true then
  218. fortresslist = removetable(fortresslist, levelsplayed)
  219. elseif NormalCastleOrder == true and table.contains(castlelistcopy, laststage+lastworld*6) == true then -- Bug här när den tar bort från listan, gör en hardcopy som den drar banor från.
  220. castlelist = removetable(castlelist, levelsplayed)
  221. else
  222. stageslist = removetable(stageslist, levelsplayed)
  223. end
  224. print(levelsplayed)
  225. print(stageslist)
  226. instage = 0
  227. levelsplayed = {}
  228. print("Removing Stage")
  229. end
  230. memory.writebyte(0x7E021A, laststage+lastworld*6)
  231. memory.writebyte(0x7E0218, lastworld) -- This is not needed? Kept just in case
  232. elseif overworld == 64 and entering_stage ~= 1 then
  233. enteredstage = 0
  234. end
  235. end
  236. print("Blitz Mode is ON")
  237. else
  238. function LevelBlitz()
  239. end
  240. print("Blitz Mode is OFF")
  241. end
  242. -----------------------------------------------
  243. ------------------------------------------------
  244. if NoLeftMode == true then
  245. function noleft()
  246. speed = memory.readwordsigned(0x7000B4)
  247. if speed < 0 and memory.readbyte(0x7000AC) == 0 then
  248. memory.writeword(0x7000B4,0)
  249. end
  250. end
  251. print("NoLeftMode is ON")
  252. else
  253. function noleft()
  254. end
  255. print("NoLeftMode is OFF")
  256. end
  257. -------------------------------------------------
  258. -------------------------------------------------
  259. if DrunkMode == true then
  260. function drunk()
  261. if memory.readbyte(0x7E0118) == 16 or memory.readbyte(0x7E0118) == 57 then
  262. memory.writeword(0x701FE8, 0)
  263. else
  264. memory.writeword(0x701FE8, 10)
  265. end
  266. end
  267. print("Drunk Mode is ON")
  268. else
  269. function drunk()
  270. end
  271. print("Drunk Mode is OFF")
  272. end
  273. -------------------------------------------------
  274. -------------------------------------------------
  275. if HardMode == true then
  276. timerreset = 1
  277. function hardmode()
  278. gamemode = memory.readbyte(0x7E0118)
  279. hit = memory.readbyte(0x701960)
  280. if hit == 85 and timerreset == 0 and gamemode == 15 then
  281. memory.writeword(0x7E03B6, 1)
  282. timerreset = 1
  283. elseif hit ~= 85 and timerreset == 1 then
  284. timerreset = 0
  285. memory.writeword(0x7E03B6, 100)
  286. end
  287. end
  288. print("Hard Mode is ON")
  289. else
  290. function hardmode()
  291. end
  292. print("Hard Mode is OFF")
  293. end
  294. -------------------------------------------------
  295. -------------------------------------------------
  296. if ForceRetry == true then
  297. function forceretry()
  298. memory.writebyte(0x704094, 0)
  299. memory.writebyte(0x7E0379, 1)
  300. end
  301. print("Force Retry Mode is ON")
  302. else
  303. function forceretry()
  304. end
  305. print("Force Retry Mode is OFF")
  306. end
  307. -------------------------------------------------
  308. -------------------------------------------------
  309. if DeathTimer == true then
  310. function deathtimer()
  311. startimer = memory.readword(0x7E03B6)
  312. gamemode = memory.readbyte(0x7E0118)
  313. if gamemode ~= 15 then
  314. die = 1
  315. end
  316. if startimer == 0 and die == 1 and gamemode == 15 then
  317. memory.writebyte(0x7000AC, 40)
  318. memory.writebyte(0x7001B0, 40)
  319. memory.writebyte(0x7001D2, 34)
  320. memory.writebyte(0x002140, 07)
  321. die = 0
  322. end
  323. end
  324. print("Death Timer Mode is ON")
  325. else
  326. function deathtimer()
  327. end
  328. print("Death Timer Mode is OFF")
  329. end
  330. -------------------------------------------------
  331. -------------------------------------------------
  332. if AlwaysExtendedFlutter == true then
  333. function extendedflutter()
  334. mario = memory.readbyte(0x7E0205)
  335. if mario == 1 then
  336. memory.writebyte(0x7000D3, 128)
  337. end
  338. end
  339. print("Always Extended Flutter is ON")
  340. else
  341. function extendedflutter()
  342. end
  343. print("Always Extended Flutter is OFF")
  344. end
  345. -------------------------------------------------
  346. -------------------------------------------------
  347. if NoTongue == true then
  348. function notongue()
  349. memory.writebyte(0x700162, 126)
  350. end
  351. print("No Tongue Mode is ON")
  352. else
  353. function notongue()
  354. end
  355. print("No Tongue Mode is OFF")
  356. end
  357. -------------------------------------------------
  358. -------------------------------------------------
  359. if NoFlutter == true then
  360. function noflutter()
  361. memory.writebyte(0x7000D2, 0)
  362. end
  363. print("No Flutter Mode is ON")
  364. else
  365. function noflutter()
  366. end
  367. print("No Flutter Mode is OFF")
  368. end
  369. -------------------------------------------------
  370. ------------------------------------------------- -- Boss cutscenes are very slow, fix if people think it's a problem.
  371. if Velcro == true then
  372. function velcromode()
  373. if memory.readbyte(0x7000C0) == 0 and memory.readbyte(0x7E0118) == 15 and math.abs(memory.readwordsigned(0x7000B4)) > 20 then
  374. memory.writeword(0x7000B4,0)
  375. end
  376. end
  377. print("Velcro Mode is ON")
  378. else
  379. function velcromode()
  380. end
  381. print("Velcro Mode is OFF")
  382. end
  383. -------------------------------------------------
  384. -------------------------------------------------
  385. if AlwaysFilledMouth == false then
  386. function mouthmode()
  387. end
  388. print("Always Filled Mouth is OFF")
  389. else
  390. if AlwaysFilledMouth == melon or AlwaysFilledMouth == melons or AlwaysFilledMouth == seeds or AlwaysFilledMouth == melonseeds or AlwaysFilledMouth == melonseed then
  391. mouth_var = 3
  392. end
  393. if AlwaysFilledMouth == bubble or AlwaysFilledMouth == bubbles then
  394. mouth_var = 2
  395. end
  396. function mouthmode()
  397. memory.writebyte(0x700162, 89)
  398. memory.writebyte(0x70016A, AlwaysFilledMouth)
  399. memory.writebyte(0x700170, 30)
  400. end
  401. print("Always Filled Mouth is ON")
  402. end
  403. -------------------------------------------------
  404. -------------------------------------------------
  405. if FullEggsStart == true then
  406. function eggstransitions()
  407. gamemode = memory.readbyte(0x7E0118)
  408. if gamemode == 12 then
  409. eggcount = memory.readbyte(0x7E5D98)
  410. for i = 0, eggcount, 2 do
  411. memory.writebyte(0x7E5D9A + i, memory.readbyte(0x7E5D9A + i))
  412. end
  413. for i = eggcount, NumberOfEggs, 2 do
  414. memory.writebyte(0x7E5D9A+i, EggType)
  415. end
  416. if eggcount > NumberOfEggs then
  417. memory.writebyte(0x7E5D98, eggcount)
  418. else
  419. memory.writebyte(0x7E5D98, NumberOfEggs)
  420. end
  421. end
  422. end
  423. print("Always Start With Full Eggs is ON -", NumberOfEggs/2, "eggs")
  424. else
  425. function eggstransitions()
  426. end
  427. print("Always Start With Full Eggs is OFF")
  428. end
  429. -------------------------------------------------
  430. -------------------------------------------------
  431. if FastModeX == true then
  432. speedmodifierx = 1000 - SpeedBoostX*100
  433. function fastmodex()
  434. if memory.readbyte(0x7E0118) == 15 and memory.readbyte(0x7E0387) == 0 then
  435. xspeed = memory.readwordsigned(0x7000B4)
  436. xposition = memory.readwordsigned(0x70008c)
  437. memory.writeword(0x70008c, xposition + xspeed/speedmodifierx)
  438. end
  439. end
  440. print("Fast Mode is ON - Speed:",SpeedBoostX)
  441. else
  442. function fastmodex()
  443. end
  444. print("Fast Mode is OFF")
  445. end
  446. -------------------------------------------------
  447. -------------------------------------------------
  448. if FastModeY == true then
  449. speedmodifiery = 1000 - SpeedBoostY*100
  450. function fastmodey()
  451. if memory.readbyte(0x7E0118) == 15 and memory.readbyte(0x7E0387) == 0 then
  452. yspeed = memory.readwordsigned(0x7000AA)
  453. yposition = memory.readwordsigned(0x700090)
  454. memory.writeword(0x700090, yposition + yspeed/speedmodifiery)
  455. end
  456. end
  457. print("Fast Mode is ON - Speed:",SpeedBoostY)
  458. else
  459. function fastmodey()
  460. end
  461. print("Fast Mode is OFF")
  462. end
  463. -------------------------------------------------
  464. -------------------------------------------------
  465. ------------------MAIN---------------------------
  466. while true do
  467. --
  468. LevelBlitz()
  469. noleft()
  470. drunk()
  471. hardmode()
  472. deathtimer()
  473. forceretry()
  474. extendedflutter()
  475. notongue()
  476. noflutter()
  477. velcromode()
  478. mouthmode()
  479. eggstransitions()
  480. fastmodex()
  481. fastmodey()
  482. --
  483. emu.frameadvance()
  484. end
  485. -- END MAIN --
  486. -- Made by Arnethegreat - message me on #yoshi @ irc.speeddemosarchive.com if you want anything
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement