Community

AGI Programming => Mega Tokyo AGI Archive => Topic started by: Xqzzy Rcxmcq on October 03, 2003, 10:36:29 AM

Title: freakin' automatic doors!
Post by: Xqzzy Rcxmcq on October 03, 2003, 10:36:29 AM
Let's see...I'm making some automatic Star-Trek doors (to where when the ego approaches the door, it opens...when he gets farther away from the door (and it was open) it closes. I have been able to get it to open.

Code: [Select]
distance(ego,o1,v27);
if (v27 >= 15) {
end.of.loop(o1,f16);
}

 NOW...how in the world can you get the sucker to close? Could somebody please post the code for automatic doors? THANK YOU!
Title: Re:freakin' automatic doors!
Post by: Kon-Tiki on October 03, 2003, 11:27:03 AM
Ok, this might not be the best solution (I'm a bit rusty on my AGI), but it sure is a solution. Try this code:
Code: [Select]
distance(ego,o1,v27);
if (v27 >= 15) {
end.of.loop(o1,f16);
}

else {
  if(isset(f16)) {
     reverse.loop(o1);
     end.of.loop(o1,f17);
  }
}
if(isset(f17)) {
  reset(f16);
  reset(f17);
}

Hope that helps.
Title: Re:freakin' automatic doors!
Post by: Eigen on October 03, 2003, 01:18:59 PM
Why not use if(posn(near door

if(posn(o0,10,20,30,40)){  //posn to open door
if(!isset(f100)){
set(f100);
end.loop(o1);//door
return();
}
}
if(posn(o0,10,40,30,50)){  //close door, below the open door posns.
if(isset(f100)){
reset(f100);
reverse.loop(o1);
return();
}
}

This should work.

-Eigen