I’m having a lot of trouble getting information about very simple scripting commands that I can use in “JAVA” for scripting a Space Simulator I am working on.
My 1st question is: Why do the scripts need to have variables or arrays passed down to them to be viable. Why cannot one just execute “A SCRIPT OF SOME SORT” and within that script name the objects you want manipulated, instead of all this child parent jive.
My 2nd question is: Why is there no simple sleep command. People have referenced this to me but it does not work in “Certain” scripts, why is this? this seems very stupid to me. It is very important to set sleeps in between commands for many reasons, yet this is a rarely documented command in many of the example scripts. Is it because the code runs along the frames or calculations in the case of physics???
My 3rd question is: The language is very strange to me. Using words like transform doesnt make much sense to me. What does the word transform mean in this programming language, its used for too many things to be specific. Is there a similar term which is more universal?
My 4rth question is: Why can’t I use with conditions, but instead have to write “if thens” after the initial condition. Everyones code I have referenced does the same thing. Why can’t I do something like:
if (suchandsuch suchandsuch) {}
instead i see
if (suchandsuch) else {
if (suchandsuch) {
}
}
just seems shady
Prelude) Do you want to use Unityscript or C#? There is no ‘JAVA’.
-
Learn the paradigm unity uses - it’s quite good. That said there’s nothing preventing you from having a single script that manipulates many objects.
-
There is a simple sleep command - it’s called co-routines. Can you give an example of what you want to do?
-
The Transform component contains data about the objects position, rotation etc. It’s got nothing to do with the programming language.
-
You can use . ’ != If else’ - they are different logical constructs.
Hello from another BIS coder,
NPSF3000 is essentially right, there is a paradim shift between the languages, one just has to get used to the mindset.
You can easily interact with multiple classes ( scripts ) at the same time. Timing is done via lower-level routines, coroutines are used along with a yield() for N seconds. In that way it’s closer to a BIS finite state machine ( FSM ).
The use of if-then-else vs logic operators is more a style thing than anything else, you certainly can use logical operators, but be sure to check the C# documentation on precendence as well as any shortcut actions the compiler does.
Feel free to contact me privately if you need more help.
There are a few ways to use .
I use this syle
if((blue)(red)(gree)) {
}
For else if
if(blue) {
Debug.Log(“hello”);
}
else if(red) {
Debug.Log(“hello”);
}
else {
green();
}
Hope these examples helped.
Sorry for being a prick I got this figured out. Thanks for your help guys. Here is a video I made with my new progress:
http://www.youtube.com/watch?v=caFDvgnPXNs&hd=1