Page 1 of 2

What other languages do you know compare to Uscript?

Posted: Wed Mar 14, 2018 5:52 pm
by 'Zac
Hey guys, I've been curious about all you unreal script geniuses and coding wizards - what other languages do you know? and how do they compare to unreal script?
As a young teen, unreal script took it upon me as my first coding language that I actually got comfortable using and i love it, it was all I knew about coding until i branched out. Since then I've started to learn other languages ranging from Javascript, PHP, to C++ and Java in college, and the syntax is very similar and some resemblance can be made to Unreal Script. Java is definitely the closest language i think is most similar, though the engine is in C++, right? Anyway, just a fun thread I've been thinking about. I've been in college for computer science and seeing all these different languages I had no idea existed makes me realize I know so little.

So, what languages do you guys know and use? and why? are they similar to unreal script?

Re: What other languages do you know compare to Uscript?

Posted: Wed Mar 14, 2018 9:19 pm
by Hellkeeper
Latin of course.

Re: What other languages do you know compare to Uscript?

Posted: Thu Mar 15, 2018 1:59 am
by Feralidragon
UnrealScript was heavily inspired by Java, so they share a similar syntax, paradigm, and even the way they work (byte code in a virtual machine), that's why they're so similar.
Being made in C++ has no bearing how an actual language ends up looking like, even because languages built on top of C++ and C are meant to be better at doing something in particular.
Some of the languages you listed weren't even created as languages in the first place, and only evolved as such.


Having that said, I personally know plenty of languages, and my knowledge on each ranges from absolute beginner to a full expert depending on the language (PHP, Javascript, Lua, Python, Bash, etc, etc), just like most programmers.
However, the only language I can confidently say to be an expert at is PHP, given that it's the language I develop with for a living, and for several years already, and I have made a few frameworks with it and I am currently doing another one (open-source this time).

I could write a huge wall of text talking about all the great things, as well as all the awful things, about both PHP and UnrealScript, and how they contrast, but in summary: PHP is meant for web, such as sites, APIs, backend processes, and so on, and it's by far much more powerful than UnrealScript ever was, even until up to the point it was dropped in Unreal Engine 4, but it's also much much slower, probably one of the slowest languages in existence and its power is also its greatest weakness, with awful code from developers overall all around, it's not even funny.

Other differences include, but are not limited to:
- PHP is weak typed, while UnrealScript is strong typed;
- UnrealScript is fully object-oriented, while PHP has object-oriented features (classes, interfaces, etc) but is not object-oriented itself;
- UnrealScript needs to be explicitly compiled into byte code into a package in order to run, while PHP compiles each file individually and only when they're run;
- although UnrealScript is fully object-oriented, it is missing some object-oriented critical features such as "interfaces" (in Unreal Engine 1 at least), while PHP had them for a long time already;
- etc

From there, as for other languages, a love Lua a lot (especially LuaJIT, that thing is crazy fast, and I have used it in "conjunction" with PHP), and I hate Bash, Python and JavaScript, with burning passion (JavaScript I hate most of all, and I hate the fact that there's no escaping it).
As for C++ I don't have any strong feelings, it has all the things you could possibly want in a typed language, but also complicates a lot what would otherwise be simple tasks in other languages. Just getting the compiler to work is a daunting task.
As for Java, my only beef with it is its JVM. The language itself is great, the conventions and the overhead not so much, but it's one of the languages I know the least about.
C# looks like what Java wished it could be, but unfortunately it still screams Microsoft all over it, even with Mono, but I didn't do much with it, so I cannot really say much about it.

Re: What other languages do you know compare to Uscript?

Posted: Thu Mar 15, 2018 2:30 am
by Red_Fist
I did machine code - assembly on my old Atari 8bit 800xl, and makes more sense than all this syntax gibberish, for me.

Other than that I at least understand the syntax of BASIC, plus using line numbers. I can't figure this bracket crap out, "function" or whatever, and there is some correlation of some unknown thing that automatically works like a pair of () or a * or !

Like of I typed in a ! , why hell ya everyone knows what that does, LoL, I pretty much like BASIC. and not visual basic either, more freaky stuff that don't make sense.

Like
1 For I=1 to 10
2 print I
3 next I

Now if you write that in unreal or c++

would be
{!*((for=)))))) ++} -$%#$%#$^#%=10

Like WTF
:lol2:

Re: What other languages do you know compare to Uscript?

Posted: Thu Mar 15, 2018 2:20 pm
by Feralidragon
High-level programming languages use symbols pretty much in the same way they are used in math.
Everyone since way back from elementary school knows that "+" is for sum, "-" for difference, "*" to multiply, parenthesis to establish operation priority (like: 2 * (3 - 1)), and so on and so forth, and later on in life if you keep studying, you get to know more symbols, such as greek ones to represent specific things, and other kind of operators such as "!" after a number which in math represents a factorial.

From there, common symbols were established across most programming languages to also mean something specific so that everyone, within programming, knows what they mean.
Therefore generally when you know one language, you know most of the others too, even if their syntax or paradigm differs, they generally converge into using the same symbols for the same things.

For instance, "!" is "negation", for example: if (!is_enabled) -> check if is NOT enabled.
While parenthesis are used in the same way as in math to establish operation priorities, but also as a visual way to group things like parameters for a function block or control blocks such as "if", "for", "while" and other kinds of statements.
Curly braces are generally used to open and close such blocks of operations, defining where a function starts and where it ends for example.

Taking your loop example, in UnrealScript it would translate into this:

Code: Select all

local int l;

for (l = 1; l <= 10; l++) {
    //do stuff here
}
The "++" is a common operator across many different languages which means "increment this variable by 1", and can be used as "++l" or "l++", although there's an important difference between them I won't talk about right now.
In other words, "l++" could be rewritten as "l = l + 1" in this case.

And in C++, if my memory doesn't fail me, it would look like something like this:

Code: Select all

for (int l = 1; l <= 10; l++) {
    //do stuff here
}
which is very similar to UnrealScript, and plenty of other languages.

Re: What other languages do you know compare to Uscript?

Posted: Thu Mar 15, 2018 5:50 pm
by Red_Fist
Wow, well that is where I get all messed up, you can't see a structure of what happens first, second, 3rd, so I stare at the stuff not knowing what does what, is my major hang-up every time I try things.

I need line numbers, for my caveman thinking.

Like I assume the computer starts at zero and not having to declare an INT, I could see it starting at another number IF I needed to do that, but all that weirdness just to make a count from 0, and I lose the whole concept right from the get-go.

Re: What other languages do you know compare to Uscript?

Posted: Thu Mar 15, 2018 6:12 pm
by papercoffee
German count as coding language.
If you need a word for a thing, you compile it out of others.
For example:
EINE HOLZKISTE (a wooden crate), but the word order is important EINE KISTE HOLZ (a crate full of wood) is something totally different, even so they have the same words. In the first example is HOLZ the designation of material. We can go further and combine those two examples EINE HOLZKISTE HOLZ (a wooden crate full of wood). Now let's add a designation of origin EINE PORTUGIESISCHE HOLZKISTE HOLZ (a wooden crate full of wood from Portugal).
This is a totally legit sentence but as I said the order of the words is important... like in any other coding language.
EINE PORTUGIESISCHE KISTE HOLZ (a crate full of Portuguese wood)
EIN HOLZKISTEN PORTUGIESE (a wooden crate Portuguese) I don't even ...I invented a new sentence!


:ironic:

Re: What other languages do you know compare to Uscript?

Posted: Thu Mar 15, 2018 8:54 pm
by Feralidragon
It's curious how "wood" was the first thing that crossed your mind, and "Portuguese wood" no less. :tongue: :lol2:
Red_Fist wrote:Wow, well that is where I get all messed up, you can't see a structure of what happens first, second, 3rd, so I stare at the stuff not knowing what does what, is my major hang-up every time I try things.
Then let me translate that "for" into a "while" within the same language:

Code: Select all

local int l;

l = 1;
while (l <= 10) {
    //do stuff here
    l++;
}
is it clearer now for you?

As you can see, the order of the instructions is exactly the same as in the "for" itself, the only difference being that in the "for" they are horizontally in the same line, one after the other, while in a "while" they are vertically in different lines, but the order is the same.
There is no special magic going on here, these languages read the same as plain English: from left to right.

A "for" loop is pretty much a shorthand version of a "while" loop for when you have already a fixed number of loops determined from the start, which itself is a direct replacement of a "goto".
Whenever you're doing a loop, you're not required to use a "for", but programmers generally prefer "for" over "while", because all the control statements concerning the loop are at the beginning of the loop, and not scattered across it, lessening the chance of things like infinite loops over a missing "l++" for example, or a "l++" that gets never called due to a "continue" or some closed condition within the code itself.

Re: What other languages do you know compare to Uscript?

Posted: Thu Mar 15, 2018 10:14 pm
by papercoffee
Feralidragon wrote:It's curious how "wood" was the first thing that crossed your mind, and "Portuguese wood" no less. :tongue: :lol2:
Well, I use the "Holzkiste - Kiste Holz" example often to explain others how German works. And the "Portuguese" part was pure coincidence... but I see what I did there.
lol.

Re: What other languages do you know compare to Uscript?

Posted: Thu Mar 15, 2018 10:16 pm
by Red_Fist
Like how do you know where to put the semicolon, this is the stuff that keeps me from learning, more than inventing a new program.

I made a calculator in BASIC, although I had to use INPUT as a question if you wanted to multiply, add, subtract, divide. but by seeing the logical steps I could figure out how to see the subroutine and a way to go back to select again.
That was in 1980 or something, I wish I took programing way back when, instead of electronics. :mad2:

Re: What other languages do you know compare to Uscript?

Posted: Thu Mar 15, 2018 10:18 pm
by Pileyrei
I’m really in awe of you guys and your coding skills.

I’ve done a few basic websites in HTML5 and CSS.

C++, Unreal Script, etc......

I just don’t understand it :(

Re: What other languages do you know compare to Uscript?

Posted: Thu Mar 15, 2018 10:36 pm
by Barbie
Red_Fist wrote:how do you know where to put the semicolon
If you have done learning this I suggest having a look at regular expressions.
Example:
RFC 5322 General Email Regex

Code: Select all

(?:[a-z0-9!#$%&'*+/=?^_`{|}~-]+(?:\.[a-z0-9!#$%&'*+/=?^_`{|}~-]+)*|"(?:[\x01-\x08\x0b\x0c\x0e-\x1f\x21\x23-\x5b\x5d-\x7f]|\\[\x01-\x09\x0b\x0c\x0e-\x7f])*")@(?:(?:[a-z0-9](?:[a-z0-9-]*[a-z0-9])?\.)+[a-z0-9](?:[a-z0-9-]*[a-z0-9])?|\[(?:(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.){3}(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?|[a-z0-9-]*[a-z0-9]:(?:[\x01-\x08\x0b\x0c\x0e-\x1f\x21-\x5a\x53-\x7f]|\\[\x01-\x09\x0b\x0c\x0e-\x7f])+)\])

Re: What other languages do you know compare to Uscript?

Posted: Fri Mar 16, 2018 5:44 am
by Red_Fist
Barbie wrote:
Red_Fist wrote:how do you know where to put the semicolon
If you have done learning this I suggest having a look at regular expressions.


Example spoiler=RFC 5322 General Email Regex]

Code: Select all

(?:[a-z0-9!#$%&'*+/=?^_`{|}~-]+(?:\.[a-z0-9!#$%&'*+/=?^_`{|}~-]+)*|"(?:[\x01-\x08\x0b\x0c\x0e-\x1f\x21\x23-\x5b\x5d-\x7f]|\\[\x01-\x09\x0b\x0c\x0e-\x7f])*")@(?:(?:[a-z0-9](?:[a-z0-9-]*[a-z0-9])?\.)+[a-z0-9](?:[a-z0-9-]*[a-z0-9])?|\[(?:(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.){3}(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?|[a-z0-9-]*[a-z0-9]:(?:[\x01-\x08\x0b\x0c\x0e-\x1f\x21-\x5a\x53-\x7f]|\\[\x01-\x09\x0b\x0c\x0e-\x7f])+)\])
[/spoiler]
Smartass.

:loool:

Re: What other languages do you know compare to Uscript?

Posted: Fri Mar 16, 2018 7:33 am
by sektor2111
As a personal note and for checking brackets well VIA Notepad++ I'm always using EPIC style in placing brackets and not what I see here, I do not have a clue why a bracket (nowadays) needs to open after function at 3/30 TABS from left margin of the page and it is closing at 1 TAB distance. Is way difficult to track if bracket is closed properly. Sample:

Code: Select all

function FixSomething(Actor Other){
//some hackish stuff
}
written by others - and for me is not that fascinating, in my Script is a little wrapped - like EPIC DID

Code: Select all

function FixSomething(Actor Other)
{     //Remark with credits for the ass programming making you to write this function
//some hackish stuff
}
Because NotePad++ is capable of pointing a red-line when you hit a bracket and then you can track its open-close block boundaries looking to not have some remark opened inside ( /* ) else code will have a BIG compiling problem.

Re: What other languages do you know compare to Uscript?

Posted: Fri Mar 16, 2018 12:50 pm
by Feralidragon
Red_Fist wrote:Like how do you know where to put the semicolon[...]
The semicolon in a programming language is the equivalent to a period at the end of a sentence: it finishes a statement or an instruction.
An "if", "for", "while" and others are not statements, they are "control blocks", and generally they only use curly braces to define the block of code they are going to run, with a couple of exceptions (such as a "do while", which has a semicolon at the end given that the "control" part of the block resides at the end of the block instead of the beginning.

There are many languages however which do not use a semicolon at all, such as in the case of Lua, Visual Basic, Python, and also Javascript and Bash as long as you keep separate statements in different lines, which use new lines (Python, Visual Basic) or other syntactic rules (Lua, Javascript) to discern where a statement starts and where it finishes.

Now what exactly defines a statement depends on the language itself, but almost every language follows a common logic on this, whether or not they use semicolons, which is once again related with how you define things in math.
Declarations, assignments, function calls, returns and language constructs are statements:

Code: Select all

//declarations
var string someText;
local int l;

//assignments
a = f + 1;
l++;

//function calls
k = getK();
doStuff();

//returns
return;
return 100;

//language constructs
continue;
break;
In the case of a "for" loop, it's the only control block which also uses semicolons inside of it, and the reason for this is because each one of those 3 parts (as "l = 1", "l <= 10" and "l++") are actually 3 separate statements, just like I have shown above when I replaced the "for" with a "while".
sektor2111 wrote:As a personal note and for checking brackets well VIA Notepad++ I'm always using EPIC style in placing brackets and not what I see here, I do not have a clue why a bracket (nowadays) needs to open after function at 3/30 TABS from left margin of the page and it is closing at 1 TAB distance. Is way difficult to track if bracket is closed properly. Sample:

Code: Select all

function FixSomething(Actor Other){
//some hackish stuff
}
written by others - and for me is not that fascinating, in my Script is a little wrapped - like EPIC DID

Code: Select all

function FixSomething(Actor Other)
{     //Remark with credits for the ass programming making you to write this function
//some hackish stuff
}
Because NotePad++ is capable of pointing a red-line when you hit a bracket and then you can track its open-close block boundaries looking to not have some remark opened inside ( /* ) else code will have a BIG compiling problem.
Code style is always a subjective thing to discuss, it's mostly opinion based, but generally the decisions on those have to do with how easy is to read code.
Whenever you develop code you should do it as if you wanted someone else or even your future self to easily understand it.

Having that said, I think Epic has a really bad code style overall, except on function definitions.
I personally use a code style which is common in PHP, and which defines the positioning of curly braces as depending on what kind of block they are addressing, and which you can see a sample of here for example:
https://github.com/Feralidragon/php-fer ... ponent.php
It's PHP code but it should get the idea across.

Essentially, anything that is a class, method or function, I put the curly brace in a new line (Epic-style as you would put it), however for anything else, namely control blocks, they get to be in the same line, but with a space between the control part and the actual start of the block.
An exception for this however are anonymous functions, because in practice they act as control blocks themselves, but only some languages support them, with UnrealScript not being one of them.

For example:

Code: Select all

function int getAbsoluteSum(int a, int b)
{
    if (a < 0) {
        a = -a;
    }
    if (b < 0) {
        b = -b;
    }
    return a + b;
}
(this is just an example to show the style)

Why?

It has to do with a visual perception of the code. Being easy to read is the most important trait of the code from a maintainer's point of view, and the reason for this difference has to do with the separation of distinct units of logic in such a way that is quicker to discern them from each other.
Therefore, it's my opinion that, this:

Code: Select all

function doStuff()
{
    XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
    XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
    XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
    XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
    XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
    XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
    XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
}
is easier to perceive and read right away even from a distance than this:

Code: Select all

function doStuff() {
    XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
    XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
    XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
    XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
    XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
    XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
    XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
}
While for control blocks, this:

Code: Select all

function doStuff()
{
    if (some_condition) {
        XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
    } else {
        XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
        XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
    }
}
allows you to read more code and more neatly so as belonging to that one function, than this:

Code: Select all

function doStuff()
{
    if (some_condition)
    {
        XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
    }
    else
    {
        XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
        XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
    }
}
this last one just introduces too much empty space in an area meant to be much denser with code, and will make you scroll a lot more and move your eyes more, causing more eye and brain strain reading it.

But this is my opinion, and although is backed up by many many programmers, it's still all very subjective so there's no clear "right" or "wrong" style.
There are "completely wrong" styles for sure though, like putting 50 instructions in the same line, or having lines with 300 columns, or even having very long names given to variables and functions, but from there is all almost a political/religious debate on which style is best.