You say that like they're necessarily causal/correlated.
When I was in high school I was clinically depressed, smoked weed every day, shoplifted whenever I could just for the thrill of it, failed most of my classes, and in my afternoons, late nights, and sometimes up to 6am, I was contributing to opensource, writing phpBB mods that thousands of people were using in their bulletin boards. My most popular mod had over 10,000 downloads. They even accepted me into the official mod approval team for a while.
And despite my obsession with coding and working on my career, I was also an adolescent delinquent.
Life is funny that way.
Learn from your past, take things from where they are today, and change the things that you can, now, going into the future.
There are other people like you today; some of them will do that, others will only continue to live in regret.
10 years from now you can be the person that they will look at and say "if I had only..."
From the more practical side- the time you spent 'wandering' can pay big dividends over those who are more tightly-focused, when you get to a more strategic role. Having tons of varied experience makes you a better communicator, teacher, & leader...
We came to the conclusion that no matter the path of life you end up taking, you'll regret missed opportunities. I could have studied hard since 9 years old, skipped high school and be a PhD now or something, but then I'd probably talk with some people and start regretting that I haven't the time to read the books and watch the movies that could have shaped my imagination.
So the real advice is - instead of obsessing over the road not taken, focus on what comparative advantage you got from your experiences. Even if you "wasted" half your life drinking with random people, there's still a lot to learn and use from those experiences. The reason we have brains is to figure out how to make the best of what we have.
I decided to become a musician when I was 15 and wasted 6 years pursuing the unrealistic dream. I somehow managed to gave up the dream and became interested in computing in college. I sometimes wish I had become interested in programming instead of drums in junior high, but those 6 years of hustles taught me a lot about team management, entrepreneurship, and how to learn new things. So I don't think I wasted 6 years. As Paul Graham says, you should explore when you are young.