Advertisement
Arnethegreat

Silly Willy lava mode race

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