You just hover over where you want to click then press F1 and add the script.
To create an intelligent battler you probably need to have a build specifically for the bot, such as the basic Mage build with max Lighting and Fireballs and high Dex to make it more powerful.