Runescape Farming Timers — File Browser

RunescapeFarmingTimersv1.0 / RunescapeFarmingTimersv1.0 / Farming Timers.mrc

Farming Timers.mrc — 25.13 KB — Download this file

/*
----------- Terms of Use ----------------
This script is freeware; therefore, it has no usage limitations. 
This script will not collect or send any information about the user.
This script is free from spyware and malware when downloaded from http://www.mircscripts.org
The publisher and distributor will not be responsible for any harm caused by the use of this program
The safe use of this script is the user's responsibility. 
The user may modify the code of this script; however, if it is published, these TOS may not be removed and credit must be given to the original creator.
*/


;##########################################################
;##                   Farming Timer                      ##
;##########################################################

dialog -l farmingtimer {
  title "Farming Timer Tool"
  size -1 -1 228 122
  option dbu
  tab "Create Timers", 100, 2 -1 225 105
  combo 104, 12 30 60 12, tab 100 drop
  box "Patch Type", 101, 9 22 66 22, tab 100
  box "Crop", 102, 80 22 66 22, tab 100
  combo 105, 83 30 60 11, tab 100 drop
  box "Location", 103, 152 22 66 22, tab 100
  combo 106, 155 30 60 11, tab 100 drop
  button "Create Timer", 110, 173 47 46 11, tab 100
  check "Flash mIRC Window", 107, 9 67 75 10, tab 100
  check "Beep Three Times", 108, 9 76 88 10, tab 100
  check "Popup Window", 109, 9 85 80 10, tab 100
  box "Create A New Timer", 111, 4 14 219 47, tab 100
  box "Notifications On Completion", 112, 4 61 96 36, tab 100
  text "", 113, 11 47 156 8, tab 100
  tab "View Timers", 200
  box "Current Timers", 201, 4 14 165 59, tab 200
  box "Single Timer Options", 203, 4 73 219 22, tab 200
  combo 204, 7 81 117 12, tab 200 sort drop
  button "Remove", 205, 126 81 46 11, tab 200
  button "Remove All", 206, 174 24 46 11, tab 200
  edit "", 202, 7 23 160 47, tab 200 read multi vsbar
  button "Purge Complete", 209, 174 56 46 11, tab 200
  button "Restart All", 208, 174 40 46 11, tab 200
  button "Restart", 207, 174 81 46 11, tab 200
  box "Timer Options", 210, 171 14 52 59, tab 200
  tab "Help", 400
  box "Basic Usage", 401, 4 14 219 71, tab 400
  text "To create a timer select the 'Create Timers' tab. Once there, select the Patch Type you will use from the first drop down menu. Then select the Crop you will be planting from the second drop down menu. Lastly select the Location you will plant at from the last drop down menu. Once all is selected, hit the 'Create Timer' button and the timer will start. Below you will find options on how you shall be alerted when the timer is done. Select as many as you wish to use. To view your timers select the 'View Timers' tab. Note, it is recommended to keep this tool closed while not in use to save system resources. If this tool is closed and you can an alert option selected and mIRC is running, you will still recieve the alert. ", 402, 7 23 213 60, tab 400
  button "Ok", 2, 186 108 37 12, ok cancel
  text "Created by: Crossfire39", 3, 89 110 60 8, disable
  menu "File", 1
  item "Quit", 4, 1
  menu "Tools", 5
  item "Edit Default Timers", 6, 5
  item "Restore Defaults", 7, 5
}

;[PRE-DIALOG EVENTS]
;Allows there to be a link to access the dialog
menu status,channel,query {
  .Farming Timer:/dialog -mr farmingtimer farmingtimer
}

;When script is loaded, creates the TextFiles/FarmingTimers.ini file and/or overwrites the old one if it exists.
on *:load:{
  if ($exists(FarmingTimers.ini) == $false) /CreateFarmFile
  else {
    /var %confirm = $input(The file 'FarmingTimers.ini' already exists. If you want to remove this file and replace it with a fresh copy press 'Yes'. Otherwise press 'No'., yvgqau, Overwrite file?)
    if (%confirm == $yes) { .remove -b FarmingTimers.ini | /CreateFarmFile }
  }
}

;When script is unloaded, asks user if they want to remove all traces of the program, the FarmingTimers.ini file.
on *:unload:{
  if ($exists(FarmingTimers.ini) == $true) {
    /var %unload = $input(If you wish to completely remove this program and delete 'FarmingTimers.ini 'Yes'. Otherwise press 'No'., yvgqau, You are about to unload the Farming Timer)
    if ( %unload == $yes ) .remove -b FarmingTimers.ini
  }
  /Tstatus off
}

/Starts the timer (if notifications enabled) when mIRC starts
on *:start:/Tstatus $iif($notice == $true,on 30,off)

;When dialog is created fills in all appropriate information, resets update interval.
on 1:dialog:farmingtimer:init:0:{
  if ($exists(FarmingTimers.ini) == $false) /CreateFarmFile
  /FTupdatepatches $dname 104
  /FTupdatecl Crop $dname 105 $did($dname,104)
  /FTupdatecl Location $dname 106 $did($dname,104)
  if ($Readini(FarmingTimers.ini, n, Settings, 107) == 1) /did -c $dname 107
  if ($Readini(FarmingTimers.ini, n, Settings, 108) == 1) /did -c $dname 108
  if ($Readini(FarmingTimers.ini, n, Settings, 109) == 1) /did -c $dname 109
}

;When the dialog is closed, refresh rate goes down to 30s or off if no notifications enabled
on 1:dialog:farmingtimer:close:0:/Tstatus $iif($notice == $true,on 30,off)

;Closes the farmingtimer dialog
on 1:dialog:farmingtimer:menu:4:/dialog -x $dname

;Restore the default file
on 1:dialog:farmingtimer:menu:7:{
  /var %Confirm = $input(You are about to restore the default timer list. Note: this will remove any manual changes you made to the list. If you wish to continue press 'yes' otherwise press 'no' to cancel., yvgqau, Confirm File Overwrite?)
  if (%Confirm == $yes) {
    .remini FarmingTimers.ini Crop
    .remini FarmingTimers.ini Location
    .remini FarmingTimers.ini Time
    /CreateFarmFile
  }
}

;Opens the default timer edit dialog
on 1:dialog:farmingtimer:menu:6:{
  /var %Confirm = $input(Warning! Entering the 'Timer Editing' utility will delete all your current timers. Do you wish to continue?, yvgqau, Confirm Timer Removal?)
  if (%Confirm == $no) /halt
  .remini FarmingTimers.ini Timers
  /dialog -mv ft_edit ft_edit
}

;[TAB ONE EVENTS]
;When you select a new plot type, clears old crop and location, and replaces with new info.
on 1:dialog:farmingtimer:sclick:104:{
  /FTupdatecl Crop $dname 105 $did($dname,104)
  /FTupdatecl Location $dname 106 $did($dname,104)
}

;When a crop is selected, shows the growth time.
on 1:dialog:farmingtimer:sclick:105:/did -ra $dname 113 Average time for $did($dname,105) to grow: $duration($calc($FTtime($did($dname,104),$did($dname,105))-$ctime),2)

;When a new setting is selected
on 1:dialog:farmingtimer:sclick:107-109:{
  /writeini -n FarmingTimers.ini Settings $did $did($dname,$did).state
  /Tstatus $iif($notice == $true,on 30,off)
}

;Create button. Checks for duplicates and writes to ini files
on 1:dialog:farmingtimer:sclick:110:{
  /var %TimerName = $+($did($dname,104),$chr(124),$did($dname,106),$chr(124),$did($dname,105))
  if ($readini(FarmingTimers.ini, n, Timers, %TimerName)) {
    /var %override = $input(This timer already exists. It is currently $iif($v1 == Done,inactive.,active.) If you wish to replace this timer with a new one press 'Yes'. Otherwise press 'No' and create a different timer., yvgqau, Timer Already Created!)
    if (%override == $no) /halt
  }
  /writeini -n FarmingTimers.ini Timers %TimerName $FTtime($did($dname,104),$did($dname,105))
  if ($notice == $true) /Tstatus on 30
}

;Makes sure that refresh rate slows down when not in tab 2
on 1:dialog:farmingtimer:sclick:100,300:/Tstatus $iif($notice == $true,on 30,off) 

;[TAB TWO EVENTS]
on 1:dialog:farmingtimer:sclick:200:{
  /Tstatus on 1
  /var %NumTimers = $ini(FarmingTimers.ini, Timers, 0)
  /did -r $dname 204
  while ( %NumTimers > 0  ) {
    /did -as $dname 204 $ini(FarmingTimers.ini, Timers, %NumTimers)
    /dec %NumTimers
  }
}

;Used to remove one timer
on 1:dialog:farmingtimer:sclick:205:{
  if ($did($dname,204)) {
    /remini FarmingTimers.ini Timers $v1
    /did -d $dname 202 $didwm($dname,202,$+($v1,*))
    /did -d $dname 204 $did($dname,204).sel
  }
}

;Removes all the timers
on 1:dialog:farmingtimer:sclick:206:{
  /var %confirm = $input(Are you sure that you wish to remove all current timers? This action is irreversible., yvgqau, Please Confirm?)
  if (%confirm == $no) /halt
  /did -r $dname 202,204
  .remini FarmingTimers.ini Timers
}

;Restarts a timer
on 1:dialog:farmingtimer:sclick:207:{
  if ($did($dname,204).seltext) {
    /writeini -n FarmingTimers.ini Timers $v1 $FTtime($gettok($v1,1,124),$gettok($v1,3,124))
    /Tstatus on 1
  }
}

;Restart all timers
on 1:dialog:farmingtimer:sclick:208:{
  if ($ini(FarmingTimers.ini, Timers, 0)) {
    /var %total = $v1
    while (%total > 0) {
      /var %TimerName = $ini(FarmingTimers.ini, Timers, %total)
      /writeini -n FarmingTimers.ini Timers %TimerName $FTtime($gettok(%TimerName,1,124),$gettok(%TimerName,3,124))
      /dec %total
    }
    /Tstatus on 1
  }
}

;Purges complete timers
on 1:dialog:farmingtimer:sclick:209:{
  if ($ini(FarmingTimers.ini, Timers, 0)) {
    /var %total = $v1
    while ( %total > 0 ) {
      /var %TimerName = $ini(FarmingTimers.ini, Timers, %total)
      if ($readini(FarmingTimers.ini, n, Timers, %TimerName) == Done) {
        /remini FarmingTimers.ini Timers %TimerName
        /did -d $dname 202 $didwm($dname,202,$+(%TimerName,*)))
        /did -d $dname 204 $didwm($dname,202,$+(%TimerName,*)))
      }
      /dec %total
    }
  }
}

;[FT_EDIT EVENTS]
;Farming Default Timers Edit Dialog
dialog -l ft_edit {
  title "Farming Timer Defaults Editor"
  size -1 -1 264 111
  option dbu
  tab "Editor", 100, 1 -1 261 99
  box "Create/Edit Patches", 101, 4 14 84 82, tab 100
  list 104, 7 23 78 47, tab 100 size vsbar
  box "Create/Edit Crops", 102, 90 14 84 82, tab 100
  list 105, 93 23 78 47, tab 100 size vsbar
  box "Create/Edit Locations", 103, 176 14 84 82, tab 100
  list 106, 179 23 78 47, tab 100 size vsbar
  button "Create", 109, 28 83 30 10, tab 100
  button "Delete", 108, 46 71 30 10, tab 100
  button "Rename", 107, 14 71 30 10, tab 100
  button "Rename", 110, 99 71 30 10, tab 100
  button "Delete", 111, 131 71 30 10, tab 100
  button "Create", 112, 99 83 30 10, tab 100
  button "Edit Time", 113, 131 83 30 10, tab 100
  button "Rename", 114, 186 71 30 10, tab 100
  button "Delete", 115, 218 71 30 10, tab 100
  button "Create", 116, 203 83 30 10, tab 100
  tab "Help", 200
  text "This tool allows you to modify the timers that are used in the 'Farming Timer' tool. Here you can remove patches, crops, and locations that you never use, or add new ones when they appear in game. You can also edit the time for crops to better suite your farm run, or when the game is updated. If you wish to remove all changes you made and restore the program to its initial state, in the main dialog go to Tools>Restore Defaults and follow the prompts.", 202, 7 23 250 35, tab 200
  box "Instructions", 201, 4 14 256 48, tab 200
  button "Quit", 1, 233 100 30 10, ok cancel
  text "Farming Timer Defaults Editor Created By: Crossfire39", 2, 69 101 145 8, disable
}

;When the dialog is created, fills in certain drop-down menus
on 1:dialog:ft_edit:init:0:{
  /FTupdatepatches $dname 104
  /FTupdatecl Crop $dname 105 $did($dname,104).seltext
  /FTupdatecl Location $dname 106 $did($dname,104).seltext
  /dialog -x farmingtimer
}

;When a new patch is selected in either Crop/Location
on 1:dialog:ft_edit:sclick:104:{
  /FTupdatecl Crop $dname 105 $did($dname,$did).seltext
  /FTupdatecl Location $dname 106 $did($dname,$did).seltext
}

;Renames a patch
on 1:dialog:ft_edit:sclick:107:{
  /var %NewName = $replace($input(Enter what you would like to rename $+(',$did($dname,104).seltext,') to. Press 'yes' when you are done or 'no' to cancel., eygqau, Enter New Name),$chr(32),$chr(95))
  if (!%NewName) /halt
  if ($readini(FarmingTimers.ini, n, Location, %NewName)) { /FTerror A patch named $+(',%NewName,') already exists! | /halt }
  /var %X = 3
  while (%X > 0) {
    /var %Section = $iif(%X == 3,Location,$iif(%X == 2,Crop,Time))
    /writeini -n FarmingTimers.ini %Section %NewName $readini(FarmingTimers.ini, n, %Section, $did($dname,104).seltext)
    /remini FarmingTimers.ini %Section $did($dname,104).seltext
    /dec %X
  }
  /did -d $dname 104 $did($dname,104).sel
  /did -as $dname 104 %NewName
}

;Deletes a patch
on 1:dialog:ft_edit:sclick:108:{
  /remini FarmingTimers.ini Location $did($dname,104).seltext
  /remini FarmingTimers.ini Crop $did($dname,104).seltext
  /remini FarmingTimers.ini Time $did($dname,104).seltext
  /did -d $dname 104 $did($dname,104).sel
  /FTupdatepatches $dname 104
  /FTupdatecl Crop $dname 105 $did($dname,104).seltext
  /FTupdatecl Location $dname 106 $did($dname,104).seltext
}

;Creates a patch
on 1:dialog:ft_edit:sclick:109:{
  /var %NewName = $replace($input(Enter what you would like the new patch type to be named. Press 'yes' when you are done or 'no' to cancel., eygqau, Enter New Patch Name),$chr(32),$chr(95))
  if (!%NewName) /halt
  if ($readini(FarmingTimers.ini, n, Location, %NewName)) { /FTerror The patch $+(',%NewName,') already exists! | /halt }
  /writeini -n FarmingTimers.ini Location %NewName [None]
  /writeini -n FarmingTimers.ini Crop %NewName [None]
  /writeini -n FarmingTimers.ini Time %NewName [None]-0
  /did -a $dname 104 %NewName
}

;Rename a crop
on 1:dialog:ft_edit:sclick:110:{
  /var %NewName = $replace($input(Enter what you would like to rename $+(',$did($dname,105).seltext,') to. Press 'yes' when you are done or 'no' to cancel., eygqau, Enter New Name),$chr(32),$chr(95))
  if (!%NewName) /halt
  /var %CropInfo = $readini(FarmingTimers.ini, n, Crop, $did($dname,104).seltext)
  if ($findtok(%CropInfo,%NewName,1,124)) { /FTerror The crop $+(',%NewName,') already exists within the $+(',$did($dname,104).seltext,') patch! | /halt }
  /var %CropTimeInfo = $readini(FarmingTimers.ini, n, Time, $did($dname,104).seltext)
  %CropTimeInfo2 = $wildtok(%CropTimeInfo,$+($did($dname,105).seltext,-*),1,124)
  %CropTimeInfo = $remtok(%CropTimeInfo,%CropTimeInfo2,1,124)
  /writeini -n FarmingTimers.ini Crop $did($dname,104).seltext $reptok(%CropInfo,$did($dname,105).seltext,%NewName,1,124)
  /writeini -n FarmingTimers.ini Time $did($dname,104).seltext $addtok(%CropTimeInfo,$reptok(%CropTimeInfo2,$did($dname,105).seltext,%NewName,1,45),124)
  /did -d $dname 105 $did($dname,105).sel
  /did -a $dname 105 %NewName
}

;Deletes a crop
on 1:dialog:ft_edit:sclick:111:{
  /var %CropInfo = $readini(FarmingTimers.ini, n, Crop, $did($dname,104).seltext)
  /var %TimeInfo = $readini(FarmingTimers.ini, n, Time, $did($dname,104).seltext)
  %CropInfo = $remtok(%CropInfo,$did($dname,105).seltext,1,124)
  %TimeInfo = $remtok(%TimeInfo,$wildtok(%TimeInfo,$+($did($dname,105).seltext,-*),1,124),1,124)
  /writeini -n FarmingTimers.ini Crop $did($dname,104).seltext $iif(!%CropInfo,[None],%CropInfo)
  /writeini -n FarmingTimers.ini Time $did($dname,104).seltext $iif(!%TimeInfo,[None]-0,%CropInfo)
  /did -d $dname 105 $did($dname,105).sel
}

;Creates Crops
on 1:dialog:ft_edit:sclick:112:{
  /var %NewCrop = $replace($input(Enter what you would like the new crop to be called. Press 'yes' when you are done or 'no' to cancel., eygqau, Enter New Crop Name),$chr(32),$chr(95))
  /var %NewCropTime = $input(Enter the average amount of time in minutes it takes $+(',%NewCrop,') to grow. Press 'yes' when you are done or 'no' to cancel., eygqau, Enter New Crop Growth Time)
  if ((!%NewCrop) || (!%NewCropTime) || (%NewCropTime !isnum)) /halt
  /var %CropInfo = $readini(FarmingTimers.ini, n, Crop, $did($dname,104).seltext)

  if ($findtok(%CropInfo,%NewCrop,1,124)) { /FTerror The crop $+(',%NewCrop,') already exists within the $+(',$did($dname,104).seltext,') patch! | /halt }


  /writeini -n FarmingTimers.ini Crop $did($dname,104).seltext $addtok($remtok(%CropInfo,[None],124),%NewCrop,124)

  /writeini -n FarmingTimers.ini Time $did($dname,104).seltext $addtok($remtok($readini(FarmingTimers.ini, n, Time, $did($dname,104).seltext),[None]-0,124),$+(%NewCrop,-,%NewCropTime),124)
  /FTupdatecl Crop $dname 105 $did($dname,104).seltext
}

;Edit A Crops Growing Time
on 1:dialog:ft_edit:sclick:113:{
  /var %NewTime = $input(The current growing time for $+(',$did($dname,105).seltext,') is $duration($calc($FTtime($did($dname,104).seltext,$did($dname,105).seltext) - $ctime),2). Enter what you wish to change this to(in minutes). Press 'yes' once you are done or 'no' to cancel., eygqau, Enter New Time)
  if ((!%NewTime) || (%NewTime !isnum)) /halt
  /var %TimeInfo = $readini(FarmingTimers.ini, n, Time, $did($dname,104).seltext)
  /var %TimeInfo2 = $wildtok(%TimeInfo,$+($did($dname,105).seltext,-*),1,124)
  %TimeInfo = $remtok(%TimeInfo,%TimeInfo2,1,124)
  %TimeInfo = $addtok(%TimeInfo,$puttok(%TimeInfo2,%NewTime,2,45),124)
  /writeini -n FarmingTimers.ini Time $did($dname,104).seltext %TimeInfo
}

;Rename a location
on 1:dialog:ft_edit:sclick:114:{
  /var %NewName = $replace($input(Enter what you would like to rename $+(',$did($dname,106).seltext,') to. Press 'yes' when you are done or 'no' to cancel., eygqau, Enter New Name),$chr(32),$chr(95))
  if (!%Newname) /halt
  /var %LocationInfo = $Readini(FarmingTimers.ini, n, Location, $did($dname,104).seltext)
  if ($findtok(%LocationInfo,%NewName,1,124)) { /FTerror The location $+(',%NewName,') already exists within the $+(',$did($dname,104).seltext,') patch! | /halt }
  /writeini -n FarmingTimers.ini Location $did($dname,104).seltext $reptok(%LocationInfo,$did($dname,106).seltext,%NewName,1,124)
  /did -d $dname 106 $did($dname,106).sel
  /did -as $dname 106 %NewName
}

;Deletes a location
on 1:dialog:ft_edit:sclick:115:{
  /var %LocationInfo = $readini(FarmingTimers.ini, n, Location, $did($dname,104).seltext)
  %LocationInfo = $remtok(%LocationInfo,$did($dname,106).seltext,1,124)
  /writeini -n FarmingTimers.ini Location $did($dname,104).seltext $iif(!%LocationInfo,[None],%LocationInfo)
  /did -d $dname 106 $did($dname,106).sel
}

;Creates a location
on 1:dialog:ft_edit:sclick:116:{
  /var %NewLocation = $replace($input(Enter what you would like the new location to be called. Press 'yes' when you are done or 'no' to cancel., eygqau, Enter New Patch Name),$chr(32),$chr(95))
  if (!%NewLocation) /halt
  /var %LocationInfo = $readini(FarmingTimers.ini, n, Location, $did($dname,104).seltext)
  if ($findtok(%LocationInfo,%NewLocation,1,124)) { /FTerror The location $+(',%NewLocation,') already exists within the $+(',$did($dname,104).seltext,') patch! | /halt }
  /writeini -n FarmingTimers.ini Location $did($dname,104).seltext $addtok($remtok(%LocationInfo,[None],124),%NewLocation,124)
  /FTupdatecl Location $dname 106 $did($dname,104).seltext
}

;[SCRIPT ALIASES]
;Quick way to turn timer on and off /Tstatus $1=on/off $2=time
Alias -l Tstatus {
  if ($1 == on) { /RefreshTime | .timerFarmingTimer 0 $2 /RefreshTime }
  else .timerFarmingTimer off
}

;Alias which throws error inputs /FTerror $1-=ErrorMessage
Alias -l FTerror $noop($input($1-, ogwau, Error))

;Alias which updates drop down menus with patch types /FTUpdatePatches $1=dialog $2=did
Alias -l FTupdatepatches {
  /did -r $1 $2
  /var %NumPatches = $ini(FarmingTimers.ini, Location, 0)
  while ( %NumPatches > 0  ) {
    /did -as $1 $2 $ini(FarmingTimers.ini, Location, %NumPatches)
    /dec %NumPatches
  }
}

;Alias which updates Crops/Location /FTupdatecl $1=Crop/Location $2=dialog $3=$did $4-=Patch
Alias -l FTupdatecl {
  /did -r $2 $3
  /var %PatchInfo = $readini(FarmingTimers.ini, n, $1, $4-)
  /var %NumToks = $numtok(%PatchInfo,124)
  while (%NumToks > 0) {
    /did -as $2 $3 $gettok(%PatchInfo,%NumToks,124)
    /dec %NumToks
  }
}

;Alias that returns the time for each plant $ftime(patch,crop)
Alias -l FTtime return $calc($gettok($wildtok($readini(FarmingTimers.ini, n, Time, $1),$2*,1,124),2,45) * 60 + $ctime )

;Alias that returns %true if any of the notifications are enabled
Alias Notice {
  /var %x = 107
  while (%x < 110) {
    if ($readini(FarmingTimers.ini, n, Settings, %x) == 1) /return $true
    /inc %x
  }
  return $false
}

;Refreshes timer values /refreshtime
Alias -l RefreshTime {
  /var %TimerNum = $ini(FarmingTimers.ini,Timers,0), %TotalDone = 0
  while (%TimerNum > 0) {
    /var %TimerName = $ini(FarmingTimers.ini, Timers, %TimerNum)
    if ($Readini(FarmingTimers.ini, n, Timers, %TimerName) == Done) {
      if ($dialog(farmingtimer).tab == 200) /did -o farmingtimer 202 $iif($didwm(farmingtimer,202,$+(%TimerName,*)) != 0,$v1,$did(farmingtimer,202).lines) %TimerName Done
      /inc %TotalDone
    }
    else {
      /var %y = $calc( $Readini(FarmingTimers.ini, n, Timers, %TimerName) - $ctime )
      if ( %y <= 0 ) {
        /writeini -n FarmingTimers.ini Timers %TimerName Done
        if ($readini(FarmingTimers.ini, n, settings, 107) == 1) .flash farmingtimer
        if ($readini(FarmingTimers.ini, n, settings, 108) == 1) .beep 3
        if ($readini(FarmingTimers.ini, n, settings, 109) == 1) $noop($input(%TimerName has expired. You can now go collect your crops., ogia, Timer Finished))
      }
      else {
        if ($dialog(farmingtimer).tab == 200) /did -o farmingtimer 202 $iif($didwm(farmingtimer,202,$+(%TimerName,*)) != 0,$v1,$did(farmingtimer,202).lines) %TimerName $duration(%y,3)
      }
    }
    /dec %TimerNum
  }
  if (%TotalDone == $calc($ini(FarmingTimers.ini,Timers,0))) /Tstatus off
}

;Alias which reates a fresh version of the FarmingTimers.ini file
Alias -l CreateFarmFile {
  ;Locations of different plots
  /writeini -n FarmingTimers.ini Location Tree Falador|Gnome_Stronghold|Lumbridge|Taverley|Varrock
  /writeini -n FarmingTimers.ini Location Spirit Etceteria|Port_Sarim|Brimhaven
  /writeini -n FarmingTimers.ini Location Hop Entrana|Lumbridge_Farms|Seers_Village|Yanille
  /writeini -n FarmingTimers.ini Location Herb North_of_Catherby|South_of_Falador|Port_Phasmatys|Ardougne|Troll_Stronghold
  /writeini -n FarmingTimers.ini Location Fruit Brimhaven|Catherby|Gnome_Maze|Gnome_Stronghold
  /writeini -n FarmingTimers.ini Location Flower North_of_Catherby|South_of_Falador|Port_Phasmatys|Ardougne
  /writeini -n FarmingTimers.ini Location Compost North_of_Catherby|South_of_Falador|Port_Phasmatys|Ardougne
  /writeini -n FarmingTimers.ini Location Calquat Tai_Bwo_Wannai
  /writeini -n FarmingTimers.ini Location Cactus Al_Kharid
  /writeini -n FarmingTimers.ini Location Bush Ardougne|Champions_Guild|Etceteria|Rimmington
  /writeini -n FarmingTimers.ini Location Bittercap Canafis
  /writeini -n FarmingTimers.ini Location Belladonna Draynor_Mansion
  /writeini -n FarmingTimers.ini Location Allotment North_of_Catherby|South_of_Falador|Port_Phasmatys|Ardougne|Harmony_Island

  ;Plant types at each plot
  /writeini -n FarmingTimers.ini Crop Tree Oak|Willow|Maple|Yew|Magic
  /writeini -n FarmingTimers.ini Crop Fruit Apple|Banana|Orange|Curry|Pineapple|Papaya|Palm
  /writeini -n FarmingTimers.ini Crop Bush Redberries|Cadavaberries|Dwellberries|Jangerberries|Whiteberries|Poison_Ivys
  /writeini -n FarmingTimers.ini Crop Hop Barley|Hammerstone|Asgarnian|Jutes|Yanillian|Krandorian|Wildblood
  /writeini -n FarmingTimers.ini Crop Allotment Potatoes|Onions|Cabbage|Tomatoes|Sweetcorn|Strawberries|Watermelon
  /writeini -n FarmingTimers.ini Crop Herb Guam Leafs|Marrentill|Tarromin|Harralander|Goutweed|Ranarr_Weed|Toadflax|Irit_Leaf|Avantoe|Kwuarm|Snapdragon|Cadantine|Lantadyme|Dwarf_Weed|Torstol
  /writeini -n FarmingTimers.ini Crop Flower Marigold|Rosemary|Nasturtium|Woad|Limpwurt
  /writeini -n FarmingTimers.ini Crop Compost Compost|Super_Compost|Tomatoes
  /writeini -n FarmingTimers.ini Crop Bittercap Bittercap_Mushroom
  /writeini -n FarmingTimers.ini Crop Cactus Cactus
  /writeini -n FarmingTimers.ini Crop Belladonna Belladonna
  /writeini -n FarmingTimers.ini Crop Calquat Calquat
  /writeini -n FarmingTimers.ini Crop Spirit Spirit

  ;Time to grow for each plant
  /writeini -n FarmingTimers.ini Time Tree Oak-140|Willow-220|Maple-300|Yew-380|Magic-460
  /writeini -n FarmingTimers.ini Time Fruit Apple-876|Banana-876|Orange-876|Curry-876|Pineapple-876|Papaya-876|Palm-876
  /writeini -n FarmingTimers.ini Time Bush Redberries-90|Cadavaberries-110|Dwellberries-130|Jangerberries-150|Whiteberries-150|Poison_Ivys-150
  /writeini -n FarmingTimers.ini Time Hop Barley-35|Hammerstone-35|Asgarnian-45|Jutes-45|Yanillian-55|Krandorian-66|Wildblood-75
  /writeini -n FarmingTimers.ini Time Allotment Potatoes-40|Onions-40|Cabbage-35|Tomatoes-40|Sweetcorn-55|Strawberries-55|Watermelon-75
  /writeini -n FarmingTimers.ini Time Herb Guam Leafs-75|Marrentill-75|Tarromin-75|Harralander-75|Goutweed-75|Ranarr_Weed-75|Toadflax-75|Irit_Leaf-75|Avantoe-75|Kwuarm-75|Snapdragon-75|Cadantine-75|Lantadyme-75|Dwarf_Weed-75|Torstol-75
  /writeini -n FarmingTimers.ini Time Flower Marigold-17.5|Rosemary-17.5|Nasturtium-17.5|Woad-17.5|Limpwurt-17.5
  /writeini -n FarmingTimers.ini Time Compost Compost-50|Super_Compost-50|Tomatoes-50
  /writeini -n FarmingTimers.ini Time Bittercap Bittercap_Mushroom-220
  /writeini -n FarmingTimers.ini Time Cactus Cactus-550
  /writeini -n FarmingTimers.ini Time Belladonna Belladonna-280
  /writeini -n FarmingTimers.ini Time Calquat Calquat-1200
  /writeini -n FarmingTimers.ini Time Spirit Spirit-3680

  ;Settings for the script
  /writeini -n FarmingTimers.ini Settings 107 0
  /writeini -n FarmingTimers.ini Settings 108 0
  /writeini -n FarmingTimers.ini Settings 109 1
}