Well, making friends at work can be complicated. I tried very hard some time ago, and it didn't go well either. Feeling lonely can take you to those weird places where you don't know how to act (like what happened to you). I think you should first try some practices to stop being isolated first...