Jump to content
edmir31

Close COC while waiting for the troops to be Full

Recommended Posts

This code will help from staying 24 h online and just entring online for attacking. :)

Edit -> MyBot.run

Search -? If $CommandStop = -1 Then SetLog("====== Waiting for full army ======", $COLOR_GREEN)

Replace it with this:

 

If _Sleep($iDelayIdle1) Then Return
		
			 If $CommandStop = -1 Then
            SetLog("====== Waiting for full army ======", $COLOR_GREEN)
            ; SLEEP MODE
            If (($CurCamp/$TotalCamp)*100) < 200 Then
					; Close COC
                CloseCOC()
					; Sleeping for 20Minutes
				
				;If _Sleep(Random(500, 2000, 1)) Then Return
				$timewait = 1200000 * (1 - ( ($CurCamp+1) / ($TotalCamp+1) ) )	 ;1 200 000   = 20 min  time lefft to full army. 
				$timewait = $timewait +  Random(20000, 120000, 1) ; add an rendamly delay of 20 sec to 120 sec
				$timestr = ($timewait / 1000) / 60
			   
			   SetLog("====== Sleeping for"&  $timestr  & "  Minutes ======", $COLOR_GREEN)
                 					
				If _Sleep($timewait) Then Return
				
					; Open COC
                OpenCOC()
            EndIf
        EndIF

 

Save MyBot.run

Compile MyBot.run to x86

 

Enjoy sleeping while waiting for the troops to be finished.

 

 

 

 

Edited by edmir31
  • Upvote 1

Share this post


Link to post
Share on other sites
Just now, MR.ViPeR said:

lol you made it? congrats lol

 

 what's this so?

 

 

i dont linkedt to your post becouse i change every thing in the code.   

 

waitnig even if the army is full is an wasted time. this code make more randlmy wait and there isnt an wait more than 2-5 min if the camps are full.

Share this post


Link to post
Share on other sites

Doesnt work! Bot works normaly but it doesnt go in sleep mode. The only Thing i didnt is "Compile MyBot.run to x86" because i dont know what it means :-D

 

Share this post


Link to post
Share on other sites
1 hour ago, aquarius said:

Doesnt work! Bot works normaly but it doesnt go in sleep mode. The only Thing i didnt is "Compile MyBot.run to x86" because i dont know what it means :-D

 

 

Share this post


Link to post
Share on other sites

Your script contains bugs and give the below error, I solved it as below:

 

Edit -> MyBot.run

Search -? If $CommandStop = -1 Then SetLog("====== Waiting for full army ======", $COLOR_GREEN)

Replace it with this:

 

             If $CommandStop = -1 Then

            SetLog("====== Waiting for full army ======", $COLOR_GREEN)
            ; SLEEP MODE
            If (($CurCamp/$TotalCamp)*100) < 200 Then
                    ; Close COC
                CloseCOC()
                    ; Sleeping for 20Minutes

                ;If _Sleep(Random(500, 2000, 1)) Then Return
                Local $timestr
                $timewait = 1200000 * (1 - ( ($CurCamp+1) / ($TotalCamp+1) ) )     ;1 200 000   = 20 min  time lefft to full army.
                $timestr = $timestr +  Random(20000, 120000, 1) ; add an rendamly delay of 20 sec to 120 sec
                $timestr = ($timewait / 1000) / 60

               SetLog("====== Sleeping for"&  $timestr  & "  Minutes ======", $COLOR_GREEN)

                If _Sleep($timewait) Then Return

                    ; Open COC
                OpenCOC()
            EndIf
        EndIF

 

New Bitmap Image.jpg

Edited by godzellax0
Find the solution

Share this post


Link to post
Share on other sites

Godzellax0

I compiled your script and came with this error. This error appears after COC restarts from being turned off for 20mins

df454451cdfc4390d99601baee3c69eb.png

Edited by Renz_
clarification

Share this post


Link to post
Share on other sites

It doesn't look like either the original mod creator nor the person who wrote the "fixed" version actually tested their code. I've edited the main post with the correct code.

  • Upvote 4

Share this post


Link to post
Share on other sites
13 minutes ago, zengzeng said:

It doesn't look like either the original mod creator nor the person who wrote the "fixed" version actually tested their code. I've edited the main post with the correct code.

just an fyi your modification to the original code, you added a semi colon in front of the call function for opening and closing COC.

 

Here's what it should look like:

 

If _Sleep($iDelayIdle1) Then Return
         If $CommandStop = -1 Then
            SetLog("====== Waiting for full army ======", $COLOR_GREEN)
            ; SLEEP MODE
            If (($CurCamp/$TotalCamp)*100) < 200 Then
                    ; Close COC
                CloseCOC()
                    ; Sleeping for 20Minutes

                ;If _Sleep(Random(500, 2000, 1)) Then Return
                $timewait = 1200000 * (1 - ( ($CurCamp+1) / ($TotalCamp+1) ) )     ;1 200 000   = 20 min  time lefft to full army.
                $timewait = $timewait +  Random(20000, 120000, 1) ; add an rendamly delay of 20 sec to 120 sec
                $timestr = ($timewait / 1000) / 60

               SetLog("====== Sleeping for"&  $timestr  & "  Minutes ======", $COLOR_GREEN)

                If _Sleep($timewait) Then Return

                    ; Open COC
                OpenCOC()
            EndIf
        EndIf

Edited by Renz_

Share this post


Link to post
Share on other sites
Guest
This topic is now closed to further replies.

×