Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- itools = dofile('lib_input_tools.lua')
- core = dofile('lib_core.lua')
- mm = dofile('MM Functions.lua')
- function v_advance(amount)
- for i = 1, amount, 1 do
- itools.vframe_advance()
- end
- end
- function v_advance_press_A(amount)
- for i = 1, amount, 1 do
- itools.vframe_advance({['A']=true})
- end
- end
- function v_advance_press_B(amount)
- for i = 1, amount, 1 do
- itools.vframe_advance({['B']=true})
- end
- end
- function v_advance_press_C_Up(amount)
- for i = 1, amount, 1 do
- itools.vframe_advance({['C Up']=true})
- end
- end
- mm_version = 'English'
- if mm_version == 'English' then
- text_active_address = 0x3FD338
- ----text_active_address = 0x3FD33B
- elseif mm_version == 'JP 1.0' then
- text_active_address = 0x3FD508
- ----text_active_address = 0x3FD50B
- else
- error("INPUT ERROR: invalid value mm_version")
- end
- counter = 0
- print('MM Version is ' .. mm_version)
- stored_a1 = mainmemory.readbyte(text_active_address)
- stored_a2 = mainmemory.readbyte(text_active_address + 1)
- stored_a3 = mainmemory.readbyte(text_active_address + 2)
- stored_a4 = mainmemory.readbyte(text_active_address + 3)
- text_type_changed = false
- while counter < 100 do
- text_open = false
- frame_count = 0
- text_triggered = false
- done = false
- while done == false do
- a1 = mainmemory.readbyte(text_active_address)
- a2 = mainmemory.readbyte(text_active_address + 1)
- a3 = mainmemory.readbyte(text_active_address + 2)
- a4 = mainmemory.readbyte(text_active_address + 3)
- if frame_count == 0 then
- stored_a1 = a1
- stored_a2 = a2
- stored_a3 = a3
- stored_a4 = a4
- end
- --print('a1 is ' .. a1 .. 'in theory')
- if (a1 ~= 0 or a2 ~= 0 or a3 ~= 0 or a4 ~=0) and frame_count%2 == 0 then
- ----if a1 ~= 0 and frame_count%2 == 0 then
- text_open = true
- text_triggered = true
- v_advance_press_A(1)
- itools.clear_inputs()
- frame_count = frame_count + 1
- --print('option 1 (if)')
- ----elseif a1 ~= 0 and frame_count%2 == 1 then
- elseif (a1 ~= 0 or a2 ~= 0 or a3 ~= 0 or a4 ~=0) and frame_count%2 == 1 then
- text_open = true
- text_triggered = true
- v_advance_press_C_Up(1)
- itools.clear_inputs()
- frame_count = frame_count + 1
- --print('option 2 (elseif)')
- else
- v_advance(1)
- text_open = false
- --print('option 3 (else)')
- end
- --if text_open then
- --
- -- v_advance_press_A(1)
- -- itools.clear_inputs()
- -- frame_count = frame_count + 1
- --
- -- end
- if a1 ~= stored_a1 or a2 ~= stored_a2 or a3 ~= stored_a3 or a4 ~= stored_a4 then
- text_open = false -- just to get it to trigger the next if statement when the text type changes values
- text_type_changed = true
- stored_text_type = " " .. bizstring.hex(stored_a1) .. bizstring.hex(stored_a2) .. bizstring.hex(stored_a3) .. bizstring.hex(stored_a4)
- end
- if text_open == false and text_triggered == true then
- print(frame_count)
- text_triggered = false
- done = true
- end
- end
- print('done, counter = '.. counter .. ' stored text type: ' .. stored_text_type)
- counter = counter + 1
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement