package.path = "./commands/?.lua;"
console.clear()
movement = loadfile('movement.lua')
m = movement()
scriptName = "Script6"

-- using substitute to lower vaporeon's hp
custom1= {
    {'u', 1}, -- realign
    {'w', 30},
    {'l', 1},
    {'spin_fast', 50}, -- start a battle
    {'l', 7}, -- use substitute and run
    {'u', 5},
    {'w', 60},
    {'press_a', 1},
    {'d', 1},
    {'use_move', 1},
    {'d', 1},
    {'r', 1},
    {'w', 60},
    {'press_a', 1},
    {'w', 900}, -- done
}
-- saturn routine to do hyper -> antidote -> xspec -> antidote
custom2 = {
    {'press_a', 1}, -- open bag
{'w', 120},
{'u', 1}, -- up to medicine
{'press_a', 1},
{'w', 120},
{'r', 1},
{'d', 5},
{'u', 1}, -- align on hyper 
{'w', 60},
{'press_a', 1}, --
{'w', 30},
{'press_a', 1}, -- use hyper on vaporeon
{'w', 180},
{'press_a', 1},
{'w', 1800}, -- wait for turn to pass potentially
{'press_b', 20}, -- align
{'press_a', 1}, -- open bag
{'w', 240},
{'d', 1}, -- to status healers
{'w', 60},
{'press_a', 1}, 
{'w', 120},
{'press_a', 1}, -- use antidote
{'w', 60},
{'press_a', 1},
{'w', 240},
{'press_a', 1}, -- on vaporeon
{'w', 1200},
{'press_b', 20}, -- pass turn and align
{'w', 60},
{'press_a', 1}, -- open bag
{'w', 180},
{'r', 1},
{'w', 60},
{'press_a', 1},
{'w', 120},
{'u', 1}, -- align against xspec
{'w', 60},
{'press_a', 1},
{'w', 60},
{'press_a', 1},
{'w', 2040}, -- use xspec
{'press_b', 17}, -- done
{'press_a', 1}, -- open bag
{'w', 60},
{'l', 1}, -- back to antidote
{'w', 60},
{'press_a', 1},
{'w', 60},
{'press_a', 1},
{'w', 120},
{'press_a', 1},
{'w', 120},
{'press_a', 1},
{'w', 1920}, -- used antidote
{'press_b', 27}, -- aligned

}
a = {
    {'save', '00-StartofScript6'},
    {'w', 60},
    {'r', 4}, -- leave canalave gym
    {'w', 180},
    {'r', 3},
    {'d', 4},
    {'w', 240},
    {'d', 3},
    {'l', 4},
    {'w', 300},
    {'l', 3},
    {'u', 4},
    {'w', 240},
    {'u', 3},
    {'r', 6},
    {'w', 360},
    {'d', 18},
    {'r', 10},
    {'d', 3},
    {'w', 540},
    {'press_b', 16}, -- done
    {'l', 2}, -- go to library
    {'d', 2},
    {'l', 3},
    {'u', 10},
    {'r', 3},
    {'u', 6},
    {'w', 60},
    {'press_a', 1},
    {'press_b', 11},
    {'u', 2},
    {'w', 540},
    {'u', 7},
    {'l', 2},
    {'w', 540},
    {'d', 3},
    {'r', 8},
    {'u', 3},
    {'l', 2},
    {'w', 540}, -- the villains are terrorists send in the 10 year olds
    {'press_b', 180}, -- done listening to professor talk about the lakes
    {'l', 2}, -- leave library
    {'u', 3},
    {'l', 3},
    {'u', 3},
    {'r', 2},
    {'w', 540},
    {'d', 3},
    {'l', 8},
    {'u', 3},
    {'r', 2},
    {'w', 540},
    {'d', 9},
    {'w', 540},
    {'press_b', 41}, -- lake time //21-OutsideLibrary
    {'save', '01-outsideLibrary'},

    {'x', 15}, -- realign memory mail
    {'w', 60},
    {'d', 1},
    {'press_a', 1},
    {'w', 60},
    {'l', 1},
    {'w', 60},
    {'l', 1},
    {'w', 60},
    {'l', 1},
    {'w', 60},
    {'u', 7},
    {'d', 4},
    {'w', 60},
    {'press_a', 1},
    {'w', 300},
    {'press_b', 1},
    {'w', 120},
    {'press_a', 1},
    {'d', 2},
    {'press_a', 1},
    {'w', 240},
    {'press_a', 1},
    {'w', 240},
    {'press_a', 1},
    {'w', 120},
    -- second mail alignment
    {'press_a', 1},
    {'w', 120},
    {'press_b', 1},
    {'w', 60},
    {'press_a', 1},
    {'d', 2},
    {'press_a', 1},
    {'w', 240},
    {'press_a', 1},
    {'w', 240},
    {'press_a', 1},
    {'press_b', 8}, -- done aligning mail

    {'x', 15}, -- back to lake verity for vaporeon nature 
    {'w', 60},
    {'u', 1},
    {'press_a', 1},
    {'w', 60},
    {'r', 1},
    {'d', 1},
    {'press_a', 1},
    {'d', 1},
    {'press_a', 1},
    {'w', 60},
    {'d', 5},
    {'r', 2},
    {'w', 60},
    {'press_a', 1},
    {'w', 900}, -- done
    {'x', 15},
    {'w', 60},
    {'press_a', 1},
    {'w', 60},
    {'r', 1},
    {'press_a', 1},
    {'d', 2},
    {'press_a', 1},
    {'l', 1},
    {'press_a', 1},
    {'w', 240},
    {'press_b', 8},

{'u', 2},
{'w', 240},
{'u', 2},
{'r', 1},
{'w', 60},
{'press_a', 1},
{'press_b', 14},
{'d', 4},
{'w', 540},
{'l', 5},
{'u', 6},
{'l', 2},
{'u', 29},
{'l', 31},
{'u', 12},
{'w', 540},
{'u', 7},
{'l', 2},
{'u', 4},
{'r', 2},
{'w', 60},
{'u', 2},
{'w', 60}, -- idling
{'custom1', 3}, -- health to around 25%
{'save', '02-BeforeMemoryMail'},

{'x', 15}, -- put iapapa berry on vaporeon
{'w', 60},
{'d', 1},
{'press_a', 1},
{'w', 60},
{'u', 10},
{'w', 60},
{'l', 1},
{'w', 60},
{'d', 26},
{'u', 9},
{'press_a', 1},
{'d', 2},
{'press_a', 1},
{'w', 240},
{'press_a', 1},
{'w', 180},
{'press_a', 1},
{'w', 120},
{'press_a', 1},
{'w', 120},
{'press_a', 1},
{'w', 240},
{'r', 2},
{'w', 60},
{'press_b', 8}, -- done


    {'u', 1}, -- get into battle
    {'w', 30},
    {'l', 1},
    {'spin_fast', 50}, 
    {'w', 500}, -- berry triggers, potential confusion
    {'l', 4},
    {'u', 4}, -- align
    
    {'d', 1}, -- use a full heal
    {'press_a', 1},
    {'w', 240},
    {'d', 1},
    {'press_a', 1},
    {'w', 240},
    {'d', 3},
    {'r', 1},
    {'press_a', 1},
    {'u', 3},
    {'press_a', 2},
    {'w', 240},
    {'press_a', 1},
    {'w', 1800}, -- done, waiting 
    {'r', 1}, -- run away in full heal seeds
    {'w', 60},
    {'press_a', 1},
    {'w', 1260}, -- done
    {'x', 15}, -- toss mail if we ran
    {'w', 60},
    {'press_a', 1},
    {'w', 240}, 

    {'w', 60},
    {'press_a', 1},
    {'w', 60},
    {'d', 2},
    {'press_a', 1},
    {'w', 180},
    {'press_a', 1},
    {'w', 180},
    {'press_b', 9}, -- done

    {'x', 30}, -- stall full heal seeds while we run away in the others
    {'w', 30},
    {'r', 1},
    {'w', 30},
    {'x', 30},
    {'press_a', 1},
    {'w', 900},
    {'press_b', 3}, -- done //02-AfterBerry
    {'save', '03-AfterBerry'},

{'x', 15}, -- go to veilstone
{'w', 60},
{'u', 1},
{'press_a', 1},
{'w', 60},
{'r', 1},
{'d', 1},
{'press_a', 1},
{'d', 1},
{'press_a', 1},
{'w', 240},
{'u', 8},
{'r', 20},
{'w', 60},
{'press_a', 1},
{'w', 900},
{'l', 6},
{'u', 7},
{'r', 8},
{'u', 4},
{'l', 15},
{'d', 2},
{'l', 5},
{'u', 2},
{'w', 540},
{'u', 2},
{'l', 5},
{'u', 3},
{'r', 2},
{'w', 540}, -- into the berry shop

{'d', 6}, -- go shopping
{'l', 8},
{'u', 1},
{'w', 60},
{'press_a', 1},
{'w', 240},
{'press_a', 1},
{'w', 240},
{'d', 3},
{'press_a', 1},
{'w', 240},
{'u', 11},
{'press_a', 1},
{'w', 180},
{'press_a', 1},
{'w', 120},
{'press_a', 1},
{'w', 180},
{'press_a', 1},
{'d', 1},
{'press_a', 1},
{'w', 180},
{'u', 12},
{'press_a', 1},
{'w', 180},
{'press_a', 1},
{'w', 120},
{'press_a', 1},
{'w', 120},
{'press_a', 1},
{'press_b', 9},
{'r', 8},
{'u', 6},
{'l', 2},
{'w', 540},
{'u', 4},
{'l', 2},
{'w', 60},
{'press_a', 1},
{'w', 240},
{'press_a', 1},
{'w', 240},
{'d', 5},
{'press_a', 1},
{'w', 180},
{'u', 19},
{'press_a', 1},
{'w', 240},
{'press_a', 1},
{'w', 180},
{'press_a', 1},
{'w', 240},
{'press_a', 1},
{'d', 5},
{'press_a', 1},
{'w', 240},
{'u', 3},
{'press_a', 1},
{'w', 240},
{'press_a', 1},
{'w', 180},
{'press_a', 1},
{'w', 180},
{'press_b', 12},
-- breakpoint

{'u', 2}, -- purchase excess xspatks and xdef
{'r', 9},
{'d', 5},
{'l', 2},
{'w', 540},
{'u', 5},
{'l', 3},
{'w', 60},
{'press_a', 1},
{'w', 240},
{'press_a', 1},
{'w', 60},
{'d', 2},
{'w', 60},
{'press_a', 1},
{'w', 360},
{'press_a', 1},
{'w', 120},
{'press_a', 1},
{'w', 60},
{'press_a', 1},
{'w', 60},
{'press_a', 1},
{'w', 180},
{'d', 4},
{'w', 60},
{'press_a', 1},
{'w', 120},
{'u', 1},
{'w', 120},
{'press_a', 1},
{'w', 120},
{'press_a', 1},
{'w', 120},
{'press_a', 1},
{'w', 120},
{'press_a', 1},
{'w', 120},
{'press_b', 10},
{'d', 5},
{'r', 4},
{'w', 540},
{'u', 5},
{'l', 8},
{'d', 2},
{'l', 2},
{'w', 60}, -- done

{'w', 60}, -- buy an extra 2 hypers just in case 
{'press_a', 1},
{'w', 240},
{'press_a', 1},
{'w', 60},
{'d', 2},
{'w', 60},
{'press_a', 1},
{'w', 180},
{'u', 1},
{'w', 60},
{'press_a', 1},
{'w', 180},
{'press_a', 1},
{'w', 180},
{'press_a', 1},
{'w', 180},
{'press_b', 12}, -- done


{'r', 2},
{'d', 6},
{'r', 5},
{'d', 4},
{'w', 540}, -- done, got antidotes, full heals, berries

{'r', 5}, -- go heal
{'u', 2},
{'r', 15},
{'d', 5},
{'l', 8},
{'d', 6},
{'r', 6},
{'u', 2},
{'w', 540},
{'u', 6},
{'w', 60},
{'press_a', 6},
{'w', 360},
{'press_b', 18},
{'d', 8},
{'w', 540}, -- done
{'d', 2}, -- go to the lake
{'l', 6},
{'d', 6},

{'r', 10},
{'d', 12},
{'l', 3},
{'d', 10},
{'w', 540},
{'d', 10},
{'w', 540},
{'d', 18},
{'r', 9},
{'d', 12},
{'r', 2},
{'d', 11},
{'l', 3},
{'d', 6},
{'r', 8},
{'d', 6},
{'l', 15},
{'w', 60},
{'d', 14},
{'r', 4},
{'d', 6},
{'l', 5},
{'d', 2},
{'w', 60},
{'x', 15},
{'w', 60},
{'d', 1},
{'press_a', 1},
{'w', 60},
{'l', 1},
{'w', 60},
{'l', 1},
{'w', 60},
{'l', 1},
{'w', 60},
{'l', 1},
{'w', 60},
{'l', 1},
{'w', 60},
{'d', 42},
{'u', 23},
{'w', 60},
{'press_a', 2},
{'w', 120},
{'press_a', 1},
{'press_b', 8},
{'d', 28},
{'l', 10},
{'d', 7},
{'l', 3},
{'w', 60},
{'press_a', 1},
{'w', 180},
{'press_b', 7},
{'d', 7},
{'r', 6},
{'d', 8},
{'l', 8},
{'w', 540}, -- done
{'l', 13},
{'d', 2},
{'r', 2},
{'d', 4},
{'l', 7},
{'d', 3},
{'l', 3},
{'d', 4},
{'l', 2},
{'w', 60},
{'press_b', 5},
{'l', 9},
{'u', 6},
{'l', 7},
{'u', 2},
{'l', 7},
{'d', 1},
{'w', 60},
{'press_a', 1}, -- grab hp up
{'w', 180},
{'press_b', 7}, -- done



{'r', 10}, -- go to first trainer
{'d', 3},
{'r', 4},
{'d', 5},
{'l', 3},
{'d', 8},
{'l', 4},
{'d', 2},
{'l', 2},
{'d', 4},
{'w', 60}, -- done // 03-InLakeValor
{'save', '03-InLakeValor'},

{'x', 15}, -- put amulet on vaporeon
{'w', 60},
{'u', 1},
{'press_a', 1},
{'w', 60},
{'r', 1},
{'press_a', 1},
{'d', 2},
{'press_a', 1},
{'d', 1},
{'press_a', 1},
{'w', 180},
{'press_a', 1},
{'l', 1},
{'press_a', 1},
{'d', 3},
{'press_a', 2},
{'w', 240},
{'d', 37},
{'u', 1},
{'press_a', 1},
{'w', 180},
{'press_a', 1},
{'press_b', 9}, -- done

{'d', 1},
{'l', 1},
{'w', 60},
{'press_a', 2},
{'press_b', 8},
{'w', 2160}, -- fight starts

{'press_a', 1}, -- surf does 50+% damage on golbat on turn one (or just crit KOs)
{'use_move', 1},
{'w', 900}, -- extra wait time in case we crit KO
{'x', 60},
{'d', 1}, -- this input could potentially be moving us around in the overworld so we open the start menu
{'w', 30},
{'x', 60},
{'press_a', 1},
{'w', 180},
{'x', 60},
{'d', 1},
{'w', 30},
{'x', 60},
{'press_a', 1},
{'x', 60},
{'d', 3},
{'r', 1},
{'w', 30},
{'x', 60},
{'press_a', 1},
{'x', 60},
{'u', 3}, -- potential full heal usage to clear confusion
{'w', 30},
{'x', 60},
{'press_a', 2},
{'w', 180},
{'press_a', 1},
{'w', 1980},
{'press_b', 19},
{'x', 60},
{'l', 6},
{'u', 9},
{'w', 30},
{'x', 60},
{'press_a', 1},
{'use_move', 1}, -- done
{'press_b', 12},

{'r', 2}, -- reset start
{'d', 2},
{'w', 60},
{'reset_start', 1}, -- done
{'press_b', 4},

{'r', 3}, -- go to cave
{'d', 4},
{'r', 6},
{'u', 2},
{'r', 5},
{'u', 3},
{'r', 3},
{'u', 2},
{'w', 540}, -- done
{'x', 15}, -- heal vaporeon
{'w', 60},
{'u', 4},
{'press_a', 1},
{'w', 240},
{'r', 1},
{'w', 60},
{'u', 24},
{'d', 12},
{'press_a', 2},
{'w', 240},
{'press_a', 1},
{'w', 300},
{'press_b', 12}, -- done

{'u', 9}, -- go to corner of cave
{'l', 7},
{'u', 17},

{'w', 60}, -- done
{'x', 15}, -- check mail to see which berry to equip
{'w', 60},
{'press_a', 1},
{'w', 60},
{'r', 1},
{'w', 60},
{'r', 1},
{'w', 60},
{'r', 1},
{'w', 60},
{'d', 18},
{'r', 1},
{'w', 60},
{'d', 3},
{'press_a', 1},
{'w', 300},
{'press_b', 1}, -- desynced

{'w', 60}, -- put iapapa berry on non -def vapors
{'l', 1},
{'w', 60},
{'u', 9},
{'w', 60},
{'press_a', 1},
{'d', 2},
{'press_a', 1},
{'w', 240},
{'press_a', 1},
{'w', 180},
{'press_a', 1},
{'w', 180},
{'press_a', 1},
{'w', 180},
{'press_a', 1},
{'w', 60},

{'press_b', 1},
{'w', 240}, -- done
{'x', 15}, -- close menu in one parallel universe, open it in the other
{'w', 60},

{'w', 60}, -- equip aguav berry in -def universes
{'press_a', 1},
{'w', 300},
{'l', 1},
{'w', 120},
{'u', 10},
{'press_a', 1},
{'w', 60},
{'d', 2},
{'press_a', 1},
{'w', 300},
{'press_a', 1},
{'w', 180},
{'press_a', 1},
{'w', 180},
{'press_a', 1},
{'w', 120},
{'press_a', 1},
{'w', 120},
{'press_b', 8},
{'u', 7}, -- align
{'w', 60}, -- done //04-BeforeSaturn
{'save', '04-BeforeSaturn'},

{'x', 15}, -- manage equipped items, amulet on infernape, pecha berry on hippo, xp share or togekiss
{'w', 60},
{'u', 1},
{'press_a', 1},
{'w', 240},
{'r', 1},
{'press_a', 1},
{'d', 2},
{'press_a', 2},
{'w', 60},
{'d', 23},
{'u', 20},
{'press_a', 1},
{'w', 240},
{'press_a', 1},
{'w', 60},
{'l', 1},
{'d', 1},
{'press_a', 1},
{'d', 2},
{'press_a', 2},
{'w', 60},
{'l', 1},
{'w', 60},
{'l', 1},
{'w', 60},
{'l', 1},
{'w', 60},
{'l', 1},
{'w', 60},
{'d', 17},
{'u', 1},
{'press_a', 1},
{'w', 300},
{'press_a', 1},
{'r', 1},
{'press_a', 1},
{'d', 3},
{'press_a', 2},
{'w', 240},
{'d', 11},
{'u', 1},
{'press_a', 1},
{'w', 240},
{'press_a', 1},
{'w', 180},
{'press_a', 1},
{'w', 120},
{'press_a', 1},
{'press_b', 12}, -- done 

{'d', 14}, -- go to saturn
{'r', 7},
{'d', 2},
{'w', 60},
{'press_a', 1},
{'press_b', 23},
{'w', 1980}, -- battle begins

-- breakpoint
{'u', 2}, -- align
{'l', 1}, -- go tobag
{'w', 60},
{'press_a', 1}, 
{'w', 240},
{'r', 1},
{'d', 1},
{'press_a', 1},
{'w', 120},
{'r', 1},
{'press_a', 1},
{'w', 60},
{'press_a', 1}, -- use xdef
{'w', 1980}, -- done
{'press_a', 1}, -- open bag again
{'w', 240},
{'l', 1}, -- use an antidote
{'press_a', 1},
{'w', 120},
{'d', 1},
{'w', 60},
{'press_a', 2},
{'w', 360},
{'press_a', 1},
{'w', 1980}, -- done
{'press_b', 20},
{'press_a', 1}, -- open bag
{'w', 240},
{'r', 1},
{'press_a', 1},
{'w', 180},
{'l', 1},
{'d', 1},
{'w', 60},
{'press_a', 2}, 
{'w', 1800}, -- use xspeed
{'press_a', 1}, -- open bag
{'w', 60},
{'l', 1},
{'press_a', 1},
{'w', 60},
{'press_a', 2},
{'w', 240},
{'press_a', 1},
{'w', 180},
{'press_b', 5},
{'w', 1980}, -- antidote again
{'press_b', 16},
{'custom2', 2}, -- use 2 special attacks

{'press_a', 1}, -- use hyper
{'w', 120},
{'u', 1},
{'press_a', 1},
{'w', 120},
{'press_a', 1},
{'w', 60},
{'press_a', 1},
{'w', 180},
{'press_a', 1},
{'w', 1980}, -- done
{'press_b', 27},
{'press_a', 1}, -- use antidote
{'w', 180},
{'d', 1},
{'w', 60},
{'press_a', 1},
{'w', 240},
{'press_a', 1},
{'w', 60},
{'press_a', 1},
{'w', 240},
{'press_a', 1},
{'w', 1980}, -- done
{'press_b', 19},
{'press_a', 1}, -- use full heal, basically guarenteed to go off since we've been passing the whole time and confusion persists
{'w', 120},
{'press_a', 1},
{'w', 180},
{'d', 2},
{'w', 60},
{'r', 1},
{'w', 60},
{'press_a', 1},
{'w', 60},
{'u', 3},
{'press_a', 1},
{'w', 60},
{'press_a', 1},
{'w', 180},
{'press_a', 1},
{'w', 1560}, -- done
{'press_b', 27},
{'u', 1},
{'press_a', 1},
{'use_move', 1}, -- finally, surf
{'w', 600},
{'press_a', 1}, -- send out infernape
{'w', 240},
{'d', 1},
{'w', 60},
{'press_a', 2},
{'w', 1980},  
{'press_a', 1},
{'d', 1},
{'r', 1},
{'use_move', 1}, -- flamthrower
{'w', 720},
{'press_a', 1},
{'w', 240},
{'r', 1},
{'w', 60},
{'press_a', 2},
{'w', 2340}, -- send out hippo

{'l', 1}, -- use guard spec then earthquake for the OHKO
{'w', 60},
{'press_a', 1},
{'w', 120},
{'r', 1},
{'w', 60},
{'press_a', 1},
{'w', 60},
{'d', 2},
{'w', 60},
{'press_a', 1},
{'w', 60},
{'press_a', 1},
{'w', 1800},
{'u', 1},
{'w', 60},
{'press_a', 1},
{'w', 60},
{'r', 1},
{'w', 60},
{'use_move', 1},
-- /breakpoint
{'press_b', 25}, -- done //05-AfterSaturn
{'save', '05-AfterSaturn'},
{'x', 15}, -- use antidote on vapor
{'w', 60},
{'d', 1},
{'press_a', 1},
{'w', 240},
{'r', 1},
{'w', 60},
{'u', 21},
{'d', 5},
{'w', 60},
{'press_a', 1},
{'w', 60},
{'press_a', 1},
{'w', 240},
{'press_a', 1},
{'w', 180},
{'press_a', 1},
{'press_b', 7},
{'w', 60},
{'x', 15}, -- realign the start menu
{'w', 60},
{'press_a', 1},
{'w', 240},
{'l', 1},
{'w', 60},
{'press_b', 1},
{'w', 60},
{'u', 1},
{'w', 60},
{'press_b', 5}, -- done

{'d', 12}, -- go to lake verity
{'w', 540},
{'x', 15},
{'w', 60},
{'press_a', 1},
{'w', 60},
{'r', 1},
{'d', 1},
{'press_a', 1},
{'d', 1},
{'press_a', 1},
{'w', 240},
{'l', 17},
{'d', 4},
{'l', 2},
{'w', 60},
{'press_a', 1},
{'w', 900},
{'u', 2},
{'w', 540},
{'u', 2},
{'r', 1},
{'w', 60},
{'press_a', 1},
{'press_b', 18},
{'d', 4},
{'w', 540},
{'l', 4},
{'u', 34},
{'l', 33},
{'u', 11},
{'w', 540},
{'press_b', 11}, -- done
{'u', 2}, -- prep for first double battle
{'r', 3},
{'u', 3},
{'w', 60},
{'x', 15},
{'w', 60},
{'press_a', 1},
{'w', 60},
{'press_a', 1},
{'d', 2},
{'press_a', 1},
{'d', 1},
{'press_a', 1},
{'w', 240},
{'press_b', 1},
{'w', 240},
{'d', 1},
{'press_a', 1},
{'w', 60},
{'r', 1},
{'w', 60},
{'r', 1},
{'w', 60},
{'r', 1},
{'w', 60},
{'u', 28},
{'d', 1},
{'press_a', 2},
{'w', 120},
{'press_a', 1},
{'w', 120},
{'press_a', 1},
{'w', 120},
{'press_a', 1},
{'w', 240},
{'press_a', 1},
{'w', 120},
{'press_a', 1},
{'w', 120},
{'press_a', 1},
{'w', 120},
{'press_a', 1},
{'w', 120},
{'press_a', 1},
{'w', 240},
{'d', 1},
{'press_a', 1},
{'w', 240},
{'press_a', 1},
{'w', 120},
{'press_a', 1},
{'w', 120},
{'press_a', 1},
{'w', 120},
{'press_a', 1},
{'w', 180},
{'press_b', 9}, -- done

{'u', 1}, -- engage clowns
{'w', 540},
{'press_b', 13},
{'w', 1980},
{'press_a', 1},
{'r', 1},
{'press_a', 2},
{'w', 120},
{'press_a', 1},
{'d', 1},
{'press_a', 2},
{'w', 2160},
{'press_a', 1},
{'d', 1},
{'press_a', 1},
{'r', 1},
{'press_a', 2},
{'u', 1},
{'press_a', 2},
{'w', 2520},
{'d', 1},
{'press_a', 1},
{'w', 180},
{'d', 1},
{'r', 1},
{'press_a', 1},
{'w', 60},
{'press_a', 2},
{'w', 720},
{'d', 1},
{'press_a', 1},
{'l', 1},
{'u', 1},
{'press_a', 1},
{'r', 1},
{'d', 2},
{'press_a', 2},
{'w', 240},
{'press_a', 1},
{'w', 2160},
{'u', 1},
{'press_a', 2},
{'l', 1},
{'press_a', 1},
{'u', 1},
{'press_a', 3},
{'w', 2340},
{'press_a', 6},
{'w', 2340},
{'press_a', 6},
{'w', 2340},
{'press_b', 28}, -- done
{'save', '06-AfterFirstSetOfFights'},

{'u', 3}, -- get amulet to vapor
{'r', 3},
{'u', 3},
{'r', 3},
{'u', 2},
{'w', 60},
{'x', 15},
{'w', 60},
{'u', 1},
{'press_a', 1},
{'w', 60},
{'press_a', 1},
{'d', 2},
{'press_a', 1},
{'d', 1},
{'press_a', 1},
{'w', 120},
{'press_a', 1},
{'d', 1},
{'press_a', 1},
{'d', 3},
{'press_a', 1},
{'d', 1},
{'press_a', 1},
{'w', 120},
{'press_a', 2},
{'d', 2},
{'press_a', 1},
{'u', 1},
{'press_a', 1},
{'w', 60},
{'press_a', 1},
{'d', 3},
{'press_a', 2},
{'w', 240},
{'l', 1},
{'w', 60},
{'l', 1},
{'w', 60},
{'l', 1},
{'w', 60},
{'d', 17},
{'u', 1},
{'press_a', 1},
{'w', 240},
{'press_a', 1},
{'w', 60},
{'press_b', 7}, -- done

{'press_a', 1}, -- do both fights individually
{'w', 120},
{'press_b', 5},
{'w', 1800},
{'press_a', 1},
{'use_move', 1},
{'press_b', 21},
{'use_move', 1},
{'press_b', 12},
{'l', 2},
{'u', 2},
{'w', 360},
{'press_b', 7},
{'w', 1980},
{'press_a', 1},
{'use_move', 1},
{'press_b', 20},
{'use_move', 1},
{'press_b', 10}, -- done

{'u', 5}, -- go to mars
{'r', 4},
{'u', 1},
{'w', 60}, -- done
{'x', 15}, -- setup team for mars fight, amulet to infernape, wave incense on vapor 
{'w', 60},
{'press_a', 1},
{'w', 60},
{'press_a', 1},
{'d', 3},
{'press_a', 2},
{'w', 240},
{'d', 14},
{'u', 2},
{'press_a', 1},
{'w', 240},
{'press_a', 1},
{'w', 120},
{'press_a', 1},
{'w', 120},
{'press_a', 1},
{'w', 60},
{'d', 1},
{'press_a', 1},
{'d', 2},
{'press_a', 2},
{'w', 240},
{'d', 12},
{'u', 1},
{'press_a', 1},
{'w', 300},
{'press_a', 1},
{'w', 60},
{'press_b', 1},
{'w', 240},
{'d', 1},
{'press_a', 1},
{'w', 240},
{'r', 1},
{'w', 60},
{'u', 19},
{'d', 1},
{'press_a', 2},
{'w', 240},
{'d', 1},
{'press_a', 1},
{'w', 540},
{'press_b', 11}, -- done
{'save', '07-BeforeMars'},

--// Commander Mars
{'w', 60},
{'press_a', 1},
{'w', 60},
{'press_b', 19},
{'w', 2160}, -- fight begins
{'w', 60}, -- do first turn of battle // copied from saturn's fight lol
{'d', 1},
{'press_a', 1},
{'w', 240},
{'r', 1},
{'d', 1},
{'press_a', 1},
{'w', 60},
{'d', 1},
{'press_a', 1},
{'w', 60},
{'press_a', 1},
{'w', 1980}, -- use x speed for vaporeons that have a -speed nature (we need to attack first thanks to supersonic and flinching from bite)
{'press_a', 1},
{'w', 120},
{'l', 1},
{'press_a', 1},
{'w', 60},
{'d', 1},
{'press_a', 2},
{'w', 240},
{'press_a', 1},
{'w', 2160}, -- antidote or nothing
{'press_b', 16},
{'press_a', 1},
{'w', 180},
{'press_a', 1},
{'w', 60},
{'d', 2},
{'r', 1},
{'press_a', 1},
{'u', 3},
{'press_a', 2},
{'w', 240},
{'press_a', 1},
{'w', 1980}, -- full heal or nothing
{'press_b', 16},
{'u', 1},
{'press_a', 1},
{'use_move', 1}, -- everybody uses surf, potential KO on crit
    {'w', 360}, -- open bag and get to switch screen if needed
    {'l', 1},
{'press_a', 1},
{'w', 240},
{'press_a', 1},
{'d', 3},
{'press_a', 1},
{'u', 3},
{'d', 1},
{'press_a', 2},
{'w', 300},
{'press_a', 1},

{'w', 1980}, -- use antidote if needed
{'press_a', 1},
{'w', 240},
{'press_a', 1},
{'w', 240},
{'d', 2},
{'r', 1},
{'press_a', 1},
{'u', 3},
{'press_a', 2},
{'w', 300},
{'press_a', 1},
{'w', 1980}, -- use full heal if needed
{'press_a', 1}, -- realign on the bag
{'w', 240},
{'r', 1}, -- get to surf without leaving summary screen on switch seeds
{'d', 1},
{'w', 60},
{'press_a', 1},
{'w', 240},
{'u', 1},
{'press_a', 1},
{'use_move', 1},
{'w', 700},

{'press_a', 1}, -- align screens on vaporeon's move select
{'w', 300},
{'press_a', 1},
{'d', 1},
{'r', 1},
{'press_a', 3},
{'w', 720},
{'press_b', 3},
{'w', 60}, -- send out infernape
{'d', 1},
{'press_a', 2},
{'w', 1800}, -- xspd so we outspeed purugly
{'d', 1},
{'press_a', 1},
{'w', 180},
{'r', 1},
{'press_a', 1},
{'w', 60},
{'press_a', 2},
{'w', 1980},
{'press_a', 1},
{'w', 120},
{'l', 1},
{'press_a', 1},
{'w', 60},
{'press_a', 2},
{'w', 240},
{'press_a', 1},
{'w', 1980},
{'press_b', 15},
{'l', 2},
{'u', 2},
{'press_a', 1},
{'r', 1},
{'d', 1},
{'use_move', 1},
{'w', 540}, -- lvlup ignore
{'press_b', 2},
{'w', 1440},
{'press_b', 1},
{'w', 540},
{'press_a', 1},
{'w', 600}, -- done
{'press_b', 24},
{'w', 900},
{'press_a', 1},
{'u', 1},
{'use_move', 1}, -- protect to avoid fake out
{'press_a', 1},
{'l', 1},
{'d', 1},
{'use_move', 1}, -- close combat OHKO
{'w', 540},
{'press_b', 2}, -- ignore potential level up text for infernape
{'w', 1440},
{'press_b', 1}, -- do potential ignore of fire spin here
{'w', 540},
{'press_a', 1},
{'w', 540},
{'press_b', 56}, -- get through dialogue // 06-AfterMars
{'save', '08-AfterMars'},

{'x', 15}, -- go to veilstone department store
{'w', 60},
{'u', 1},
{'press_a', 1},
{'w', 60},
{'r', 1},
{'d', 1},
{'press_a', 1},
{'d', 1},
{'press_a', 1},
{'w', 240},
{'r', 20},
{'u', 7},
{'w', 60},
{'press_a', 1},
{'w', 900},
{'u', 2},
{'w', 540},
{'pokecenter_heal', 1},
{'press_b', 6},
{'d', 8},
{'w', 540},
{'l', 6},
{'u', 7},
{'r', 8},
{'u', 4},
{'l', 15},
{'d', 2},
{'l', 5},
{'u', 2},
{'w', 540},
{'u', 2},
{'r', 4},
{'u', 7},
{'l', 9},
{'d', 2},
{'l', 1},
{'w', 60}, -- done

{'press_a', 1}, -- buy potions and repels
{'w', 240},
{'press_a', 1},
{'w', 180},
{'d', 2},
{'press_a', 1},
{'w', 180},
{'u', 4},
{'press_a', 1},
{'w', 240},
{'press_a', 1},
{'w', 180},
{'press_a', 1},
{'w', 180},
{'press_a', 1},
{'d', 8},
{'press_a', 1},
{'w', 240},
{'u', 5},
{'press_a', 1},
{'w', 120},
{'press_a', 1},
{'w', 120},
{'press_a', 1},
{'w', 120},
{'press_a', 1},
{'press_b', 9},
{'d', 3},
{'l', 4},
{'u', 1},
{'w', 60},
{'press_a', 1},
{'w', 240},
{'press_a', 1},
{'w', 240},
{'d', 6},
{'press_a', 1},
{'w', 300},
{'u', 24},
{'press_a', 1},
{'w', 300},
{'press_a', 1},
{'w', 180},
{'press_a', 1},
{'w', 120},
{'press_a', 1},
{'press_b', 9}, -- done

{'r', 5}, -- go buy some x items
{'u', 4},
{'r', 8},
{'d', 5},
{'l', 2},
{'w', 540},
{'u', 5},
{'l', 3},
{'w', 60},
{'press_a', 1},
{'w', 240},
{'press_a', 1},
{'w', 60},
{'press_a', 1},
{'w', 240},
{'u', 3},
{'press_a', 1},
{'w', 300},
{'press_a', 1},
{'w', 120},
{'press_a', 1},
{'w', 120},
{'press_a', 1},
{'w', 60},
{'d', 3},
{'press_a', 1},
{'w', 300},
{'u', 4},
{'press_a', 1},
{'w', 120},
{'press_a', 1},
{'w', 180},
{'press_a', 1},
{'w', 240},
{'press_a', 1},
{'d', 3},
{'press_a', 1},
{'w', 60},
{'u', 3},
{'press_a', 1},
{'w', 240},
{'press_a', 1},
{'w', 180},
{'press_a', 1},
{'w', 240},
{'press_a', 1},
{'press_b', 10}, -- done

{'r', 4}, -- go buy natural gift and safeguard TMs
{'u', 2},
{'r', 7},
{'d', 6},
{'l', 2},
{'w', 540},
{'l', 3},
{'u', 3},
{'w', 60},
{'press_a', 1},
{'w', 240},
{'press_a', 1},
{'w', 60},
{'press_a', 1},
{'w', 180},
{'u', 1},
{'press_a', 1},
{'w', 240},
{'press_a', 1},
{'w', 180},
{'press_a', 1},
{'w', 240},
{'press_a', 1},
{'d', 3},
{'press_a', 1},
{'w', 240},
{'press_a', 1},
{'w', 240},
{'press_a', 1},
{'w', 180},
{'press_a', 1},
{'w', 180},
{'press_a', 1},
{'press_b', 10}, -- done

{'d', 3}, -- leave the store
{'r', 5},
{'w', 540},
{'u', 6},
{'l', 7},
{'d', 4},
{'l', 2},
{'d', 3},
{'r', 2},
{'w', 540},
{'d', 3},
{'l', 4},
{'d', 4},
{'w', 540}, -- done //07-DoneShopping
{'save', '09-DoneShopping'},

{'x', 15}, -- go to celestic, pick up machoke
{'w', 60},
{'press_a', 1},
{'w', 60},
{'r', 1},
{'d', 1},
{'press_a', 1},
{'d', 1},
{'press_a', 1},
{'w', 60},
{'l', 7},
{'u', 2},
{'press_a', 1},
{'w', 900},
{'u', 2},
{'w', 540},
{'u', 6},
{'r', 5},
{'u', 3},
{'w', 60},
{'press_a', 1},
{'w', 240},
{'press_a', 1},
{'w', 180},
{'press_a', 1},
{'w', 180},
{'press_a', 1},
{'w', 120},
{'d', 2},
{'press_a', 1},
{'w', 300}, -- done
{'r', 1}, -- get machoke
{'w', 60},
{'r', 1},
{'w', 60},
{'press_a', 2},
{'w', 60},
{'u', 1},
{'w', 60},
{'u', 1},
{'w', 60},
{'press_a', 1},
{'w', 120},
{'l', 1},
{'w', 60},
{'press_a', 1},
{'w', 60},
{'press_a', 1},
{'w', 60},
{'l', 3},
{'r', 1},
{'w', 60},
{'r', 1},
{'w', 60},
{'r', 1},
{'w', 60},
{'r', 1},
{'w', 60},
{'press_a', 1},
{'w', 60},
{'press_a', 1},
{'w', 60},
{'press_a', 1},
{'w', 60},
{'d', 2},
{'press_a', 2},
{'w', 60},
{'press_b', 18},
{'d', 3},
{'l', 5},
{'d', 8},
{'w', 540}, -- done // 08-BeforeCornet
{'save', '10-BeforeCornet'},

{'l', 11}, -- go to mount
{'d', 3},
{'l', 6},
{'u', 2},
{'l', 2},
{'u', 2},
{'l', 6},
{'u', 12},
{'l', 17},
{'d', 1},
{'w', 60},
{'x', 15},
{'w', 60},
{'d', 1},
{'press_a', 1},
{'w', 240},
{'l', 1},
{'w', 60},
{'d', 27},
{'u', 29},
{'w', 60},
{'press_a', 2},
{'w', 120},
{'press_a', 1},
{'press_b', 9},
{'d', 7},
{'l', 2},
{'w', 60},
{'press_a', 1},
{'w', 120},
{'press_b', 8},
{'l', 4},
{'u', 4},
{'l', 8},
{'u', 5},
{'l', 5},
{'u', 2},
{'l', 2},
{'w', 540},
{'l', 1},
{'u', 5},
{'r', 2},
{'u', 1},
{'w', 60}, -- idling before first big rock

{'x', 15}, -- teach the prince strength and rock smash
{'w', 60},
{'press_a', 1},
{'w', 60},
{'r', 1},
{'w', 60},
{'r', 1},
{'w', 60},
{'r', 1},
{'w', 60},
{'d', 35},
{'u', 1},
{'press_a', 2},
{'w', 120},
{'press_a', 1},
{'w', 180},
{'press_a', 1},
{'w', 120},
{'press_a', 1},
{'w', 180},
{'d', 2},
{'press_a', 1},
{'w', 180},
{'press_a', 1},
{'w', 180},
{'press_a', 1},
{'w', 180},
{'press_a', 1},
{'w', 180},
{'press_a', 1},
{'w', 180},
{'d', 2},
{'press_a', 1},
{'w', 180},
{'press_a', 1},
{'w', 180},
{'press_a', 1},
{'w', 180},
{'press_a', 1},
{'w', 180},
{'press_a', 1},
{'w', 240},
{'u', 2},
{'press_a', 2},
{'w', 120},
{'press_a', 1},
{'w', 180},
{'press_a', 1},
{'w', 120},
{'press_a', 1},
{'w', 180},
{'press_a', 1},
{'w', 180},
{'press_a', 1},
{'w', 180},
{'press_a', 1},
{'w', 180},
{'press_a', 1},
{'w', 120},
{'press_a', 1},
{'w', 180},
{'press_a', 1},
{'w', 180},
{'press_a', 1},
{'w', 180},
{'press_a', 1},
{'w', 180},
{'press_a', 1},
{'w', 120},
{'press_a', 1},
{'press_b', 11}, -- done

{'press_a', 8}, -- go get rare candy and then descend
{'w', 180},
{'press_b', 5},
{'u', 1},
{'w', 60},
{'u', 2},
{'w', 60},
{'u', 2},
{'w', 60},
{'u', 1},
{'l', 2},
{'u', 3},
{'l', 3},
{'w', 60},
{'press_a', 6},
{'w', 180},
{'l', 3},
{'w', 60},
{'press_a', 5},
{'w', 180},
{'l', 8},
{'w', 60},
{'press_a', 1},
{'w', 180},
{'press_b', 7},
{'r', 13},
{'u', 16},
{'l', 18},
{'w', 60},
{'u', 2},
{'l', 2},
{'w', 540}, -- done

{'l', 4}, -- go grab the soft sand
{'u', 2},
{'l', 2}, -- ignore the ultra ball
{'u', 20},
{'r', 3},
{'u', 10},
{'w', 60},
{'press_a', 6},
{'w', 120},
{'press_b', 2},
{'u', 4},
{'w', 60},
{'press_a', 6},
{'press_b', 5},
{'u', 1},
{'w', 60},
{'u', 1},
{'r', 2},
{'u', 3},
{'l', 2},
{'u', 3},
{'r', 2},
{'u', 4},
{'w', 60},
{'press_a', 1},
{'w', 180},
{'press_b', 7},
{'d', 4},
{'l', 2},
{'d', 3},
{'r', 2},
{'d', 3},
{'l', 2},
{'d', 14},
{'l', 3},
{'u', 26},
{'w', 60},
{'press_b', 4},
{'x', 15},
{'w', 60},
{'press_a', 1},
{'w', 60},
{'l', 1},
{'w', 60},
{'l', 1},
{'w', 60},
{'l', 1},
{'w', 60},
{'press_a', 2},
{'w', 180},
{'press_b', 8}, -- done

{'u', 1}, -- grab full restore and max elixer 
{'r', 10},
{'d', 4},
{'r', 1},
{'w', 60},
{'press_a', 5},
{'press_b', 6},
{'r', 13},
{'w', 60},
{'press_a', 1},
{'w', 180},
{'press_b', 9},
{'l', 13},
{'u', 5},
{'r', 4},
{'u', 2},
{'r', 2},
{'w', 60},
{'r', 1},
{'u', 1},
{'w', 60},
{'press_a', 1},
{'press_b', 8},
{'d', 3},
{'r', 11},
{'u', 2},
{'r', 3},
{'d', 2},
{'w', 60},
{'press_a', 5},
{'press_b', 5},
{'d', 15},
{'w', 60},
{'press_a', 6},
{'press_b', 5},
{'d', 2},
{'w', 60},
{'press_a', 1},
{'press_b', 9},
{'u', 19},
{'l', 4},
{'d', 2},
{'l', 11},
{'u', 2},
{'l', 13}, -- done
{'w', 30}, -- grab rare candy, regiice items, and bounce
{'l', 1},
{'u', 11},
{'r', 3},
{'w', 60},
{'press_a', 1},
{'press_b', 8},
{'r', 4},
{'w', 540},
{'r', 5},
{'u', 12},
{'w', 540},
{'u', 4},
{'w', 60},
{'press_a', 1},
{'press_b', 8},
{'u', 3},
{'l', 1},
{'w', 60},
{'press_a', 1},
{'press_b', 10},
{'d', 9},
{'w', 540},
{'l', 1},
{'w', 60},
{'press_a', 1},
{'press_b', 11},
{'d', 2},
{'l', 15},
{'w', 540}, -- done //09-IceRouteBegins
{'save', '11-IceRouteBegins'},

{'l', 5}, -- grab ppup, avoid first trainer
{'d', 7},
{'l', 10},
{'w', 60},
{'press_b', 4},
{'l', 7},
{'w', 60},
{'press_a', 1},
{'press_b', 8},
{'r', 13},
{'u', 8},
{'l', 10},
{'u', 2},
{'l', 1},
{'w', 60},
{'x', 15},
{'w', 60},
{'press_a', 1},
{'w', 60},
{'press_a', 2},
{'w', 60},
{'press_b', 9},
{'l', 32},
{'w', 60}, -- done

{'l', 1}, -- fight tropius girl
{'w', 360},
{'press_b', 10},
{'w', 1980},
{'press_a', 1},
{'d', 1},
{'use_move', 2},
{'press_b', 4},
{'d', 1},
{'r', 2},
{'press_a', 1},
{'w', 240},
{'d', 1},
{'press_a', 2},
{'w', 1980},
{'press_a', 1},
{'r', 1},
{'use_move', 1},
{'press_a', 1},
{'d', 1},
{'use_move', 1}, -- done
{'press_b', 35}, -- handle vaporeon xp from alt pastoria line
{'l', 13}, -- go to skier
{'w', 60},

{'x', 15}, -- give togekiss the amulet and put in front
{'w', 60},
{'u', 1},
{'press_a', 1},
{'w', 60},
{'r', 1},
{'d', 1},
{'press_a', 1},
{'d', 2},
{'press_a', 1},
{'u', 1},
{'l', 1},
{'press_a', 1},
{'w', 120},
{'press_a', 1},
{'d', 3},
{'press_a', 1},
{'d', 1},
{'press_a', 1},
{'w', 120},
{'press_a', 1},
{'d', 1},
{'press_a', 1},
{'d', 2},
{'press_a', 1},
{'d', 1},
{'press_a', 1},
{'w', 120},
{'press_a', 1},
{'u', 1},
{'press_a', 1},
{'d', 3},
{'press_a', 2},
{'w', 60},
{'d', 39},
{'u', 1},
{'press_a', 1},
{'w', 240},
{'press_b', 12}, -- done

{'l', 1}, -- fight the skier
{'w', 900},
{'press_b', 10},
{'w', 1800},
{'press_a', 1},
{'d', 1},
{'r', 1},
{'use_move', 1},
{'press_b', 13}, -- done
{'l', 13}, -- go heal
{'u', 4},
{'w', 540},
{'u', 2},
{'r', 5},
{'d', 1},
{'w', 60},
{'press_a', 4},
{'press_b', 11},
{'l', 5},
{'d', 4},
{'w', 540}, -- done

{'d', 1}, -- go to next guy
{'l', 11},
{'u', 13},
{'r', 13},
{'u', 11},
{'l', 3},
{'u', 3},
{'w', 720},
{'press_b', 30},
{'u', 1},
{'r', 3},
{'u', 6},
{'w', 60}, -- done
{'save', '12-MiddleOfIceRoute'},

{'x', 15}, -- put amulet on hippo, xp share on roselia, and move hippo to front
{'w', 60},
{'press_a', 1},
{'w', 60},
{'press_a', 1},
{'d', 3},
{'press_a', 1},
{'d', 1},
{'press_a', 1},
{'w', 180},
{'press_a', 1},
{'r', 1},
{'press_a', 1},
{'d', 2},
{'press_a', 1},
{'d', 1},
{'press_a', 1},
{'w', 180},
{'press_a', 2},
{'d', 2},
{'press_a', 2},
{'w', 60},
{'d', 9},
{'u', 1},
{'press_a', 1},
{'w', 240},
{'press_a', 1},
{'d', 2},
{'press_a', 1},
{'d', 3},
{'press_a', 2},
{'w', 60},
{'press_a', 1},
{'w', 240},
{'press_a', 1},
{'w', 60},
{'u', 2},
{'press_a', 1},
{'d', 1},
{'press_a', 1},
{'l', 1},
{'press_a', 1},
{'w', 240},
{'press_b', 10}, -- done

{'w', 60}, -- fight the electabuzz guy
{'u', 1},
{'w', 540},
{'press_b', 8},
{'w', 1800},
{'press_a', 1},
{'r', 1},
{'use_move', 1},
{'w', 540},
{'press_a', 1},
{'w', 240},
{'r', 1},
{'d', 1},
{'press_a', 2},
{'w', 1800},
{'press_a', 1},
{'use_move', 1},
{'press_b', 25}, -- done

{'d', 7}, -- go heal and then come back
{'l', 3},
{'d', 7},
{'r', 2},
{'d', 9},
{'l', 7},
{'d', 10},
{'r', 4},
{'d', 2},
{'r', 3},
{'u', 2},
{'w', 540},
{'u', 2},
{'r', 5},
{'d', 1},
{'w', 60},
{'press_a', 3},
{'press_b', 10},
{'l', 5},
{'d', 4},
{'w', 540},
{'l', 6},
{'u', 11},
{'r', 3},
{'w', 60},
{'press_b', 3},
{'r', 1},
{'w', 60},
{'press_b', 4},
{'r', 9},
{'press_b', 2},
{'r', 5},
{'w', 60},
{'l', 3},
{'u', 12},
{'l', 3},
{'u', 5},
{'r', 3},
{'u', 6},
{'w', 60}, -- done

{'u', 27}, -- go grab rock climb, hail, ice plate, and iron
{'w', 60},
{'u', 1},
{'w', 60},
{'u', 1},
{'w', 60},
{'u', 1},
{'w', 60},
{'u', 1},
{'w', 60},
{'u', 1},
{'w', 60},
{'u', 1},
{'w', 60},
{'u', 1},
{'w', 60},
{'u', 1},
{'w', 60},
{'u', 3},
{'w', 60},
{'press_a', 2},
{'press_b', 6},
{'u', 15},
{'w', 60},
{'u', 1},
{'w', 60},
{'l', 2},
{'w', 60},
{'l', 1},
{'w', 60},
{'l', 2},
{'w', 60},
{'press_a', 1},
{'w', 60},
{'press_a', 1},
{'press_b', 5},
{'l', 4},
{'u', 11},
{'w', 60},
{'u', 1},
{'w', 60},
{'l', 1},
{'w', 60},
{'press_a', 2},
{'press_b', 4},
{'d', 2},
{'w', 60},
{'d', 1},
{'w', 60},
{'d', 1},
{'w', 60},
{'d', 4},
{'l', 5},
{'u', 2},
{'w', 540},
{'u', 2},
{'w', 60},
{'press_a', 2},
{'press_b', 34},
{'d', 4},
{'w', 540}, -- done

{'r', 24}, -- go get rare candy
{'u', 3},
{'w', 60},
{'press_a', 2}, -- done
{'press_b', 7},
{'l', 18}, -- go to glaceon lady
{'u', 4},
{'r', 2},
{'w', 60},
{'u', 2},
{'w', 60},
{'u', 1},
{'w', 60},
{'u', 1},
{'w', 60},
{'u', 1},
{'w', 60},
{'u', 8},
{'w', 60},
{'u', 1},
{'w', 60},
{'u', 1},
{'w', 60},
{'u', 5},
{'w', 60},
{'u', 1},
{'w', 60},
{'l', 2},
{'w', 60},
{'l', 1},
{'w', 60},
{'l', 1},
{'w', 60},
{'l', 2},
{'w', 60}, -- idling
{'save', '12b-BeforeGlaceonLady'},
{'x', 15}, -- vapor to front
{'w', 60},
{'press_a', 1},
{'w', 240},
{'r', 1},
{'d', 1},
{'press_a', 1},
{'d', 2},
{'press_a', 1},
{'u', 1},
{'l', 1},
{'press_a', 1},
{'w', 240},
{'press_b', 10}, -- done

{'l', 1}, -- start fight
{'w', 1080},
{'press_b', 7},
{'w', 1980},
{'press_a', 1},
{'use_move', 1}, -- surf KOs
{'w', 900},
{'press_a', 16}, -- handle roselia level up here// 
{'d', 1}, -- realign shift screen
{'press_a', 1},
{'r', 2},
{'press_a', 1},
{'d', 2},
{'r', 3},
{'press_a', 1},
{'w', 60},
{'l', 2},
{'u', 2},
{'press_b', 1}, -- sync
{'w', 180},
{'w', 60},
{'r', 1},
{'d', 1},
{'press_a', 2}, -- hippowdon out to remove hail so we don't have to deal with snow cloak
{'w', 1860},
{'d', 1},
{'r', 2},
{'press_a', 1},
{'w', 240},
{'d', 1},
{'press_a', 2},
{'w', 2160}, -- infernape out to finish the job
{'press_a', 1},
{'d', 1},
{'r', 2},
{'use_move', 1},
{'press_b', 15}, -- done
{'save', '13-NearEndOfIceRoute'},

{'l', 5}, -- go to machoke guy
{'u', 6},
{'w', 60},
{'u', 1},
{'w', 60},
{'u', 1},
{'w', 2040}, -- battle starts
{'press_b', 11},
{'w', 1980},
{'press_a', 1}, -- surf the croagunk, could potentially take a sucker punch here
{'use_move', 1},
{'w', 1440},
{'press_a', 1},
{'w', 60},
{'r', 1},
{'d', 1},
{'press_a', 2}, -- hippo out
{'w', 1980},
{'press_a', 1},
{'use_move', 1}, -- yawn to prevent revenge when we hit them
{'w', 360}, -- we could potentially take a submission
{'press_a', 1}, 
{'d', 1},
{'use_move', 1}, -- protect to pass a turn until machoke sleeps
{'w', 180},
{'press_a', 1},
{'r', 1},
{'use_move', 1}, -- use crunch, won't be lethal, even in worst case (lowest def, highest atk hippo max crit crunch and machoke max crit submission for max recoil) machoke survives with enough hp to tank another sandstorm, avoiding any premature fainting. 
{'press_a', 1}, -- in the worst (best?) case, machoke survives with 7 hp, and earthquake finishes them
{'u', 1},
{'use_move', 1},
{'w', 720},
{'press_a', 1},
{'w', 60},
{'d', 1},
{'r', 1},
{'press_a', 2},
{'w', 1980}, -- send out vapor to crush riolu
{'press_a', 1},
{'use_move', 1},
{'press_b', 10}, -- done

{'u', 2}, -- trudge through the snow
{'w', 60},
{'u', 1},
{'w', 60},
{'u', 1},
{'w', 60},
{'u', 1},
{'w', 60},
{'u', 1},
{'w', 60},
{'u', 1},
{'w', 60},
{'u', 1},
{'w', 60},
{'u', 1},
{'w', 60},
{'u', 1},
{'w', 60},
{'u', 1},
{'w', 60},
{'r', 2},
{'w', 60},
{'r', 1},
{'w', 60},
{'r', 1},
{'u', 2},
{'r', 15},
{'u', 2}, -- done
{'w', 30},
{'x', 15}, -- teach togekiss safeguard (remove aura sphere) and put amulet on infernape
{'w', 60},
{'press_a', 1},
{'w', 60},
{'r', 1},
{'d', 1},
{'press_a', 1},
{'d', 2},
{'press_a', 1},
{'d', 1},
{'press_a', 1},
{'w', 240},
{'press_a', 1},
{'l', 1},
{'press_a', 1},
{'d', 2},
{'press_a', 2},
{'w', 60},
{'d', 7},
{'u', 1},
{'press_a', 1},
{'w', 300},
{'press_a', 1},
{'w', 60},
{'press_b', 1},
{'w', 300},
{'d', 1},
{'press_a', 1},
{'w', 60},
{'r', 1},
{'w', 60},
{'u', 25},
{'d', 12},
{'press_a', 2},
{'w', 60},
{'press_a', 1},
{'w', 420},
{'press_a', 1},
{'w', 240},
{'r', 1},
{'w', 60},
{'r', 1},
{'w', 60},
{'u', 34},
{'d', 3},
{'press_a', 2},
{'w', 240},
{'press_a', 1},
{'w', 120},
{'press_a', 1},
{'w', 120},
{'press_a', 1},
{'w', 120},
{'r', 1},
{'press_a', 1},
{'w', 120},
{'press_a', 1},
{'w', 120},
{'press_a', 1},
{'w', 180},
{'press_a', 1},
{'w', 120},
{'press_a', 1},
{'w', 120},
{'d', 3},
{'w', 60},
{'press_a', 1},
{'w', 360},
{'press_a', 1},
{'w', 240},
{'press_a', 1},
{'w', 120},
{'press_b', 15}, -- done
 
{'x', 15}, -- use hyper on infernape (forgot to do it earlier)
{'w', 60},
{'press_a', 1},
{'w', 60},
{'l', 1},
{'w', 60},
{'l', 1},
{'w', 60},
{'press_a', 2},
{'w', 300},
{'d', 1},
{'press_a', 1},
{'w', 240},
{'press_b', 10}, -- done

{'l', 3}, -- start fight // hmm we might have to use a hyper potion on infernape here 
{'u', 3},
{'w', 420},
{'press_b', 4},
{'w', 1980}, -- done
{'press_a', 1},
{'use_move', 1},
{'press_b', 24},
{'use_move', 1},
{'w', 720},
{'press_a', 1},
{'w', 300},
{'r', 1},
{'press_a', 2},
{'w', 1800},
{'press_a', 1},
{'r', 1},
{'d', 1},
{'use_move', 1},
{'w', 60},
{'d', 1},
{'r', 2},
{'press_a', 1},
{'w', 240},
{'r', 1},
{'press_a', 2},
{'w', 1980},
{'d', 1},
{'press_a', 1},
{'w', 240},
{'r', 1},
{'d', 1},
{'press_a', 1},
{'w', 60},
{'r', 1},
{'d', 1},
{'press_a', 2},
{'w', 2040},
{'u', 1},
{'press_a', 1},
{'r', 1},
{'d', 1},
{'press_a', 1},
{'w', 360},
{'d', 1},
{'press_a', 2},
{'w', 1800},
{'press_a', 1},
{'d', 1},
{'use_move', 1},
{'w', 960}, -- done with fight

{'press_b', 2}, -- deal with infernape learning fire spin
{'w', 1440},
{'press_b', 1},
{'w', 720},
{'press_a', 1},
{'w', 1440},
{'press_b', 23}, -- done //10-DoneWithIceRoute
{'save', '14-DoneWithIceRoute'},

{'x', 15}, -- go to snowpoint city
{'w', 60},
{'press_a', 1},
{'w', 60},
{'l', 1},
{'w', 60},
{'d', 9},
{'w', 60},
{'u', 32},
{'w', 60},
{'press_a', 2},
{'w', 240},
{'press_b', 7},
{'r', 6},
{'u', 24},
{'w', 240},
{'press_b', 20},
{'u', 1},
{'r', 9},
{'u', 4},
{'r', 8},
{'d', 3},
{'r', 12},
{'d', 3},
{'r', 8},
{'u', 7},
{'r', 12},
{'d', 6},
{'r', 9},
{'u', 5},
{'r', 5},
{'u', 14},
{'r', 4},
{'u', 2},
{'r', 5},
{'d', 2},
{'r', 3},
{'d', 9},
{'r', 5},
{'u', 2},
{'w', 540},
{'pokecenter_heal', 1},
{'press_b', 8}, -- done

{'r', 5}, -- go get valley windworks quant from pc
{'u', 3},
{'w', 60},
{'press_a', 1},
{'w', 240},
{'press_a', 1},
{'w', 120},
{'press_a', 1},
{'w', 120},
{'press_a', 1},
{'w', 120},
{'d', 2},
{'press_a', 1},
{'w', 300},
{'u', 1},
{'w', 60},
{'u', 1},
{'w', 60},
{'press_a', 1},
{'w', 120},
{'d', 1},
{'w', 60},
{'d', 1},
{'w', 60},
{'press_a', 1},
{'w', 60},
{'d', 3},
{'press_a', 1},
{'w', 240},
{'press_a', 1},
{'w', 180},
{'press_b', 1},
{'w', 180},
{'d', 1},
{'w', 60},
{'press_a', 1},
{'w', 60},
{'d', 3},
{'press_a', 1},
{'w', 240},
{'press_b', 15}, -- done, machoke stored

{'d', 3}, -- leave
{'l', 5},
{'d', 8},
{'w', 540}, -- done


{'l', 5}, -- go grab rare candy
{'u', 9},
{'l', 3},
{'u', 7},
{'r', 4},
{'w', 60},
{'r', 1},
{'w', 60},
{'r', 1},
{'w', 60},
{'r', 1},
{'w', 120},
{'r', 1},
{'w', 180},
{'press_a', 1},
{'w', 60},
{'press_b', 8},
{'l', 2},
{'w', 120},
{'l', 1},
{'w', 120},
{'l', 1},
{'w', 60},
{'l', 1},
{'w', 60},
{'l', 1},
{'w', 60},
{'l', 2},
{'w', 60}, -- done
{'press_b', 10}, -- handle repel
{'l', 2}, -- go into gym
{'d', 4},
{'l', 5},
{'u', 2},
{'w', 540}, -- done
{'l', 2}, -- run out repel
{'u', 3},
{'w', 60},
{'press_b', 5}, -- done
{'d', 3}, -- solve the silly ice puzzle
{'l', 3},
{'w', 360},
{'u', 2},
{'w', 300},
{'r', 2},
{'w', 300},
{'l', 2},
{'w', 240},
{'d', 2},
{'w', 300},
{'l', 4},
{'u', 2},
{'w', 300},
{'u', 1},
{'w', 120},
{'r', 2},
{'w', 120},
{'r', 1},
{'w', 120},
{'d', 2},
{'w', 240},
{'r', 2},
{'w', 180},
{'r', 1},
{'w', 60},
{'d', 2},
{'w', 60},
{'l', 2},
{'w', 120},
{'l', 1},
{'w', 60},
{'d', 2},
{'w', 120},
{'l', 3},
{'w', 120},
{'d', 2},
{'w', 120},
{'l', 4},
{'u', 2},
{'w', 180},
{'u', 1},
{'w', 120},
{'r', 2},
{'w', 120},
{'d', 2},
{'w', 240},
{'r', 2},
{'w', 240},
{'l', 2},
{'w', 240},
{'d', 2},
{'w', 120},
{'d', 1},
{'w', 180},
{'l', 3},
{'w', 120},
{'d', 2},
{'w', 120},
{'r', 2},
{'w', 180},
{'u', 2},
{'w', 60},
{'u', 1},
{'w', 120},
{'u', 1},
{'w', 120},
{'u', 1},
{'w', 120},
{'u', 1},
{'w', 120},
{'u', 1},
{'w', 120},
{'u', 1},
{'w', 60}, -- done // 11-BeforeCandice
{'save', '15-BeforeCandice'},

{'x', 15}, -- teach hippo stealth rock and get prepped for memory mail time
{'w', 60},
{'press_a', 1},
{'w', 60},
{'r', 1},
{'w', 60},
{'r', 1},
{'w', 60},
{'r', 1},
{'w', 60},
{'d', 35},
{'u', 13},
{'w', 60},
{'press_a', 2},
{'w', 180},
{'press_a', 1},
{'w', 120},
{'press_a', 1},
{'w', 180},
{'press_a', 1},
{'w', 240},
{'r', 1},
{'d', 1},
{'press_a', 1},
{'w', 240},
{'press_a', 1},
{'w', 240},
{'press_a', 1},
{'w', 240},
{'press_a', 1},
{'w', 180},
{'press_a', 1},
{'w', 360},
{'d', 2},
{'press_a', 1},
{'w', 360},
{'press_a', 1},
{'w', 180},
{'press_a', 1},
{'w', 60},
{'press_a', 1},
{'w', 120},
{'press_a', 1},
{'w', 300},
{'r', 1},
{'w', 60},
{'d', 33},
{'u', 10},
{'w', 60},
{'d', 1},
{'w', 60},
{'r', 1},
{'w', 60},
{'u', 10}, -- done

{'d', 3}, -- handle iapapa berry seeds
{'press_a', 1},
{'w', 300},
{'press_b', 1},
{'w', 180},
{'l', 1},
{'w', 60},
{'press_a', 1},
{'w', 60},
{'u', 3},
{'l', 1},
{'press_a', 1},
{'w', 240},
{'press_a', 1},
{'w', 360},
{'press_a', 1},
{'w', 240},
{'press_a', 1},
{'w', 240},
{'press_a', 1},
{'w', 240},
{'press_b', 1},
{'w', 240},
{'x', 15}, -- done

{'w', 60},
{'l', 1}, -- handle aguav seeds
{'press_a', 1},
{'w', 240},
{'l', 1},
{'w', 60},
{'u', 1},
{'w', 60},
{'press_a', 1},
{'u', 3},
{'press_a', 1},
{'w', 300},
{'press_a', 1},
{'w', 180},
{'press_a', 1},
{'w', 180},
{'press_a', 1},
{'w', 240},
{'press_a', 1},
{'w', 240},
{'d', 2},
{'w', 60},
{'press_b', 10}, -- done

{'x', 15}, -- put hippo in front
{'w', 60},
{'u', 1},
{'press_a', 1},
{'w', 240},
{'r', 1},
{'d', 1},
{'press_a', 1},
{'d', 1},
{'press_a', 1},
{'u', 1},
{'l', 1},
{'press_a', 1},
{'w', 240},
{'press_b', 9},
{'l', 4},
{'w', 60},
{'r', 2},
{'u', 1},
{'w', 60}, -- done

{'press_a', 1}, -- candice battle start
{'w', 180},
{'press_b', 14},
{'w', 2160}, -- done //12-DuringCandice
{'save', '16-DuringCandice'},

{'press_a', 1}, -- candice opening, stealth rock on hippo, use fourguys as a pivot, send in vapor for free to prevent aerial ace while we use xspeed to baton pass to infernape
-- infernape xspeed with stealth rock OHKO's everything and moves first. 
-- in the WORST case
-- Infernape switches into a slash crit
-- takes 78 damage (128 max hp at least)
-- Plus 8 from sandstorm
-- 86
-- AI will NOT pick ice shard, it is weaker than aerial ace and has no supporting points from secondary effect.
-- it would only gain points for being lethal which it can't be 
-- AI will pick either aerial ace (default) or slash if it procs the high-crit roll to gain +1 points

-- flamethrower KOs sneasel
-- flamethrower KOs pillowswine
-- flamethrower KOs froslass after stealth rock damage
-- flamethrower KOs Abomasnow

-- we take an additional 24 damage from sandstorm during this time
-- for a grand total of 110, leaving us alive. Hooray ^_^

{'d', 1},
{'use_move', 1}, -- use stealth rock
{'w', 180},
{'d', 1},
{'r', 2},
{'press_a', 1},
{'w', 300},
{'r', 1},
{'d', 2},
{'press_a', 2},
{'w', 2160},
{'r', 1},
{'d', 1},
{'press_a', 2},
{'w', 1440},
{'d', 1},
{'press_a', 1},
{'w', 300},
{'r', 1},
{'d', 1},
{'press_a', 1},
{'w', 60},
{'d', 1},
{'press_a', 2},
{'w', 2160},
{'u', 1},
{'press_a', 1},
{'d', 1},
{'r', 1},
{'press_a', 1},
{'w', 420},
{'d', 1},
{'press_a', 2},
{'w', 1980}, -- setup complete, time to sweep

{'press_a', 1},
{'r', 1},
{'d', 1},
{'use_move', 1}, -- flamethrower KO
{'w', 540},
{'press_b', 35},
{'use_move', 1},
{'press_b', 38},
{'use_move', 1},
{'press_b', 47},
{'use_move', 1},
{'press_b', 45}, -- done //13-AfterCandice
{'save', '17-AfterCandice'}, -- short script hooray

}

b = {


}

client.unpause()
client.unpause_av()
m.executeOrders(a)
client.pause_av()
client.pause()