https://pastebin.com/iGHLsM7P
start it near the ogres with cannon/cannonballs(or on the tile you want the cannon to be on)
sets up cannon
reloads the cannon
repairs the cannon
when you run out of cannonballs, picks up cannon and logs out(takes 1-2 minutes due to failsafes)
OSRS
You need to add a random delay when the cannon runs out of ammo to when you reload and re-fire it. It pretty much does it instantly every time and is very bot like. Other than that it works well.