# Learning Wooo!!! (Java)

hey, I need a bit of help really quick im sure its simple to solve but i cant find out where its exactly outlined which is which.

so im trying to put multiple conitions for my IF statments and well i know you can do or || but idk which is what?

like i know one is for (this or that) and i think the other is (this and that)

bump for my new question up top please and thank you

= “and”
|| = “or”

A || B C || D

means

A or ( B and C ) or D

AND- A&B
OR - A||B
NOT - !A The N stands for NOT
NAND - !(A&B) Not A and B together
NOR - !(A||B)
XOR - (A!B) || (!A&B) X is like either or. not none or not both
XNOR - (!A!B) || (A&B) XN is not A AND B OR A and B

Don’t forget bitwise and | and the tertiary operator!

flagset = flagset  mask ? flag2 | flag3 : flag4 | flag5

Oh wait, we’re trying to be UNreadable. Silly me.

f=((a&b)?f:f2)&m?f3|f4:((b!c)?f3:f5)|f6

i actually understood his post very well and thank you all for the help.

ive actually gone on to get these operations to work and im currently working on a flamethrower type weapon that will have all the proper functions for things like being out of ammo, reloading, and overheating the gun

the next thing i kinda wanna know is how can i do onscreen recording to show progress cuz fraps i think hates me and doesnt wanna take video…

I hate to say this, but if your just learning how to program you really shouldn’t be trying to make an FPS . Its a good way to get frustrated with your own lack of progress

But for a flamethower your out of ammo condition would be something like a basic int compare .

So whatever your function for fireing the flames would be like

// in C#
public int Ammo ;
void FlameOn(){ // call this when you do something to fire off the flame
if(  Ammo != 0 )
{ // shoot fire code
}
else
{
// tell the user there out of ammo
}
}

well so u know at the title of my thread i said JAVA so im trying to learn java…and i never said im trying to make an FPS…im trying to make a 3rd person shooter comparable to alien swarm…i do understand that in an fps there are many complicated features that i would need to program since the player will be able to easily spot all of them.

i do appreciate your input and help but i feel i am progressing in a good direction

Then you are wrong here if you want to learn Java.

The first thing you’ll learn is: Unity3D doesn’t have Java support. It has UnityScript, Boo and C#. Java (in context of Unity3d) is only used for Android, because native Andorid Apps are in Java, iOS uses Objective-C.

For Android (API/Java), you should look at Android Developer Page or for Java sources for general Java learning (Google it)

Unityscript is often also called javascript so that might be the confusion and what he actually means.

UnityScript has not too much common with JavaScript and even less than with Java (which is more common with C#). First step to learn a programming language is knowing it’s name

Unity calls it ‘javascript.’ At least whenever I right-click, create, I’m given the option to make a new Javascript file.

Yes it’s Unityscript but oddly Unity doesn’t seem to know that. xD

ok…i dont mean to be an ass about this but ive been trying to teach myself what unity has been calling Javascript…and you guys are trying to say that its only mean for android programing…can i see some sort of documentation that explicitly says which scripting languages are for what…cuz if someone can find that for me ill switch over to some other script that will suit my needs…but as far as i can tell unitys javascript can still be built and ran for web and pc options so i dont see a problem…

Dude, learn to read. It’s been stated that Java is for Android (the only possibility in context of Unity.

Java is of course also used in Desktop development, as a server-sided (i.e. Java-powered websites and Webapplications with Tomcat Webserver) language, it is used in J2ME (for mobiles of pre-Smartphone era).

JavaScript on the other side is used in Websites to add dynamic content. What Unity actually uses is UnityScript (despite the fact Unity call it JavaScript it has almost NOTHING in common with JavaScript other than the syntax similarities - typical backfired marketing experiment).

You obviously fail to see that Java, JavaScript and UnityScript are three completely different languages. And that’s the first thing you should learn, before trying to learn programming

then give me links to back up what you are saying so i can learn this…i do understand that java, javascript are different now…i still dont get why unity isnt patching it to say unityscript rather than java. so just either be helpful or dont post its as simple as that…

Use Google or Wikipedia for Java/JavaScript and their usages.

Why did Unity called it JavaScript? As I said, most likely a marketing experiment which backfired. It’s easier to “lure” HTML and Flash Developers to Unity, when they call it JavaScript because it has similar syntax. But other than the syntax no “official” JavaScript (or ActionScript) tutorials will help you, because it’s different. Instead of having the desired “marketing effect” it is only causing confusion, because people assume that UntiyScript is same as JavaScript.

UnityScript is built on top of .NET/Mono Framework, while JavaScript has it’s own set of functions and is not based on any underlying runtime (And JavaScript and Java have nothing in common, just the name. The syntax is completely different).

probably because they don’t want to scare away people who do know basics of ECMA script, of which javascript (web flavors) and javascript (unity script) are only 2 dialects. Actionscript itself is also an ECMA script dialect.

But, back to the question of why Unity doesn’t just advertise it as Unityscript. IMO, it is because “Unity script” looks proprietary and people shy away from learning closed languages. Since it is an ECMA dialect, it’s easier to advertise as the closest popular ECMA dialect it is similar to, which is javascript.

As Tseng Democre mentioned, unityscript would likely shy away people new to learning a coding/scripting language as it does seem proprietary. That was the case for me too, and straight off the bat I realized it was similar in syntax as javascript but definitely a lot different considering I’ve used web javascript in the past. The similarities however were enough to draw me into continue using unityscript, and without the marketing word ‘javascript’ I don’t know if I’d of given unityscript a chance. Maybe I’d of learnt C#, which would’ve been better considering, but it made it easier on myself working with a syntax I already mostly understood.

This is also why I didn’t learn much of UDK, because of it’s proprietary Unreal Script and also due to it’s complexity and licenses/costs.

The point is, it is proprietary unlike C# and Boo. UnityScript is based on Boo, but has nothing in common with it syntax wise. The guy who did Boo (before joining UT) , also did UnityScript based on his Boo compiler