If you know anything programation language of at least logic it's easy, but grab a script already made and start modifing it for your needs.
that's how everyone starts.
Grab a bunch of farming scripts, try to understand what they mean and start from there.