Programing in Uncharted Universe is pretty easy, once you get to know how it works. Here i'll be showing you how to program in UU2 by explaining the documentation of programming in UU2. There are some parts that i couldn't get working such as the Remote command (the port was correctly set and it would execute all commands between Remote and EndRemote on the computer that ran the program), those are the ones i'll be skipping.

To get started, you must know the limits of the computer like what it can do and what it cannot (mostly to extinguish all the hype you have, i sure had some when i first started and learned that you could program a computer). To learn what it can do and what it cannot, the first place where you must look is at the documentation (Help Menu). But to save you the trouble, here is the summary in one line; It can compute, take input from a user(sadly not from any objects like a clock or a sign) and send trigger signal(sadly it cannot send data through those signals, like if you want to change the text of a sign, you should be able to trigger it while passing a data argument to it).

The beginning and end, each program must contain a forward slash(/) at the Beginning and End for it to run. Example:

/Print Hello World!/ 

Let's learn about variables, variables are like containers that store any type of data (could be a number, text, user Input, etc). In UU2 these variables are set using the SetValue command, most boolean commands require a variable or hard-coded data for it to run and return true or false. The commands that require data can be distinguished by the opening ( [ ) and closing brackets ( ] ) somewhat at the end of the command. Example: Look at the documentation of Programming, the first Boolean Command (CompareValue) requires two(2) different data you know this because you could see it has 4 brackets (2 opening and 2 closing)

You use variables in your code by including the "Value" key word. Example:

/SetValueHello World!//PrintValue/


In the documentation there is a section where it is titled, "Boolean Commands". These commands return True or False if the requirement is met with the data passed it. The first boolean command (CompareValue) is used to compare the value already stored in the variable to the value in the CompareValue argument (known as Data), the first argument that is required by this command (knows as Operator) must be one of the following: <,>,L,G,=. Example:

/SetValueHello//IfCompareValue=World//Print Its the same!//Else//PrintNope, not the same//End/  

This should print "Nope, not the same" since "Hello" is not the same as "World".

Second Boolean command (DetectTrigger) is used for knowing when the CPU has been triggered, this could be by a button or a TriggerWire attached to the CPU. As you can see, this does not require any arguments to return true or false. This command is best used with the Loop command, so it can always listen when it has been triggered, rather than trying to trigger it the second you run the program. Example:

/Loop/IfDetectTrigger//Print I've been triggeredd!//Else//Print Trigger Me!//End//EndLoop/  

NOTE: You must have attached some type of button to the CPU (You could attach a triggerwire to the CPU and a button to the triggerwire) in order for this to work.

Third Boolean command (DetectHeight) is used for knowing when the CPU reaches a certain height defined by the data passed in. This cold be useful in planes for alerting the pilot to not go higher to prevent him/her from going outside the planets atmosphere. Example:

/Loop//IfDetectHeight4000//Trigger//PrintOMG YOUR TOO HIGH//End//EndLoop/ 

This will trigger all parts connected to the computer (like a speaker), this could also be used as a gage for knowing your current altitude. Like *Dings*"You are at 100 Studs"... *Dings*"200 studs"...*Dings*"300 studs". I'll let you to program that as a challenge. :)

I'll be skipping the rest of the Boolean commands, you should have an idea on how these work by now. If not, play around with the top examples i have given you!

Structure Commands

Next section is Structure Commands. This will be relatively fast and easy so i guess i'll just include it all in this one paragraph. You must know what these are and how they are used (I USED THEM ON THE TOP EXAMPLES FOR CHEEZE ITS SAKE). In case you still don't understand, lets program with words! (You might ask, "how?!?!??!!?"). Well, it's not really programming more like planning how your program will run, it's also good for learning! Here it is:

/IF button triggers me//Print to the user i've been triggered//Else//Print to the user that nothing happened(this will run every time the Boolean command returns false)//End/ 

Now lets see that in UU2 code:

/IfDetectTrigger//Print Triggered!//Else//PrintNo triggered//End/ 

SEE?! EZ! Also, all boolean commands must begin with "If", i thought you knew that...


Next section Commands! We've been using them in previous examples so they are not so new.

First Action Command (SetValue) is used for storing some type of data. Example:

/SetValueThis Is Stored!//PrintValue/

Third Action Command (ModValue) is used to change the value if it is a number. This is mostly used for computing stuff. Example:

/Print There is a max of 3000 years left//Wait1//Print if year is 2678//SetValue2678//ModValue-3000//ModValue*-1//Wait1//Print There are: //Wait1//PrintValue//Wait1//Print years left until the universe collapses on itself!/   

This will return the years left (years in-game).

Fourth Action Command (Trigger) this is used to trigger any triggerable part like the speaker, a triggerwire, etc. The documentation is not very clear on how to get the "Number" of a triggerable part. But from trial and error, i have gathered that a part is assigned a number by the order in which you have attached it to the computer (i could be wrong, please comment if you know the true way of finding out the number of a triggerable part). Example:


This will just trigger all parts attached to the computer when the program runs

Fifth Action Command (SoundFile) this is used to change the pitch of a speaker! 1 makes the pitch lower, while a 9 makes it higher. 0 makes the program wait 0.2 seconds. Example:


Sixth Action Command (WaitForCMD) this is probably what you came here to see, this action is used to get user input through the command prompt (this along with SetValue can be used to store User Input!). Example:

/WaitForCMD//SetValueCMD//Print You have typed://Wait1//PrintValue/

Seventh Action Command (AddFile) this is used to add stuff to a file! As you can see this requires 2 different data types, a number and anything you want to put in the file. You must have a file at the slot number you specify. Example (Assuming you have the program on slot 1 and the file at slot 2. Also, create a file and just put one letter, you can't save an empty file.):

/Print Type ANYTHING!//WaitForCMD//SetValueCMD//AddFile2Value//Wait1//Print Check the file now!/ 

This can be used to store user orders!

Closing Statement

Well that concludes this page on programming, hopefully you learned a lot! If you have written any programs you are proud of, comment your setup (if you have any triggerable parts on) and then paste your code for others to use and modify! Happy Coding!