The Wiki for Tale 4 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:Tribisha/Macros/CC Oven

From A Tale in the Desert
Jump to navigationJump to search

Anka's CC Oven Macro readjusted to run at 1680x1050 resolution for Tale 4, uses ACTool


//Charcoal Oven
//
// Setup:  This handles from 1 to 8 charcoal ovens at a time.  Pin the windows
//         in 2 rows of 4 starting in top left corner.  But them up together but
//         Don't overlap them at all.  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 = 2       //Number of Ovens you are running. 1-8
  HeatMinX = 109  // Originally 129
  HeatX = 167      //Threshold for Heat bar, increase or decrease as needed.
  HeatMaxX = 178
  Oxy1X = 82
  Oxy2X = 133
  WoodX = 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 = 1900
  Guild = 1       // 1 for Guilded or public ovens, 0 for Personal ovens
  //End User variables
  AddX = 212      // 215-Personal   212-Guilded
  Add2X = 15
  Add1Y = 65
  Add2Y = 17
  Add3Y = 233
  HeatMin = 0
  HeatMax = 0
  DangerMax = 0
  BeginX = 103
  BeginY = 229
  NewX = 0
  New2X = 0
  New3X = 0
  New2Y = 0
  NewY = 0
  Heat = 0
  Oxy = 0
  Wood = 0
  Water = 0
  Danger = 0
  Status = 0
  HeatY = 135 // 140
  OxyY = 147 // 152
  WoodY = 159 // 164
  WaterY = 171 // 176
  DangerY = 183 // 188
  StatusX = 172 
  StatusY = 195 // 200
  WoodBX = 35
  WoodBY = 229 // 234
  WaterBX = 85
  Vent0 = 130
  Vent1 = 155
  Vent2 = 180
  VentBX = 0
  OldVent = 1
  Num = 0
  Jump = 5
  JumpM = 0
  Jumped = 0
  Used = 0
  WoodNum = 0
  MDelay = 100
  SDelay = 200 // original 200
  S1Delay = 100
  Count = 0
  CountM = 0
  MouseX = 0
  MouseY = 0
  
End

Form ccOven, Settings
  ed1=Combobox:Ovens:1, 2, 3, 4, 5, 6, 7, 8
  ed2=CheckBox:Guilded?:True
  ed3=Editbox:Heat                  (75-188):162
  ed10=Editbox:HeatMin            (75-188):116
  ed11=Editbox:HeatMax           (75-188):184
  ed4=Editbox:Low Oxy            (75-188):82
  ed5=Editbox:High Oxy           (75-188):134
  ed6=Editbox:Wood                (75-188):109
  ed7=Editbox:Water                (75-188):77
  ed8=Editbox:RGBGreen:240
  ed9=Editbox:RGBBlue:220
  ed12=Editbox:Check Bars Interval  (miliseconds):4000
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 WoodX = 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]
else
  Stop
end

FormSave ccOven, ccOven.frm

MousePos 100, 20  //Activates eGenesis window.. Don't run ACTool maximized.
Delay $MDelay
LeftClick
Delay 2000

If $Guild = 1
  Call Guild
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  //Dont remember why this is here :)
Call Main

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 WoodX = $WoodX - (($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 WoodX = $WoodX + $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
              Call Water
            End
          End
        End
      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
  MousePos $HeatMinX, $HeatY
  Delay $SDelay
  LoadRGB {MouseX}, {MouseY}
  if {RGBBlue} < $RGBBlue
    SetConst HeatMin = 1
  else
    Set HeatMin = 0
  End
  
  MousePos $HeatX, $HeatY
  Delay $SDelay
  LoadRGB {MouseX}, {MouseY}
  if {RGBBlue} > $RGBBlue
    SetConst Heat = 1
  Else
    SetConst Heat = 0
  End
  
  MousePos $HeatMaxX, $HeatY
  Delay $SDelay
  LoadRGB {MouseX}, {MouseY}
  if {RGBBlue} > $RGBBlue
    SetConst HeatMax = 1
  Else
    SetConst HeatMax = 0
  End
  
  MousePos $Oxy1X, $OxyY
  Delay $SDelay
  LoadRGB {MouseX}, {MouseY}
  if {RGBBlue} > $RGBBlue
    SetConst Oxy = 1
  Else
    SetConst Oxy = 0
  End
  
  MousePos $Oxy2X, $OxyY
  Delay $SDelay
  LoadRGB {MouseX}, {MouseY}
  if {RGBBlue} > $RGBBlue
    SetConst Oxy = 2
  End
  
  MousePos $WoodX, $WoodY
  Delay $S1Delay
  LoadRGB {mousex}, {mousey}
  if {RGBBlue} > $RGBBlue
    SetConst Wood = 1
  Else
    SetConst Wood = 0
  End
  
  MousePos $WaterX, $WaterY
  Delay $S1Delay
  LoadRGB {mousex}, {mousey}
  if {RGBBlue} > $RGBBlue
    SetConst Water = 1
  Else
    SetConst Water = 0
  End
  
  MousePos $HeatX, $DangerY
  Delay $S1Delay
  LoadRGB {MouseX}, {MouseY}
  if {RGBBlue} > $RGBBlue
    SetConst Danger = 1
  Else
    SetConst Danger = 0
  End
  
  MousePos $HeatMaxX, $DangerY
  Delay $S1Delay
  LoadRGB {MouseX}, {MouseY}
  if {RGBBlue} > $RGBBlue
    SetConst DangerMax = 1
  Else
    SetConst DangerMax = 0
  End
  
  MousePos $StatusX, $StatusY
  LoadRGB {MouseX}, {MouseY}
  if {RGBGreen} > $RGBGreen
    //if {RGBRed} = 6 and {RGBGreen} = 254 and {RGBBlue} = 5
    SetConst Status = 1
  Else
    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
  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

Procedure Guild
  //Compute BeginX = $BeginX - 7
  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 WoodX = $WoodX - 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
End
//Written with ACTool 5.3.0 by Anka
Bell Asterisk