Advertisement
Guest User

NL2 script

a guest
Mar 24th, 2019
89
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.23 KB | None | 0 0
  1. import com.nolimitscoaster. * ;
  2.  
  3. public class test extends Script implements TrackTriggerListener {
  4. Coaster moncoaster = sim.getCoaster("le Huit");
  5. Section station = moncoaster.getSection("Station");
  6. Section inter = moncoaster.getSection("inter");
  7. SpecialTrack le_switch = moncoaster.getSpecialTrack("le switch");
  8. TrackTrigger montrigger = moncoaster.getTrackTrigger("pour_retour");
  9. int passages = 0;
  10.  
  11. public bool onInit() {
  12. montrigger.addTrackTriggerListener(this);
  13. le_switch.setSwitchDirection(0);
  14. inter.setBrakesOff();
  15. return true;
  16. }
  17.  
  18. public void onNextFrame() {
  19. if (station.isStationWaitingForAdvance()) {
  20. station.setStationLeaving();
  21. }
  22.  
  23. if (passages == 1) {
  24. le_switch.setSwitchDirection(1);
  25. }
  26.  
  27. if (passages == 2) {
  28. inter.setBrakesOn();
  29. le_switch.setSwitchDirection(0);
  30. if (le_switch.getSwitchDirection() == 0) {
  31. inter.setTransportsStandardBwdOn();
  32. }
  33. if (station.isTrainOnSection()) {
  34. station.setStationEntering();
  35. passages = 0;
  36. }
  37.  
  38. }
  39.  
  40. }
  41.  
  42. public void onTrainEntering(TrackTrigger trigger, Train train) {
  43. if (trigger == montrigger) {
  44. passages = passages + 1;
  45. }
  46. }
  47.  
  48. public void onTrainLeaving(TrackTrigger trigger, Train train) {}
  49.  
  50. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement