Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- F6::
- /*
- * !!! ENTER PARTY JOBS BELOW !!!
- *
- * The script will take into account your composition when Guarding in battle. It will go by the slowest growing job in the party.
- * To be as efficient as possible, group jobs with similar growth speed together (eg: White Mage, Black Mage, Evoker, Magus).
- *
- * If a party member is a Thief or a Scholar, you must:
- * 1. Put it in the back row (you should put everyone in the back row anyway.
- * 2. Give it the Mini status.
- * 3. Make sure you do NOT have both in the same party.
- * The script will use the Attack command for these two jobs. If you don't set them up as instructed, the script may not function properly.
- *
- * If a slot is left blank or is invalid, the script will not start.
- *
- * Valid jobs:
- * Freelancer, Warrior, Monk, White Mage, Black Mage, Red Mage, Thief, Ranger, Knight,
- * Scholar, Geomancer, Viking, Dragoon, Dark Knight, Evoker, Bard, Black Belt, Magus,
- * Devout, Summoner, Sage, Ninja, Onion Knight
- *
- * Here is an example of a party composition:
- *
- * party:=[]
- * party[0]:= "Freelancer"
- * party[1]:= "Thief"
- * party[2]:= "Ranger"
- * party[3]:= "Sage"
- *
- * Enter yours below
- */
- party:=[]
- party[0]:= "Evoker"
- party[1]:= "White Mage"
- party[2]:= "Evoker"
- party[3]:= "Scholar"
- /*
- * Do not make any changes below this point, unless you know what you are doing
- */
- jobGrowthValues:= {}
- jobGrowthValues["Scholar"]:= 24
- jobGrowthValues["Freelancer"]:= 20
- jobGrowthValues["Thief"]:= 20
- jobGrowthValues["Bard"]:= 18
- jobGrowthValues["Dragoon"]:= 16
- jobGrowthValues["Warrior"]:= 14
- jobGrowthValues["Monk"]:= 14
- jobGrowthValues["Ranger"]:= 14
- jobGrowthValues["Black Belt"]:= 14
- jobGrowthValues["Geomancer"]:= 14
- jobGrowthValues["Dark Knight"]:= 14
- jobGrowthValues["Viking"]:= 14
- jobGrowthValues["Red Mage"]:= 12
- jobGrowthValues["Summoner"]:= 12
- jobGrowthValues["Ninja"]:= 12
- jobGrowthValues["Knight"]:= 12
- jobGrowthValues["White Mage"]:= 10
- jobGrowthValues["Magus"]:= 10
- jobGrowthValues["Devout"]:= 10
- jobGrowthValues["Sage"]:= 10
- jobGrowthValues["Black Mage"]:= 10
- jobGrowthValues["Evoker"]:= 10
- jobGrowthValues["Onion Knight"]:= 8
- currentState:= "corridor"
- direction:= "goingRight"
- ; All pixel values for the battle screen
- button1X:= 229
- button1Y:= 356
- button2X:= 229
- button2Y:= 413
- button3X:= 229
- button3Y:= 471
- lootButtonX:= 722
- lootButtonY:= 73
- ; Check for valid party compositions
- if(!jobGrowthValues.hasKey(party[0]) || !jobGrowthValues.hasKey(party[1]) || !jobGrowthValues.hasKey(party[2]) || !jobGrowthValues.hasKey(party[3])) {
- MsgBox, "At least one party member has an invalid job. Script will not start."
- ExitApp
- }
- ; Check for Thief & Scholar both in party. AHK really doesn't have an elegant way to check if an array contains something.
- if(party[0] == "Thief" || party[1] == "Thief" || party[2] == "Thief" || party[3] == "Thief") {
- if(party[0] == "Scholar" || party[1] == "Scholar" || party[2] == "Scholar" || party[3] == "Scholar") {
- MsgBox, "Thief and Scholar are both in the party. Script will not start."
- ExitApp
- }
- }
- ; Calculate number of turns per battle
- turnCount:= Ceil(100/Min(jobGrowthValues[party[0]], jobGrowthValues[party[1]], jobGrowthValues[party[2]], jobGrowthValues[party[3]]))
- Loop {
- if(currentState == "corridor") {
- MouseClick, Left, 360, 260, 1, 0 ; Clear any held presses, wipe all pixel variables
- wallRight:= ""
- wallLeft:= ""
- screenCenter:= ""
- Sleep, 100
- if(direction == "goingRight") {
- ; Start going right
- MouseClick, Left, 360, 260, 1, 0, D
- MouseMove, 400, 260
- }
- if(direction == "goingLeft") {
- ; Start going left
- MouseClick, Left, 360, 260, 1, 0, D
- MouseMove, 310, 260
- }
- if(direction=="goingRight") { ; Scan for right end of tunnel, or battle
- while(wallRight != "0x000000" && screenCenter != "0xFFFFFF") {
- PixelGetColor, wallRight, 650, 250
- PixelGetColor, screenCenter, 380, 250
- }
- if(screenCenter == "0xFFFFFF") {
- currentState:= "battle"
- } else {
- direction:= "goingLeft"
- wallLeft:= ""
- }
- continue
- }
- if(direction=="goingLeft") { ; Scan for left end of tunnel, or battle
- while(wallLeft != "0x000000" && screenCenter != "0xFFFFFF") {
- PixelGetColor, wallLeft, 35, 250
- PixelGetColor, screenCenter, 380, 250
- }
- if(screenCenter == "0xFFFFFF") {
- currentState:= "battle"
- } else {
- direction:= "goingRight"
- wallRight:= ""
- }
- continue
- }
- Sleep, 250
- }
- if(currentState == "battle") {
- MouseClick, Left, 360, 260, 1, 0 ; Clear any held presses, wipe all pixel variables
- command1:= ""
- command2:= ""
- command3:= ""
- lootButton:= ""
- ; Guard turnCount times
- Loop, %turnCount% {
- while(!(command1 == "0xADAAAD" && command2 == "0xADAAAD" && command3 == "0xADAAAD")) { ; Wait until all three command button borders are present
- PixelGetColor, command1, button1X, button1Y
- PixelGetColor, command2, button2X, button2Y
- PixelGetColor, command3, button3X, button3Y
- PixelGetColor, lootButton, lootButtonX, lootButtonY ; Failsafe for the rare case where the enemies die early due to a Scholar/Thief
- if(lootButton=="0xF7F7F7") {
- Goto, LootLabel
- }
- }
- command1:= ""
- command2:= ""
- command3:= ""
- Loop, 4 {
- if(party[A_Index-1] == "Thief" || party[A_Index-1] == "Scholar") { ; If a Scholar/Thief, use Attack instead. NOTE: This will kill lone enemies before turnCount is reached, in some cases.
- MouseClick, Left, button1X-50, button1Y
- Sleep, 300
- MouseClick, Left, button1X-50, button1Y
- Sleep, 1000
- } else {
- MouseClick, Left, button3X-50, button3Y
- Sleep, 1000
- }
- }
- MouseMove, 360, 260
- }
- while(!(command1 == "0xADAAAD" && command2 == "0xADAAAD" && command3 == "0xADAAAD")) { ; Wait until all three command button borders are present
- PixelGetColor, command1, button1X, button1Y
- PixelGetColor, command2, button2X, button2Y
- PixelGetColor, command3, button3X, button3Y
- }
- ; Attack with everyone
- Loop, 4 {
- MouseClick, Left, button1X-50, button1Y
- Sleep, 300
- MouseClick, Left, button1X-50, button1Y
- Sleep, 1000
- }
- MouseMove, 360, 260
- LootLabel:
- ; Wait for the loot/xp button to appear
- while(lootButton != "0xF7F7F7") {
- PixelGetColor, lootButton, lootButtonX, lootButtonY
- }
- ; Press it until it vanishes
- while(lootButton == "0xF7F7F7") {
- MouseClick, Left, 722, 73
- Sleep, 1000
- PixelGetColor, lootButton, lootButtonX, lootButtonY
- }
- currentState:= "corridor"
- Sleep, 3000
- }
- }
- Return
- F8::Reload
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement