NoLimits 2 Roller Coaster Simulation

NoLimits 2 Roller Coaster Simulation

Not enough ratings
[.NLVM] - Basic scripting (English) [BETA: 0.1]
By Füchschen
The first basic steps in NLVM-Scripting
[BETA 0.1]
roughly translated by my own NLVM-Crashcourse @ http://www.no-limits-coaster.de/media/forum/viewtopic.php?f=8&t=51

English is not my first language, so forgive me, if my spelling isnt correct at some points...
But my syntax in NLVM should be 100% correct ;)
Anyway most of the time, you dont need to read the explenation here. Just copy the code and you will understand.

This is also, what you can expect here. Less text and more code (<- easy code)

those codes will be executed as plugins in NLVM. You dont need any SCOs or Coasters.
If you have any questions about a certain topic, that i haven't mentioned here, write down a comment and i will try to add your topic to
the guide.
   
Award
Favorite
Favorited
Unfavorite
What is NLVM?
NLVM means "Nolimits virtual machine" and is the script-engine for NL2
This engine is capable of manipulating some settings inside the simulator.

How do i create a .nlvm file?
  • create a new textdocument (rightclick on a folder -> new -> textdocument)
  • rename the file. Only numbers (0-9) and letters (a-z, A-Z)
  • no "space-key" allowed. Also don't use numbers at first.
  • to change this file to NLVM just rename the ending of the filename to .nlvm
Recommended programs:
Notepad++[notepad-plus-plus.org]

Plugins: Preperation
  • start the NL2 editor
  • no need to load a park
  • create a new folder (e.g: C:/workspace). but you can call it whatever you like.
  • inside the NL2 editor: go to Advanced - Tab and click on the button Execute Plugin
  • click on file system and navigate to your workspace

For Plugins
Plugins will be executed by an NL2Script-File. This must be created in order to run those plugins.
The file extension must be .nl2script
You can create this file the same way, you create a .nlvm file

<root> <script> <class>Same_name_as_your_NLVM_File__without_extension</class> </script> </root>

If your NLVM is called: hello_world.nlvm, you have to write between the <class>-tags:
<class>hello_world</class>
plugins: System.out.println();
System.out.println(); is a method to print text inside the console. its very good to test some steps of the script or message the user if something went wrong.

A very basic System.out.println(); - Code would be this one:
public class hello_world{ public static void main(){ System.out.println("Hello World"); } }

First you have to create the class-section. notice, that the class has the same name,
as your file.
If your file is called: MyScript.nlvm
then the class must be: public class MyScript{

Next there is the main-section.
Inside of this section, there is finally the System.out.println.

If you want to print text, you have to put the text inside of quotes.

After you saved this script-block in your NLVM-file.
To start the script, you'll have to go to the NL2 editor
  • go to advanced tab
  • click on execute plugin
  • click on file system and navigate to your workspace
  • select your nl2script-file (that links to your NLVM-file) -> mentioned one topic earlier
  • press OK

The result should be:
Hello World

Plugins: String
Open the .NLVM-file from the last topic.

A String is a data type, that contains text.
Just modify your last code like this:
public class hello_world{ public static void main(){ String My_Text_String = "My Awesome Text <3" System.out.println(My_Text_String); } }
Notice, that System.out.println(My_Text_String); doesnt contain quotes anymore, but the
data inside of String My_Text_String
If i had used quotes for My_Text_String inside of System.out.println
the result would be different.

Result:
without quotes inside of System.out.println
My Awesome Text <3
with quotes inside of System.out.println
My_Text_String
Plugins: Integer / int
Open the script from the last topic.

This topic is about the data type: int.
this data type contains integer numbers (positive and negative)

Change your last script like the following one:
public class hello_world{ public static void main(){ int output= 42; System.out.println(output); } }

The line with String is replaced by int output= 42;
this time, there arn't any quotes.

the result should be:
42
Plugins: Combine data types
Open your script from the last topic

This time, we want to combine a number with a string.
public class hello_world{ public static void main(){ String Output_1= "The meaning of life is: "; int Output_2= 42; System.out.println(Output_1+Output_2); } }

the first line is a string with a text.
the secound line is a integer number.

the System.out.println add both together.
Because one is a string and the secound not, the println - method dosn't aggregated
both to a strange number.

Plugins: Test your Skills!
This time i have a small riddle for you.
You can always go back to the last topics to copy and modify those scripts i have shown
you to solve the test.

public class hello_world{ public static void main(){ String Output_1 = "The meaning of life is: "; int Output_2= 21; System.out.println(); } }

The result should be:
The meaning of life is: 42
Try to use bothe variables inside the System.out.println(); - brackets without modifying the values.

solutions:

#1:
public class hello_world{ public static void main(){ String Output_1 = "The meaning of life is: "; int Output_2= 21; System.out.println(Output_1 + ( Output_2 + Output_2 ) ); } }
the numbers inside the secound brackets are calculated first and than the result is combined to
the string

#2
public class hello_world{ public static void main(){ String Output_1 = "The meaning of life is: "; int Output_2= 21; System.out.println(Output_1 + ( Output_2 * 2) ); } }
here output_2 is multiplied by 2. i didnt mentioned it, but it also works, if you just write numbers behind variables.
Plugins: float and double
open your last script.

float are floating-point numbers (e.g; 1.3333 f )
In NLVM its mostly used for positioning and time calculation, so its
very important, that you know about it.
Its important, that you dont forget the f behind the number!
otherwise its a double precision value!

Double means "double precision" it needs more memory, what also means, its slower then float.
Its only used in the Math Class of NL2.
public class hello_world{ public static void main(){ float Float_var = 21.3333f; float Double_var = 42.3736466464; String calculation = Float_var + " + " + Double_var + " = " + (Float_var + Double_var ); System.out.println(calculation); } }
Why are there 3 "+"-signs in a row?
because i combied Float_var with the String "+" and then with a Double_var and a " = ".
After that i wrote down the actual calculation in brackets

The Result:
42.3736466464 + 21.3333 = 63.7069462832408

This is still a "Work in Progress" - Project ----- More topics coming soon!
There is a lot to do, but i hope this gives you a first
impression how NLVM works.

Im very sure, my scripting syntax is way better then my english grammar.
But luckly, this guide is all about the scripting syntax ;)

TODO (plugin-based scripting):
  • creating methods
  • creating multiple classes (+imports)
  • calling external methods
TODO (simulator scripting)
  • literally everything :/

It will take a lot of time until this guide is finised, because
(unlike the NL2 - Helpfile, i will try to explain every method used in NLVM)

And currently i only know how 95% of the methods works and im not completely sure how the other 5% works.
Besides of that, i also need to create the guide as simple as possible. It could happen, that i skip important points.
4 Comments
deanna.berggren 19 Aug, 2017 @ 7:24pm 
wesjniwjesivodmk
TS_Mind_Swept 20 Jul, 2015 @ 12:15pm 
WHAT DOES THE SOCK SAY?!
glerp 6 Nov, 2014 @ 10:43pm 
Very good!
.Oracle ⁧⁧𝓦𝓣ℱ ® 2 Sep, 2014 @ 2:30pm 
Nice! I'm sure this will help many people. :D: I'm definitely going to check out the updates on this one.