why every x seconds? why not do it at prayer %?
for the interaction:
RS2Object ALTER = closestObjectForName("Alter");
if(/*Condition you want to pray at*/){
if(ALTER != null){
alter.interact("Pray-at", true, true);
sleep(random(300, 900)):
}
}
i think (sorry if im wrong i am very tired and just woke up XD )
edit: id also add an animation/moving check but i wasnt sure if you'd be standing at time before praying