Jump to content
  TPR Home | Parks | Twitter | Facebook | YouTube | Instagram 

The Official NoLimits/NL2 Help Thread


Recommended Posts

  • Replies 1.4k
  • Created
  • Last Reply

Top Posters In This Topic

Try defining the vector separately (in the appropriate places)

 

private Vector3f vectorName = new Vector3f(0,0,0);

private Vector3f vectorName2 = new Vector3f(0,0,0);

...

 

vectorName = Vector3f(0,time2,0);

vectorName2 = Vector3f(0,0-time2,0);

...

 

sco1.setRotation(vectorName);

sco2.setRotation(vectorName2);

 

etc...

Link to comment
Share on other sites

I'm afraid it didn't work, it left me with the error as: "error C60: Unknown method: vector3f(int,float,int)". However, it kind of pointed me in the right direction, with some slight adjustments (instead of just using the figure 1.501, I define it as give it the value of time2 when it reaches 1.501, and somehow it worked).

 

				case STATE_ROTATION:
				time2 += sim.getCurSimulationTickSec()/4;
				sco1.setRotation(0, time2, 0);
				sco2.setRotation(0, -time2, 0);
				
				if (time2 >= 1.501) 
				{
					test = time2;
					sco1.setRotation(0, test, 0);
					sco2.setRotation(0, -test, 0);
					time2 = 0;
					state = STATE_PLAYING;
				}
				break;

 

Now it's just a case of figuring out why "onNextFrame" stops processing.

Link to comment
Share on other sites

Sorry about the double post.

 

I think I've found out the reason why the state isn't updating in onNextFrame section of my script. For some reason, even though in the onTrainEntering section I am declaring state as STATE_ROTATION, the onNEXTFRAME section just seems to ignore it.

 

This is the bit of the script I'm using that is giving me the trouble (the (YES) and (NO) system error commands aare just there so I can keep track of what is happening in the script)

 

	public void onTrainEntering(TrackTrigger trigger, Train train) 
{
	state = STATE_ROTATION;
	
	switch (state)
	{
		case STATE_IDLE:
		break;
		case STATE_ROTATION:
		{

		System.err.println("(YES)");

		}
	}
	
}

public void onNextFrame(float tick)
{
	switch (state)
		{
			case STATE_IDLE:
			{
			if (stater == 0){
			System.err.println("(NO)");
			}
			if(stater >= 1)
			{	
				state = STATE_ROTATION;
				System.err.println("(YESyes)");
			}
			}
			break;

 

And this was the result:

test.thumb.jpg.440db259f08f78f0ff8ffff332e660e7.jpg

As long as state is STATE_IDLE, it will constantly print (NO), that single (YES) is the switch in "onTrainEntering" saying state has been changed to STATE_ROTATION

Link to comment
Share on other sites

That was just me experimenting ways to try and get it to work that I forgot to clean up.

 

import com.nolimitscoaster.*;


public class showTrigger extends Script implements TrackTriggerListener {
private static final String scoName1 = "DoorRight";
private static final String scoName2 = "DoorLeft";
private SceneObject sco1;
private SceneObject sco2;

private float time1 = 0;
private float time2 = 0;
private float pause1 = 0;
private float pause2 = 0;


private static final int STATE_IDLE = 0;
 	private static final int STATE_ROTATION = 1;
private static final int STATE_BACK_ROTATION = 2;
private static final int STATE_PLAYING = 3;
 	
 	private int state;	

public showTrigger() 
{

	
}


public bool onInit() 
{
	sco1 = sim.getSceneObject(scoName1);
	sco2 = sim.getSceneObject(scoName2);
	if (sco1 == null) 
	{			
		System.err.println("Object Not Found (sco1)");
		return false;
		
	}
	if (sco2 == null) 
	{			
		System.err.println("Object Not Found (sco2)");
		return false;
		
	}
	stater = 0;
	state = STATE_IDLE;
return true;
}



public void onTrainEntering(TrackTrigger trigger, Train train) 
{
	state = STATE_ROTATION;
	
               switch (state)
	{
		case STATE_IDLE:
		break;
		case STATE_ROTATION:
		{

		System.err.println("(YES)");

		}
	}
	
}
	
public void onTrainLeaving(TrackTrigger trigger, Train train) 
{
}

public void onNextFrame(float tick)
{
	switch (state)
		{
			case STATE_IDLE:
			{
                        System.err.println("(NO)");

			}
			break;
			case STATE_ROTATION:
			System.err.println("Object Not Found (YESyes)");
			   time2 += sim.getCurSimulationTickSec()/4;
			   sco1.setRotation(0, time2, 0);
			   sco2.setRotation(0, -time2, 0);
			   
			   if (time2 >= 1.57079633) 
			   {
				  pause1 = time2;
				  sco1.setRotation(0, pause1, 0);
				  sco2.setRotation(0, -pause1, 0);
				  time2 = 0;
				  state = STATE_PLAYING;
			   }
			   break;
			case STATE_BACK_ROTATION:
				time2 += sim.getCurSimulationTickSec()/4;
				sco1.setRotation(0, pause2-time2, 0);
				sco2.setRotation(0, -pause2+time2, 0);
				if (time2 >= 1.57079633)
				{
					sco1.setRotation(0, 0, 0);
					sco2.setRotation(0, 0, 0);
					state = STATE_IDLE;
				}
				break;
			case STATE_PLAYING:
			{
				time2 += sim.getCurSimulationTickSec();
				if (time2 >= 56) 
				{
					pause2 = pause1;
					time2 = 0;
					state = STATE_BACK_ROTATION;
				}
			}
			break;
		}
}	

}

 

Each of the "System.err.println" from "onTrainEntering" and below are just there to tell me if it's working (NO = state is still idle, YES = state has been changed to rotation, YESYES = STATE_ROTATION is actually playing out).

Link to comment
Share on other sites

So, I know nothing about scripting, but I want to know if anyone has created an Elevator yet? If so, and they are willing to share it, Id appreciate your help.

 

Thanks!

It's sort of possible at the moment if you use a transfer table in a specific way. The downside is that your train would be on it's side instead of upright,

Link to comment
Share on other sites

So, I know nothing about scripting, but I want to know if anyone has created an Elevator yet? If so, and they are willing to share it, Id appreciate your help.

 

Thanks!

It's sort of possible at the moment if you use a transfer table in a specific way. The downside is that your train would be on it's side instead of upright,

 

I have tried that, I was hoping i'd be able to turn it on its side, and then bank the track at 90* and make it, but there is no bank option for the table. GAH!

Link to comment
Share on other sites

Hello all!

I have a nagging issue on one of my NL2 designs.

I am doing a design with a Maurer-Sohne concept/idea. I completed the track work and fine-tuning the track and now adding supports. Everything was working well (during test runs), until I had the idea of playing around with different train configurations.

Recently, I have been going back and forth with idea of a single car and a double-car train. I decided to do a single car train (3 trains now) and everytime I play the ride the 1st train comes back to the station and stops in the final block brake before the station and does NOT move. I have dual-loading/unloading in the station.

What am I missing? Anyone can assist would be helpful.

-Thanks in advance!

Link to comment
Share on other sites

I believe it is a block script. I get an error message that the next train is occupying the same block (and the 2nd train is not stopping in the mid-course block brake. I did not write a specific script for the ride (I still am trying to learn how to write custom scripts). It is running in default mode I believe.

I changed some of the block brake and station parameters when I had the 2-car train and then I (thought) I changed the parameters back to original form when I went back to single car train.

Also, I noticed that the 2nd train in the station would unload/load, then move up to the 1st part of the station and open the harnesses again.

Link to comment
Share on other sites

I believe it is a block script. I get an error message that the next train is occupying the same block (and the 2nd train is not stopping in the mid-course block brake. I did not write a specific script for the ride (I still am trying to learn how to write custom scripts). It is running in default mode I believe.

I changed some of the block brake and station parameters when I had the 2-car train and then I (thought) I changed the parameters back to original form when I went back to single car train.

Also, I noticed that the 2nd train in the station would unload/load, then move up to the 1st part of the station and open the harnesses again.

Make sure if you have two stations (load and unload) the second one is unload only. If you are getting an error for two trains on one block, you may have a brake section that begins too late or is not strong enough.

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.

×
×
  • Create New...

Important Information

Terms of Use https://themeparkreview.com/forum/topic/116-terms-of-service-please-read/