Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- rng_address = 0x02060E06
- lucky_chance = 3 --(out of 100)
- lucky_chance_high = 6
- v_space = 9
- base = 6 --value x to display rng % x (number of enemies)
- Mario_target = 7 --#RNG value that determines Mario's target
- Luigi_target = 6 --#RNG value that determines Luigi's target
- target = 1 --# of target enemy (0-5)
- yorng = 43653
- function BitAND(a,b)--Bitwise and
- p,c = 1,0
- while a>0 and b>0 do
- local ra, rb = a%2, b%2
- if ra+rb > 1 then
- c = c+p
- end
- a, b, p = (a-ra)/2, (b-rb)/2, p*2
- end
- return c
- end
- function nextRNG(seed)--RNG algorithm
- return BitAND(math.floor(seed*20.5), 0x7fff) + seed%2*0x8000
- end
- function fn()
- rng = memory.readword(rng_address)--get current (most recently used) RNG
- gui.text(0, -190, rng, "red")--display current RNG
- frameFoundM = false
- frameFoundL = false
- for i = 1,20 do --for each next 20 RNG values
- rng = nextRNG(rng)-- find next RNG value
- color = ""
- if rng%100 < lucky_chance then
- color = "#FFFF00"
- elseif rng%100 < lucky_chance_high then
- color = "#FFAA00"
- end
- gui.text(0, i*v_space-190, rng, color)
- if rng == yorng then
- gui.text(69, i*v_space-190, "yoooo")
- end
- if base == 2 then
- rngmod = rng%8/4
- else
- rngmod = rng%base
- end
- gui.text(250, (i-1)*v_space-190, rng%base)
- gui.text(240, (Mario_target-1)*v_space-190, "M", "red")
- if i >= Mario_target and rng%base == target and frameFoundM == false then
- frameFoundM = true
- gui.text(244, 0, i-Mario_target, "red")
- end
- gui.text(240, (Luigi_target-1)*v_space-190, "L", "green")
- if i >= Luigi_target and rng%base == target and frameFoundL == false then
- frameFoundL = true
- gui.text(244, 10, i-Luigi_target, "green")
- end
- end
- end
- gui.register(fn)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement