That script works? It looks like that while loop will never end because the adv variable is initialized once, and then neverchanges. If it does indeed work, then ignore this, but I would suggest instead:
while(my_adventures() > 40)
{
adventure( 1 , $location[Haunted Billiards Room] );
wait(3)...