Macros/FaithTowers

From zoywiki.com
Jump to navigation Jump to search
Constants
  //Game States
  CurrentGameState = 0 //main state variable
  StateMap = 1
  StateCombat = 2
  //Automation Counters and States
  FaithRun = 0 //where we are in run 
  //Game Counters
  LoopCount = 10
  LoopMod = 0
  //Misc
  MsgBox = 0
End

Keyrate 1
delay 2 sec

//key checker
//state checker

//notes
//must remove c from hotkeys

procedure GetGameState
  //checking for brown on level number area of character portrain
  loadrgb 194,53
  if {RGBRed} < 25 and {RGBGreen} > 70 and {RGBGreen} < 90 and {RGBBlue} > 115 and {RGBBlue} < 135
    compute CurrentGameState = $StateMap
  else
    Keys r
    //rgb 255,48,16 -- px 38,45
    LoadRGB 38,45
    if {RGBRed} > 230 and {RGBGreen} < 60 and {RGBBlue} < 40
 		  delay 10 sec	  
    else
	    compute CurrentGameState = $StateCombat
    end
  end
end

procedure DoMapState When $CurrentGameState = $StateMap
  //what to do on the map
  
  //check for move to next area box
  //continue to faith tower
  //
  //delay 100
  Keys r
end

procedure DoCombatState When $CurrentGameState = $StateCombat
  //retreat from combat
  Keys r
  Keys {RETURN}
  delay 20
  //click ok on victory screen
  MousePos 532, 541
  LeftClick
end

procedure MainMover
    Case $FaithRun
    WHEN 0
     call ClickButton 1
    WHEN 1
     call ClickButton 2
    WHEN 2
     call ClickButton 3
    WHEN 3
     call ClickButton 4
    WHEN 4
     call ClickButton 3    
    WHEN 5
     call ClickButton 4
    WHEN 6
	   call ClickButton 1    
    WHEN 7
     call ClickButton 5
    WHEN 8
     call ClickButton 1
    WHEN 9
     call ClickButton 6
    WHEN 10
     call ClickButton 1
    WHEN 11
     call ClickButton 5
    WHEN 12
     call ClickButton 3
    WHEN 13
     call ClickButton 2 //problem state
    WHEN 14
     call ClickButton 1
    WHEN 15
     call ClickButton 5 //problem state
    WHEN 16
     call ClickButton 4
    WHEN 17
     call ClickButton 2
    WHEN 18
     call ClickButton 1
    WHEN 19
     call ClickButton 2
    WHEN 20//20 is last of 1st half
     call ClickButton 3
     delay 1 sec
     ShowMessage MsgBox = Warning, OK:CANCEL, Halfway point. to continue goto Swallow Song
    WHEN 21 //start of 2nd half from swallow song
     call ClickButton 5 //problem state
    WHEN 22
     call ClickButton 1
    WHEN 23
     call ClickButton 6
    WHEN 24
     call ClickButton 1
    WHEN 25
     call ClickButton 5 //problem state
    WHEN 26
     call ClickButton 2 //problem state
    WHEN 27
     call ClickButton 1
    WHEN 28
     call ClickButton 2 //problem state
    WHEN 29
     call ClickButton 1
    WHEN 30
     call ClickButton 5 //problem state
    WHEN 31
     call ClickButton 5 //problem state
    WHEN 32
     call ClickButton 4
    WHEN 33
     call ClickButton 1
    WHEN 34
     call ClickButton 4 //problem state
    WHEN 35
     call ClickButton 7
    WHEN 36
     call ClickButton 2
    WHEN 37
     call ClickButton 2 //problem state
    WHEN 38
     call ClickButton 7
    WHEN 39
     call ClickButton 2
    WHEN 40
     call ClickButton 1
    WHEN 41
     call ClickButton 2
    WHEN 42
     call ClickButton 1
    WHEN 43
     call ClickButton 2
    WHEN 44
     call ClickButton 1
    WHEN 45
     call ClickButton 5 //problem state
    WHEN 46
     call ClickButton 5
    WHEN 47
     call ClickButton 4
    WHEN 48
     call ClickButton 4
    WHEN 49
     call ClickButton 1
    WHEN 50
     call ClickButton 4 //problem state
    WHEN 51
     call ClickButton 1
    WHEN 52
     call ClickButton 6 //prblem state
    WHEN 53
     call ClickButton 1
    WHEN 54
     ShowMessage MsgBox = Warning, OK:CANCEL, Done with Faith Towers
    WHEN 55
     ShowMessage MsgBox = Warning, OK:CANCEL, Done with Faith Towers
    WHEN 56
     ShowMessage MsgBox = Warning, OK:CANCEL, Done with Faith Towers
    end 
end
  
procedure ClickButton Using ButtonNumber
    Case $ButtonNumber
    WHEN 1
      MousePos 883, 180
      delay 500
      LeftClick
      MousePos 886, 273
      delay 500
      LeftClick
    WHEN 2
      MousePos 883, 180
      delay 500
      LeftClick
      MousePos 917, 246
      delay 500
      LeftClick
      MousePos 730, 291
      delay 500
      LeftClick
    WHEN 3
      MousePos 883, 180
      delay 500
      LeftClick
      MousePos 949, 339
      delay 500
      LeftClick
    WHEN 4
      MousePos 883, 180
      delay 500
      LeftClick
      MousePos 917, 246
      delay 500
      LeftClick
      MousePos 735, 326
      delay 500
      LeftClick
    WHEN 5
      MousePos 883, 180
      delay 500
      LeftClick
      MousePos 917, 246
      delay 500
      LeftClick
      MousePos 756, 259
      delay 500
      LeftClick
    WHEN 6
      MousePos 883, 180
      delay 500
      LeftClick
      MousePos 917, 246
      delay 500
      LeftClick
      MousePos 723, 361
      delay 500
      LeftClick
    WHEN 7
      MousePos 883, 180
      delay 500
      LeftClick
      MousePos 936, 374
      delay 500
      LeftClick
    END
end

  
  procedure KeyProcessor When {GlobalKeyCount} > 0
    //this is the key processor
    if {globalkeys} contains 77 //m
      MousePos 1246, 178
      delay 4 sec
      ClearGlobalKeys
    End
    if {globalkeys} contains 67 //c
			call MainMover
      ClearGlobalKeys
    End 
    if {globalkeys} contains 78 //n
    	compute FaithRun = $FaithRun + 1
    	delay 500
			call MainMover
      ClearGlobalKeys
     End
    if {globalkeys} contains 49 //1
    	compute FaithRun = 0
      ClearGlobalKeys
    End
    if {globalkeys} contains 50 //2
    	compute FaithRun =  21
      ClearGlobalKeys
    End    
  end
  
  while 1=1
    ProcessMessages
    Call GetGameState
  end