Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- --- CONFIG ---
- -- options are (case sensitive):
- -- A, B, start, select, left, up, down, right
- pattern1_first_button = "select"
- pattern1_second_button = "left"
- pattern2_first_button = "select"
- pattern2_second_button = "up"
- pattern3_first_button = "select"
- pattern3_second_button = "right"
- pattern4_first_button = "select"
- pattern4_second_button = "down"
- --- CODE ---
- pattern1 = 3
- pattern2 = 5
- pattern3 = 7
- pattern4 = 7
- MAX = 4
- current_pattern = pattern1
- current_pattern_num = 1
- change_flag = false
- byte_write_val = 0
- selection_cooldown = 0
- waiting_flag = true
- while true do
- inputs = joypad.get(1)
- -- emu.print(inputs)
- selection_cooldown = selection_cooldown + 1
- if inputs[pattern1_first_button] and inputs[pattern1_second_button] and selection_cooldown > 15 then
- if pattern1 == 3 then
- pattern1 = 5
- elseif pattern1 == 5 then
- pattern1 = 7
- else
- pattern1 = 3
- end
- selection_cooldown = 0
- elseif inputs[pattern2_first_button] and inputs[pattern2_second_button] and selection_cooldown > 15 then
- if pattern2 == 3 then
- pattern2 = 5
- elseif pattern2 == 5 then
- pattern2 = 7
- else
- pattern2 = 3
- end
- selection_cooldown = 0
- elseif inputs[pattern3_first_button] and inputs[pattern3_second_button] and selection_cooldown > 15 then
- if pattern3 == 3 then
- pattern3 = 5
- elseif pattern3 == 5 then
- pattern3 = 7
- else
- pattern3 = 3
- end
- selection_cooldown = 0
- elseif inputs[pattern4_first_button] and inputs[pattern4_second_button] and selection_cooldown > 15 then
- if pattern4 == 3 then
- pattern4 = 5
- elseif pattern4 == 5 then
- pattern4 = 7
- else
- pattern4 = 3
- end
- selection_cooldown = 0
- end
- gui.text(120,9,"Pattern: "..pattern1..", "..pattern2..", "..pattern3..", "..pattern4)
- gui.text(120,19,"Current pattern: #"..current_pattern_num.." ("..current_pattern..")")
- waiting_flag = memory.readbyte(0x0458) == 0
- if waiting_flag then
- gui.text(120,29,"Waiting to start fight...")
- fight_start = false
- else
- if fight_start == false then
- current_pattern = pattern1
- current_pattern_num = 1
- change_flag = false
- if current_pattern == 3 then
- byte_write_val = 255
- elseif current_pattern == 5 then
- byte_write_val = 202
- elseif current_pattern == 7 then
- byte_write_val = 0
- end
- memory.writebyte(0x00E4, 0)
- memory.writebyte(0x00E5, 255)
- memory.writebyte(0x00E6, byte_write_val)
- memory.writebyte(0x00E7, 0)
- fight_start = true
- end
- wily_pattern_num = memory.readbyte(0x009b)
- wily_pattern_change = false
- if wily_pattern_num ~= 191 then
- -- emu.print("Set wily_pattern_change")
- wily_pattern_change = true
- end
- if wily_pattern_num == 191 then
- change_flag = true
- -- emu.print("Set change_flag")
- end
- if wily_pattern_change and change_flag then
- emu.print("Change value")
- if current_pattern_num == MAX then
- current_pattern_num = 1
- else
- current_pattern_num = current_pattern_num + 1
- end
- if current_pattern_num == 1 then
- current_pattern = pattern1
- elseif current_pattern_num == 2 then
- current_pattern = pattern2
- elseif current_pattern_num == 3 then
- current_pattern = pattern3
- elseif current_pattern_num == 4 then
- current_pattern = pattern4
- end
- if current_pattern == 3 then
- byte_write_val = 255
- elseif current_pattern == 5 then
- byte_write_val = 202
- elseif current_pattern == 7 then
- byte_write_val = 0
- end
- -- set rng
- -- emu.print("Unset change_flag")
- change_flag = false
- end
- memory.writebyte(0x00E4, 0)
- memory.writebyte(0x00E5, 255)
- memory.writebyte(0x00E6, byte_write_val)
- memory.writebyte(0x00E7, 0)
- end
- emu.frameadvance()
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement