The Wiki for Tale 5 is in read-only mode and is available for archival and reference purposes only. Please visit the current Tale 11 Wiki in the meantime.

If you have any issues with this Wiki, please post in #wiki-editing on Discord or contact Brad in-game.

User:Anka/Macros/ccOven

From ATITD5
Jump to navigationJump to search
//Charcoal Oven updated for Tale 5
//
// Setup:  This handles from 1 to 8 charcoal ovens at a time.  I suggest at least 300
//         wood per oven and a normally hold about 150 water jugs.
//         All ovens are slightly different but I suggest that you put your
//         fastest burning oven first in line.  You can tweak the settings
//         to your liking in the new GUI window.  Your settings will be saved.
//
//  If you see anything odd, /chat me.
//
//  ENJOY! :)
//  Anka
//
Constants
  //User Definable variables
  Ovens = 4       //Number of Ovens you are running. 1-8
  HeatMinX = 129
  HeatX = 157      //Threshold for Heat bar, increase or decrease as needed.
  HeatMaxX = 178
  Oxy1X = 82
  Oxy2X = 133
  Wood1X = 109      //Wood threshold, adds wood/round up to this point.
  WaterX = 76      //Alowable water level, not much play here.. dont lower more than 2
  DangerX = 170  // 162    //Threshold for Danger bar, increase or decrease as needed.
  RGBBlue = 220    //Threshold for detecting the color blue.
  RGBGreen = 250   //Threshold for detecting the color green.  Some video cards
  //                 are having problems with this.  If you are having problems, run
  //                 just 1 oven and try lowering this number by 10 at a time.  It's
  //                 hard for me to see what is going on without using your pc :(
  //                 This method is used for RGBBlue and RGBGreen.
  CheckDelay = 3900
  Guild = 0       // 1 for Guilded or public ovens, 0 for Personal ovens
  //End User variables
  AddX = 215      // 215-Personal   212-Guilded
  Add2X = 15
  Add1Y = 65
  Add2Y = 17
  Add3Y = 233
  HeatMin = 0
  HeatMax = 0
  WoodMax = 0
  DangerMax = 0
  BeginX = 106
  BeginY = 224
  NewX = 0
  New2X = 0
  New3X = 0
  New2Y = 0
  NewY = 0
  Heat = 0
  Oxy = 0
  Wood = 0
  Water = 0
  WaterUsed = 0
  Danger = 0
  Status = 0
  HeatY = 136                // These are the 1024x768 #'s   140
  OxyY = 147                 //152
  Wood2X = 125
  WoodY = 160                //164
  WaterY = 172               //176
  DangerY = 183              //188
  StatusX = 165
  StatusY = 196
  StatusB = 0
  WoodBX = 35
  WoodBY = 231
  WaterBX = 85
  Vent0 = 129
  Vent1 = 155
  Vent2 = 180
  VentBX = 0
  OldVent = 1
  Num = 0
  Jump = 5  //# in first row before going to 2nd
  Jump1 = 0
  JumpM = 0
  Jumped = 0
  Used = 0
  WoodNum = 0
  MDelay = 250
  SDelay = 200
  S1Delay = 100
  Count = 0
  CountM = 0
  MouseX = 0
  MouseY = 0
  SetX = 10
  SetY = 40
  SetAddX = 214
  SetAddY = 233
  SetLoop = 0
End

Form ccOven, Settings
  ed1=Combobox:Ovens:1, 2, 3, 4, 5, 6, 7, 8
  ed2=CheckBox:Guilded?:True
  ed14=CheckBox:Venery?:False
  ed15=CheckBox:Setup Windows?:False
  ed3=Editbox:Heat                  (75-188):164
  ed10=Editbox:HeatMin            (75-188):116
  ed11=Editbox:HeatMax           (75-188):180
  ed4=Editbox:Low Oxy            (75-188):85
  ed5=Editbox:High Oxy           (75-188):130
  ed6=Editbox:Wood                (75-188):108
  ed7=Editbox:Water                (75-188):77
  ed8=Editbox:RGBGreen:240
  ed9=Editbox:RGBBlue:220
  ed13=checkbox:Debug:False
  ed12=Editbox:Check Bars Interval  (miliseconds):800
end

FormLoad ccOven, ccOven.frm

if ShowForm ccOven
  SetConst Ovens = ccOven[ed1]
  If ccOven[ed2] = True
    SetConst Guild = 1
  Else
    SetConst Guild = 0
  End
  SetConst HeatX = ccOven[ed3]
  SetConst Oxy1X = ccOven[ed4]
  SetConst Oxy2X = ccOven[ed5]
  SetConst Wood1X = ccOven[ed6]
  SetConst WaterX = ccOven[ed7]
  SetConst RGBGreen = ccOven[ed8]
  SetConst RGBBlue = ccOven[ed9]
  SetConst HeatMin = ccOven[ed10]
  SetConst HeatMax = ccOven[ed11]
  SetConst CheckDelay = ccOven[ed12]
  Compute SetLoop = $Ovens - 1
  Compute Jump1 = $Jump - 1
else
  Stop
end

FormSave ccOven, ccOven.frm

Keydown @{Tab} 100
Delay 2000

If $Guild = 1
  Call Guild
End

if ccOven[ed14] = True
	Call Venery
End

If ccOven[ed15] = True
	Call Setup
End
SetConst NewX = $BeginX
SetConst NewY = $BeginY

SetConst Count = 1
Loop $Ovens
  If $Count = $Jump
    SetConst NewX = $BeginX
    Compute NewY = $BeginY + $Add3Y
  End
  MousePos $NewX, $NewY
  //


  //
  Delay $MDelay
  Rightclick
  Delay $MDelay
  Compute NewX = $NewX + $AddX
  Compute Count = $Count + 1
End
SetConst NewX = $BeginX

Call Main

Procedure Setup
  Set NewX = $SetX
  Set NewY = $SetY
  Loop $SetLoop
    Mousepos $SetX, $SetY
    if {loopno} = $Jump1
      Set NewX = $SetX
      Compute NewY = $SetY + $SetAddY
    else
      Compute NewX = $NewX + $SetAddX
    End
    Dragto $NewX, $NewY
  End
End

Procedure Main
  SetConst CountM = 1
  SetConst Status = 0
  Compute JumpM = $Jump - 1
  Loop $Ovens
    If $CountM = $Jump
      SetConst NewX = $StatusX
      Compute NewY = $StatusY + $Add3Y
      SetConst New2X = $WaterBX
      Compute New2Y = $WoodBY + $Add3Y
    End
    
    While $Status = 0
      Call CheckBars
      If $Status = 1
        Call Snuff
        //code to advance to next hearth
        Compute Used = $Used + 1
        If $Used = $JumpM
          Compute HeatMinX = $HeatMinX - (($Used - 1) * $AddX)
          Compute HeatX = $HeatX - (($Used - 1) * $AddX)
          Compute HeatMaxX = $HeatMaxX - (($Used - 1) * $AddX)
          Compute HeatY = $HeatY + $Add3Y
          Compute Oxy1X = $Oxy1X - (($Used - 1) * $AddX)
          Compute Oxy2X = $Oxy2X - (($Used - 1) * $AddX)
          Compute OxyY = $OxyY + $Add3Y
          Compute Wood1X = $Wood1X - (($Used - 1) * $AddX)
          Compute WoodY = $WoodY + $Add3Y
          Compute WaterX = $WaterX - (($Used - 1) * $AddX)
          Compute WaterY = $WaterY + $Add3Y
          //Compute DangerX = $DangerX - (($Used - 1) * $AddX)
          Compute DangerY = $DangerY + $Add3Y
          Compute StatusX = $StatusX - (($Used - 1) * $AddX)
          Compute StatusY = $StatusY + $Add3Y
          //Compute WaterBX = $WaterBX - (($Used -1) * $AddX)
          //Compute WoodBX = $WoodBX - (($Used - 1 ) * $AddX)
          //Compute WoodBY = $WoodBY + $Add3Y
          SetConst Jumped = 1
          Continue
        Else
          Compute HeatMinX = $HeatMinX + $AddX
          Compute HeatX = $HeatX + $AddX
          Compute HeatMaxX = $HeatMaxX + $AddX
          Compute Oxy1X = $Oxy1X + $AddX
          Compute Oxy2X = $Oxy2X + $AddX
          Compute Wood1X = $Wood1X + $AddX
          Compute WaterX = $WaterX + $AddX
          //Compute DangerX = $DangerX + $AddX
          Compute StatusX = $StatusX + $AddX
          //Compute WaterBX = $WaterBX + $AddX
          //Compute WoodBX = $WoodBX + $AddX
        End
        Continue
      End
      
      Case
      When $HeatMin = 1
        Call Wood
        Set WoodNum = 1
      Else
        If $Heat = 0 and $Danger = 0
          If $WoodNum = 0  and $Wood = 0
            Call Wood
            Set WoodNum = 1
          else
            Set WoodNum = 0
          End
        Else
          If $Heat = 1 or $Danger = 1
            If $Water = 0 or $HeatMax = 1 or $DangerMax = 1
              If $WaterUsed = 0
                Call Water
                SetConst WaterUsed = 3
              End
            End
          End
        End
      End
      
      Case
      When $WaterUsed = 3
        SetConst WaterUsed = 2
      When $WaterUsed = 2
        SetConst WaterUsed = 1
      When $WaterUsed = 1
        SetConst WaterUsed = 0
      End
      
      If {loopno} > 3
        Case
        When $Oxy = 0
          // Open vent full
          If $OldVent <> $Oxy
            SetConst VentBX = $Vent2
            Call Vent
            SetConst OldVent = 0
            Delay 100
          End
        When $Oxy = 1
          // Oxy set normal
          If $OldVent <> $Oxy
            SetConst VentBX = $Vent1
            Call Vent
            SetConst OldVent = 1
            Delay 100
          End
        When $Oxy = 2
          // Close vent
          If $OldVent <> $Oxy
            SetConst VentBX = $Vent0
            Call Vent
            SetConst OldVent = 2
            Delay 100
          End
        End
      End
      Delay $CheckDelay
    End
    Compute CountM = $CountM + 1
    SetConst Status = 0
  End
End

Procedure CheckBars
  if ccOven[ed13] = True
    MousePos $HeatMinX, $HeatY
    Delay $SDelay
  end
  LoadRGB $HeatMinX, $HeatY
  if {RGBBlue} < $RGBBlue
    SetConst HeatMin = 1
  else
    Set HeatMin = 0
  End
  
  if ccOven[ed13] = True
    MousePos $HeatX, $HeatY
    Delay $SDelay
  End
  LoadRGB $HeatX, $HeatY
  if {RGBBlue} > $RGBBlue
    SetConst Heat = 1
  Else
    SetConst Heat = 0
  End
  
  if ccOven[ed13] = True
    MousePos $HeatMaxX, $HeatY
    Delay $SDelay
  End
  LoadRGB $HeatMaxX, $HeatY
  if {RGBBlue} > $RGBBlue
    SetConst HeatMax = 1
  Else
    SetConst HeatMax = 0
  End
  
  if ccOven[ed13] = True
    MousePos $Oxy1X, $OxyY
    Delay $SDelay
  End
  LoadRGB $Oxy1X, $OxyY
  if {RGBBlue} > $RGBBlue
    SetConst Oxy = 1
  Else
    SetConst Oxy = 0
  End
  
  if ccOven[ed13] = True
    MousePos $Oxy2X, $OxyY
    Delay $SDelay
  End
  LoadRGB $Oxy2X, $OxyY
  if {RGBBlue} > $RGBBlue
    SetConst Oxy = 2
  End
  
  if ccOven[ed13] = True
    MousePos $Wood1X, $WoodY
    Delay $S1Delay
  End
  LoadRGB $Wood1X, $WoodY
  if {RGBBlue} > $RGBBlue
    SetConst Wood = 1
  Else
    SetConst Wood = 0
  End
  
  if ccOven[ed13] = True
  	MousePos $Wood2X, $WoodY
  	Delay $S1Delay
  End
  LoadRGB $Wood2X, $WoodY
  if {RGBBlue} > $RGBBlue
  	SetConst WoodMax = 1
  Else
  	SetConst WoodMax = 0
  End
  
  if ccOven[ed13] = True
    MousePos $WaterX, $WaterY
    Delay $S1Delay
  End
  LoadRGB $WaterX, $WaterY
  if {RGBBlue} > $RGBBlue
    SetConst Water = 1
  Else
    SetConst Water = 0
  End
  
  if ccOven[ed13] = True
    MousePos $HeatX, $DangerY
    Delay $S1Delay
  End
  LoadRGB $HeatX, $DangerY
  if {RGBBlue} > $RGBBlue
    SetConst Danger = 1
  Else
    SetConst Danger = 0
  End
  
  if ccOven[ed13] = True
    MousePos $HeatMaxX, $DangerY
    Delay $S1Delay
  End
  LoadRGB $HeatMaxX, $DangerY
  if {RGBBlue} > $RGBBlue
    SetConst DangerMax = 1
  Else
    SetConst DangerMax = 0
  End
  
  if ccOven[ed13] = True
    MousePos $StatusX, $StatusY
  End
  LoadRGB $StatusX, $StatusY
  if {RGBGreen} > $RGBGreen
    //if {RGBRed} = 6 and {RGBGreen} = 254 and {RGBBlue} = 5
    SetConst Status = 1
  Else
    if $StatusB = 0
      if {RGBBlue} > $RGBBlue
        Compute HeatMaxX = $HeatMaxX - 5
        Compute Wood1X = $Wood1X - 5
        Timestamp "HeatMax " $HeatMaxx "Wood1X " $Wood1X
        Set StatusB = 1
      End
    End
    SetConst Status = 0
  End
  
End

Procedure Water
  SetConst NewX = $WaterBX
  SetConst NewY = $WoodBY
  Loop $Ovens
    IF {loopno} = $Jump
      SetConst NewX = $WaterBX
      Compute NewY = $WoodBY + $Add3Y
    End
    If {loopno} > $Used
      MousePos $NewX, $NewY
      Delay $SDelay
      Rightclick
      Delay $SDelay
    End
    Compute NewX = $NewX + $AddX
  End
  SetConst NewX = $WaterBX
End

Procedure Vent
  SetConst NewX = $VentBX
  SetConst NewY = $WoodBY
  Loop $Ovens
    IF {loopno} = $Jump
      SetConst NewX = $VentBX
      Compute NewY = $WoodBY + $Add3Y
    End
    If {loopno} > $Used
      MousePos $NewX, $NewY
      Delay $SDelay
      Rightclick
      Delay $SDelay
    End
    Compute NewX = $NewX + $AddX
  End
  SetConst NewX = $VentBX
End

Procedure Snuff
  SetConst New2X = $WaterBX
  SetConst New3X = $Vent2
  SetConst New2Y = $WoodBY
  Compute Num = $Used + 1
  Loop $Ovens
    IF {loopno} = $Jump
      SetConst New2X = $WaterBX
      SetConst New3X = $Vent2
      Compute New2Y = $WoodBY + $Add3Y
    End
    If {loopno} = $Num
      MousePos $New2X, $New2Y
      Loop 8
        Rightclick
      End
      MousePos $New3X, $WoodBY
      Delay 200
      Rightclick
    End
    Compute New2X = $New2X + $AddX
    Compute New3X = $New3X + $AddX
  End
End

Procedure Wood
  if $WoodMax = 0
    SetConst NewX = $WoodBX
    SetConst NewY = $WoodBY
    Loop $Ovens
      IF {loopno} = $Jump
        SetConst NewX = $WoodBX
        Compute NewY = $WoodBY + $Add3Y
      End
      If {loopno} > $Used
        MousePos $NewX, $NewY
        Delay $SDelay
        Rightclick
        Delay $SDelay
      End
      Compute NewX = $NewX + $AddX
    End
    SetConst NewX = $WoodBX
  End
End

Procedure Guild
  Compute BeginX = $BeginX - 3
  Compute BeginY = $BeginY + 16
  Compute AddX = $AddX - 3
  Compute Add3Y = $Add3Y + 16
  Compute Add1Y = $Add1Y - 16
  Compute WoodBY = $WoodBY + 16
  //Compute HeatX = $HeatX - 4
  Compute HeatY = $HeatY + 16
  //Compute Oxy1X = $Oxy1X
  //Compute Oxy2X =
  Compute OxyY = $OxyY + 16
  //Compute Wood1X = $Wood1X - 1
  Compute WoodY = $WoodY + 16
  Compute WaterY = $WaterY + 16
  //Compute DangerX = $DangerX - 4
  Compute DangerY = $DangerY + 16
  //Compute StatusX = $StatusX - 5
  Compute StatusY = $StatusY + 16
  Compute SetAddX = $SetAddX - 3
  Compute SetAddY = $SetAddY + 16
End

Procedure Venery
  Compute BeginY = $BeginY + 16
  Compute Add3Y = $Add3Y + 16
  Compute Add1Y = $Add1Y - 16
  Compute WoodBY = $WoodBY + 16
  Compute HeatY = $HeatY + 16
  //Compute Oxy1X = $Oxy1X
  //Compute Oxy2X =
  Compute OxyY = $OxyY + 16
  //Compute Wood1X = $Wood1X - 1
  Compute WoodY = $WoodY + 16
  Compute WaterY = $WaterY + 16
  //Compute DangerX = $DangerX - 4
  Compute DangerY = $DangerY + 16
  //Compute StatusX = $StatusX - 5
  Compute StatusY = $StatusY + 16
  Compute SetAddY = $SetAddY + 16
End
//Written with ACTool 5.3.0 by Anka
Bell Asterisk