Heya!
I was a bit curious about how similiar the NwnScript laungage is to Python? Im learning Python atm and it's working out quite well but I know that NwnScript is related to C.
You who have experience with NwnScript. How different is it from Python?
NwnScript, C, and Python
Moderators: Moderator, Developer, DM
-
Darker_Thought
- Posts: 490
- Joined: Wed Mar 10, 2010 1:23 pm
- Location: Sweden!
NwnScript, C, and Python
"NWNScript is what happens when you ask Satan to turn C into a scripting language." - DM Doom
-
Gorirah
- Posts: 58
- Joined: Fri Sep 09, 2016 11:20 am
Re: NwnScript, C, and Python
Hi,
Good to hear it's making sense so far.
The short answer to your question is just syntax.
NwnScript does have more syntax in common with the C languages (including Java), than it does with Python. But i'd say it shouldn't be much of a barrier, once you have learned your first programming language, regardless of which it is.
Languages are just different tools for the same job. You may need a lot of colons to express something in Python, or a lot of semicolons in C, but however the instructions are worded or dressed, they are ultimately the same building blocks.
What is more taxing than the differences in syntax, is the difference in programming environment.
You may learn a general language like Python, or some variant of C, and get used to using it under a particular OS, maybe Windows. Much of your coding may be numerous calls to external functions in the Windows DLLs. It takes more time to learn of thousands of these functions, than it does to learn the syntax of another language.
So, when you switch from developing for a different platform, i.e. Nwn2, it's more arduous to discover what its game library functions can do for you, than to adjust to the new layout.
Dip into the toolset, there are plenty of scripts in the official campaigns and once you've got Python by the horns, you maybe surprised how readily you can pick up a new language
Good to hear it's making sense so far.
The short answer to your question is just syntax.
NwnScript does have more syntax in common with the C languages (including Java), than it does with Python. But i'd say it shouldn't be much of a barrier, once you have learned your first programming language, regardless of which it is.
Languages are just different tools for the same job. You may need a lot of colons to express something in Python, or a lot of semicolons in C, but however the instructions are worded or dressed, they are ultimately the same building blocks.
What is more taxing than the differences in syntax, is the difference in programming environment.
You may learn a general language like Python, or some variant of C, and get used to using it under a particular OS, maybe Windows. Much of your coding may be numerous calls to external functions in the Windows DLLs. It takes more time to learn of thousands of these functions, than it does to learn the syntax of another language.
So, when you switch from developing for a different platform, i.e. Nwn2, it's more arduous to discover what its game library functions can do for you, than to adjust to the new layout.
Dip into the toolset, there are plenty of scripts in the official campaigns and once you've got Python by the horns, you maybe surprised how readily you can pick up a new language
-
DM Doom
- Posts: 2294
- Joined: Sun May 27, 2018 6:17 am
Re: NwnScript, C, and Python
Almost nothing in common aside from them both being an imperative language.Darker_Thought wrote: ↑Tue Sep 03, 2019 9:48 am Heya!
I was a bit curious about how similiar the NwnScript laungage is to Python? Im learning Python atm and it's working out quite well but I know that NwnScript is related to C.
You who have experience with NwnScript. How different is it from Python?
NwnScript is an abomination that doesn't even have arrays as a concept and borrows some syntax from C. That's all to it.
Python has generator expressions, bastardized class system (everything is public), decorators, module support, and powerful builtin library which includes such things as a http server (because reasons, I suppose).
As a language python offers very fast development speed when you need to write a short script, however due to use of duck typing and lack of compile time checks, it turns into major headache when used on large codebases. In case of Large codebases C++ reigns supreme, followed by other languages such as Java/C# which have more compile time checks than python.
Long story short, Python is a popular language with certain weaknesses, and many practical uses.
NWNScript is what happens when you ask Satan to turn C into a scripting language.
-
Darker_Thought
- Posts: 490
- Joined: Wed Mar 10, 2010 1:23 pm
- Location: Sweden!
Re: NwnScript, C, and Python
This is so good im stealing it for my signature
Thx for the replies!
"NWNScript is what happens when you ask Satan to turn C into a scripting language." - DM Doom