nullism / clickingbad

Official Clicking Bad Repository
http://clickingbad.nullism.com
MIT License
232 stars 70 forks source link

Money "duplication" #121

Open ghost opened 10 years ago

ghost commented 10 years ago

This bug requires an auto-clicker capable of clicking, at least, 150 times per second. Amass enough money to buy two of any laundering service. Activate the auto-clicker while the mouse is above the sell button, then quickly move to the buy button, and back to the sell button. The time spent on the Buy button should be in the range of a quarter of a second. Make sure to sell all of the laundering services. Repeatedly doing this with proper timing can cause you to end with more money than you started.

montesse commented 10 years ago

I can confirm this bug happens on Chrome 31.0.1650.57 m and Firefox 25.0.1.

This appears to be a race condition between the buy_bank()/sell_bank() functions and the ticks() function. A fast enough clicker program can click the Purchase/Sell button faster than the game invokes the tick() function, resulting in selling the nth item for the (n+1)th amount or buying the nth item for the (n-1)th amount.

I believe the fix would be to invoke fix_banks() at the end of buy_bank() and sellbank(). I looked at the other buy and sell_ functions; buy_clicker(), buy_seller() and buyupgrade() already call their corresponding fix functions. The other two sell functions don't, so perhaps you should add fix_sellers() to sell_seller() and fix_clickers() to sell_clicker() as well?

jwalt333 commented 10 years ago

The game "refreshes" every 100ms, so if you can get an auto-clicker to click twice within that 100ms time period, then you will get the duplication bug. It's really early in Perth at the moment, so don't hold me to this, but the bug should work for every button that is clickable.

I'll write a commit up now to insert @montesse corrections and hopefully it will be incorporated.