Not signed in (Sign In)

Discussion Tag Cloud

Categories

Vanilla 1.1.9 is a product of Lussumo. More Information: Documentation, Community Support.

    •  
      CommentAuthorrcth
    • CommentTimeJun 27th 2016
     
    This is a bigger question than probably suitable for the scripting ask thread, so here is my issue:

    I created a script for my Rock'n Roller Coaster track, made with a friend. The BlockScript is finished and it works well. Because I want my script to be realistic, I'm adding a few things:
    * Emergency brakes at the end of the launch. In case of too slow/too fast, this will stop the train.
    * The train goes a little bit backwards before the launch, to connect with the catch car.

    The emergency brake gave me a lot of trouble. Because I want to control it, I have to make that a block brake instead of a trim brake. And because it is a block brake now, the script also thinks it can be used as a regular block, so when a train passed the emergency brake, the second train can launch already. That way there will be a block incursion because two trains will be at the same block.

    I figured out to create a 'fake' blocking. Just after the station is a trigger. This trigger changes the boolean launchOccupied to true. A second trigger halfway the launch and zone A blockrun changes this boolean to false. That means the next train can dispatch from the station when the train in front is halfway the actual block, so if it would launch, the block is free because the train in front finished zone A.

    Another set of triggers is used for the boolean zoneAOccupied. At the beginning of the launch, this boolean is set to true and just after the brakes of zone A, the boolean is set to false.

    If launchOccupied is false, a train can dispatch. It's moving towards the launch zone. It is stopped and a count from 0 is started. If the boolean zoneAOccupied is false and the count is at least 5, the train should move backwards a bit. The launch sequence is now starting, because the block (zone A) is completely free.

    How the launch sequence should work (and it doesn't; that's why this thread): after it comes to a complete stop, it -just- hits a trigger that changes the boolean launchBackwards to true. This means the launch is occupied and moving backwards is allowed, as long as the 5 seconds are waited and the zone A is free. If this is the case, brakes are released and transports are turned on backwards. After a short move backwards, it hits another trigger, which will then change the boolean launchBackwardsReady to true. When this is true, the brakes are applied again and the transports turned off. The train will wait an undecided amount of seconds (depends on how long I'm making the sequence) and if these seconds are finished, the boolean launchFullyReady will turn true. Brakes are released and the launch transports are turned forwards.

    So, unfortunately, it doesn't work exactly as planned. The train stops fine, it starts counting, but the transports move FORWARD instead of BACKWARDS. The only way to let the train go backwards is by using setTransportsLaunchBwdOn(), but that's quite a rough move. And another problem: the train doesn't stop if going backwards.

    Anyone here able to help me out of this problem? I would like to have this part working, so I can work on other sections as well.

    The script:
    http://pastebin.com/19JJhsVY

    Area's of important code:
    - 16-19
    - 424-540, but especially 453-503
    - 848-867

    Thanks in advance for everyone helping me out here!
    •  
      CommentAuthorbestdani
    • CommentTimeJun 27th 2016
     
    Is it moving forwards or launching forwards instead of moving backwards? It looks good at the first quick glance, before I take some more time maybe tomorrow: Did you monitored the device settings in the "devices" tab of the coaster control panel already if they are really doing the correct thing or did you tried to move the train forward and backward with a dummy test script on this section to exclude any kind of nl2 bug?
    •  
      CommentAuthorrcth
    • CommentTimeJun 28th 2016
     
    I haven't monitored it yet, but I have now: Yes, in the devices tab, it's moving backwards, but in the sim it's moving forward.

    For upload purposes, I have created a quick dummy track (the normal track isn't completely done anyway). The blocks are the same, so you can test out what is wrong: Dropbox link
    •  
      CommentAuthorbestdani
    • CommentTimeJun 28th 2016 edited
     
    Very easy, no scripting issues and NL2 bugs, there are lots of unnamed transports that are pushing the train forward all the time.
    •  
      CommentAuthorrcth
    • CommentTimeJun 28th 2016
     
    That's either the launch or the transports behind the holding brake. How could I fix that? I'll also add names tomorrow to the transportsections.
    •  
      CommentAuthorrcth
    • CommentTimeJun 29th 2016
     
    I got it fixed by removing the transports before the launch. Thanks for the help Daniel!

    Last question so far: Brakerun A seems to have a problem. It's switching every tick between two block states. I can't figure out why it does that. Could you take a look? (In the same file)