Jump to content

Recommended Posts

Posted (edited)

Hey folks,

Started again with autoit and what's better to learn some autoit with something fun? :P

anyways the things i have so far is:

1. Click for a cookie.

2. Cookie per sec.

3. 4 buyable upgrades 3 for CPS and 1 for additional cookies per mouse click.

next things i am planning to make is:

1. more upgrades.

2. better looking gui.

3. save/autoload and reset.

4. setting the decimal on 0,5. (idea from Blckpythn)

5. better upgrade costs

and the code sofar for anyone that want it is

#include <GUIConstantsEx.au3>


Global $Value, $ValuePS, $LVal, $LValPS, $Click, $ValPS, $Buy01, $02buy, $03buy, $Upgradebuy, $buy01, $buy02, $buy03, $UpgradeClick

Opt("GUIOnEventMode", 1)

$Value = 0
$Click = 1
$BuyIncrease = 1.1
$01buy = 10
$02buy = 50
$03buy = 100
$Upgradebuy = 10000

Main()

Func Main()
   GUICreate("Main", 600, 450)
   $LVal = GUICtrlCreateLabel( $Value& " cookies", 5, 5, 255)
   $LValPS = GUICtrlCreateLabel( $ValPS& " cookies Per second", 5, 25, 255)
   $Image = GUICtrlCreatePic(@ScriptDir & "\test.jpg", 5, 100, 75, 75)
   $UpgradeClick = GUICtrlCreateButton ("Upgrade Clicker - Cost "&$Upgradebuy, 5, 175,150)
   $Buy01 = GUICtrlCreateButton ("Cookie dealer - cost "&$01buy, 450, 150,150)
   $Buy02 = GUICtrlCreateButton ("Cookie market - cost "&$02buy, 450, 175,150)
   $Buy03 = GUICtrlCreateButton ("Cookie science - cost "&$03buy, 450, 195,150)
   GUICtrlSetOnEvent ($Image, "click")
   GUICtrlSetOnEvent ($UpgradeClick, "UpClick")
   GUICtrlSetOnEvent ($Buy01, "Buy01")
   GUICtrlSetOnEvent ($Buy02, "Buy02")
   GUICtrlSetOnEvent ($Buy03, "Buy03")
   GUISetState(@SW_SHOW)
   GUISetOnEvent($GUI_EVENT_CLOSE, "stop")
EndFunc

Func Buy01()
   If $Value>= $01buy Then
      $Value-=$01buy
      $ValPS+=0.1
      $01buy*=$BuyIncrease
      GUICtrlSetData($Buy01, "Cookie dealer - cost "&$01buy)
      GUICtrlSetData($LValPS, $ValPS&" cookies Per second")
      GUICtrlSetData($LVal, $Value&" cookies")
      else
      MsgBox (1, "Error", "Not enough cookies")
      EndIf
   EndFunc

   Func Buy02()
   If $Value>= $02buy Then
      $Value-=$02buy
      $ValPS+=0.7
      $02buy*=$BuyIncrease
      GUICtrlSetData($buy02, "Cookie market - cost "&$02buy)
      GUICtrlSetData($LValPS, $ValPS&" cookies Per second")
      GUICtrlSetData($LVal, $Value&" cookies")
      else
      MsgBox (1, "Error", "Not enough cookies")
      EndIf
   EndFunc

   Func Buy03()
   If $Value>= $03buy Then
      $Value-=$03buy
      $ValPS+=1.2
      $03buy*=$BuyIncrease
      GUICtrlSetData($buy03, "Cookie science - cost "&$03buy)
      GUICtrlSetData($LValPS, $ValPS&" cookies Per second")
      GUICtrlSetData($LVal, $Value&" cookies")
      else
      MsgBox (1, "Error", "Not enough cookies")
      EndIf
EndFunc

Func click()
   $Value+=$Click
   GUICtrlSetData($LVal, $Value&" cookies")
EndFunc

Func UpClick()
   If $Value>= $Upgradebuy Then
      $Value-=$Upgradebuy
      $Click+=1
      $Upgradebuy*=$BuyIncrease
      GUICtrlSetData($UpgradeClick, "Cookie science - cost "&$Upgradebuy)
      GUICtrlSetData($LVal, $Value&" cookies")
      else
      MsgBox (1, "Error", "Not enough cookies")
      EndIf
EndFunc

Func stop()
   Exit
EndFunc

While 1
   $Value+=$ValPS
    Sleep(1000)
    GUICtrlSetData($LVal, $Value&" cookies")
    GUICtrlSetData($LValPS, $ValPS&" cookies Per second")
 WEnd

feel free to give some ideas/tips to make it better^^

Greetz

Edited by satanttin
Posted (edited)

I like it, one thing I would change is the decimal increase in cookies. After only a few minutes I managed to get 74.89999999999 cookies. Maybe after the counter has reached 1.0+ cookies per second, remove the decimals from the current cookie count?

In fact, you may want to strip them entirely to avoid memory issues later.

Edited by blckpythn
Posted

I like it, one thing I would change is the decimal increase in cookies. After only a few minutes I managed to get 74.89999999999 cookies. Maybe after the counter has reached 1.0+ cookies per second, remove the decimals from the current cookie count?

In fact, you may want to strip them entirely to avoid memory issues later.

yeah that's true i have to take a look into that might be a while don't got that much time to code and don''t know how to do it:P will add it to the list. think the lowest CPS is going to be 0.5

  • 10 years later...
Posted (edited)

This sounds like a great project! You’ve already got the core mechanics in place, and adding more upgrades, better GUI, and save/autoload will make it even better. The mouse-click upgrade is a nice touch—more ways to boost cookie production always make it more fun. Looking forward to seeing how it evolves

Edited by AntoinetteBArnold
Posted

Welcome to AutoIt and the forum :)
You noticed that the thread is nearly 10 years old and the OP has left in October 2015?

My UDFs and Tutorials:

Spoiler

UDFs:
Active Directory (NEW 2024-07-28 - Version 1.6.3.0) - Download - General Help & Support - Example Scripts - Wiki
ExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example Scripts
OutlookEX (2021-11-16 - Version 1.7.0.0) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX_GUI (2021-04-13 - Version 1.4.0.0) - Download
Outlook Tools (2019-07-22 - Version 0.6.0.0) - Download - General Help & Support - Wiki
PowerPoint (2021-08-31 - Version 1.5.0.0) - Download - General Help & Support - Example Scripts - Wiki
Task Scheduler (2022-07-28 - Version 1.6.0.1) - Download - General Help & Support - Wiki

Standard UDFs:
Excel - Example Scripts - Wiki
Word - Wiki

Tutorials:
ADO - Wiki
WebDriver - Wiki

 

Posted
6 hours ago, water said:

Welcome to AutoIt and the forum :)
You noticed that the thread is nearly 10 years old and the OP has left in October 2015?

Seems to be a bot...

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...