<script>
//simple profile to run stockade.
while (me.wowBotRun) {
  // You need to add code to reset instance here.
  //warning: this profile is a simple one, and it will keep running the instance.  You need to kill the bot to stop :-)
  //also, change the 2 me.wowTurnToRad() lines, you need to get your angle to the door and back for the bot to run in/out of instance correctly.  
  //Reset Instance here (use mouse moves etc)
  resetInstance();
  runStockade();
  me.wowSleep(1000);  //wait 1 seconds
}

function resetInstance() {
  //not tested code.
  me.wowMoveMouse(55,55);////Start out side instance 
    me.wowSleep(1000); 
   me.wowMouseClick(1); 
   me.wowSleep(1000); 
   me.wowMoveMouse(200,180); 
   me.wowSleep(1000); 
   me.wowMouseClick(0); 
   me.wowSleep(1500); 
   me.wowMoveMouse(540,214); 
   me.wowSleep(800); 
   me.wowMouseClick(0); 
   me.wowSleep(5000); 
}

//press up arrow, and wait till we are in instance.
function goInOutInstance() {
  me.wowSendKey( 0x26 , 1); 
  while (doUnsafeRefresh() == true && me.wowBotRun) {
    me.wowLog("Waiting for loading screen");
    me.wowSleep(1000);  
  }
  me.wowSendKey( 0x26 , 0);
  while (doUnsafeRefresh() == false && me.wowBotRun) {
    me.wowLog("Waiting for loading screen to end");
    me.wowSleep(1000);
  }
}

//returns true if we are no longer in loading screen
function doUnsafeRefresh() { 
  var refOK = me.wowUnsafeRefresh(); 
  if (refOK) { 
    me = new WowObject(); 
  } 
  return refOK; 
} 


function runStockade() {
  me.wowTurnToRad(0.75); //turn to instance door, you can get this value from show position button, last value (x y z rad)
  goInOutInstance();
  //load your instance profiles here.
  //in this example stockade.txt is in insts folder, to avoid waypoint messes.
  me.wowRunProfile("SFK/SFK5.txt","Travel");
  me.wowRunProfile("SFK/SFK5.txt","Reverse");
  me.wowTurnToRad(3.20);
  goInOutInstance();
}

</script>