Jump to content

NWScript implementation?


Sikon

Recommended Posts

NWScript is an excellent scripting language - lightweight, strictly-typed, extensible, etc. Most freely available embeddable scripting languages have very ugly, not C-style syntax.

I have several questions:

 

1. What scripting language has the most NWScript-like syntax? (Not speaking about the API at this time)

2. Is there a bytecode interpreter for ncs files?

3. Is it legal to write my own bytecode interpreter?

Link to comment
Share on other sites

  1. I'm not aware of NWS-like languages, but there is Lua if you want an embeddable scripting language (I presume you are writing your own application).
  2. NWN executable :D
  3. I guess you should read Bioware's EULA and visit their developers' section as Aurora is Bioware's engine.

Link to comment
Share on other sites

NWScript is an excellent scripting language - lightweight, strictly-typed, extensible, etc. Most freely available embeddable scripting languages have very ugly, not C-style syntax.

I have several questions:

 

1. What scripting language has the most NWScript-like syntax? (Not speaking about the API at this time)

2. Is there a bytecode interpreter for ncs files?

3. Is it legal to write my own bytecode interpreter?

 

NWScript is only one thing, bloody awful!

 

1. Lots of scripting languages use a C like syntax, quake C springs to mind, the main thing bioware did wrong was they wrote there own parser and screwed up slightly... Atleast from what I recall.

 

2. Can't answer that one right now, atleast not for sure, but I was under the impression it wasn't interpretered.

 

3. Pretty certain it wouldn't be.

 

Edit: realised I said it would be legal, I'm pretty sure it'd be illegal due to the fact I assume disessembly would be required.

Edited by @\NightandtheShape/@

RS_Silvestri_01.jpg

 

"I'm a programmer at a games company... REET GOOD!" - Me

Link to comment
Share on other sites

I hate Lua. And yes, there are C-style scripting languages, but they are either too heavy for embedding in simple projects or don't have the features I want: strict type checking, explicit variable declaration, and preferrably a byte-code layer, while avoiding overbloated syntax. When I saw NWScript, I thought it was just what I needed.

Link to comment
Share on other sites

I hate Lua. And yes, there are C-style scripting languages, but they are either too heavy for embedding in simple projects or don't have the features I want: strict type checking, explicit variable declaration, and preferrably a byte-code layer, while avoiding overbloated syntax. When I saw NWScript, I thought it was just what I needed.

 

If you really need a scripting language you could write your own ya know, but as I don't quite know what your after it's hard to say if the time investment is worth it, frankly if I needed a scripting language I'd write it, parser, warts and all.

 

So what do you need it for?

RS_Silvestri_01.jpg

 

"I'm a programmer at a games company... REET GOOD!" - Me

Link to comment
Share on other sites

Lua is a decent language once you get over the couple bumps it has.

 

Nwscript seems an odd choice given that if you want to write your own byte code interpreter you'd have to first learn what the byte code is; that's a lot of byte code to learn. Especially when you could just write your own language, parser, interface, and all and know, predicatably, what's going to happen.

 

Nwscript also has at least 2 known quirks (using nwnnsscomp anyway): 1) shortcircuiting does not work and 2) switch statements are bugged. It would be far easier to make your own language than have to learn over the course of a few hours (like TSLRP did for the switch statement) that the stack isn't being restored properly leading to erratic behavior unless you encase all statements in a case within a block :) .

Edited by Dashus

TSLRP

Propaganda Minister

 

Diagnostic result: I seem to have no personality whatsoever.

Link to comment
Share on other sites

@Sikon

Just out of curiosity, what project are you actually working on?

Why the requirements for strict typing, etc?

 

 

Lua may be not the best language, but it has been around for some time, and it has less bugs than your own scripting language would be if written from scratch. Also it has very liberal licence (free use for commercial projects).

Link to comment
Share on other sites

I'm thinking about a text game engine that uses dlg files of the KOTOR format and NWScript for customizing dialog nodes. The bytecode proved to be very easy to learn and the interpreter small and easy to write (I have already written most of it and it works with nwnnsscomp, although if you see the code you'll probably die of laughter).

The syntax properties are not a requirement for such a project, of course, but a matter of personal preference. I like NWScript and don't like Lua, that's all.

By the way, Dashus, can you please explain the bugs you mentioned? What is shortcircuiting and how to reproduce the bug with corrupted switch statements?

Link to comment
Share on other sites

I'm thinking about a text game engine that uses dlg files of the KOTOR format and NWScript for customizing dialog nodes. The bytecode proved to be very easy to learn and the interpreter small and easy to write (I have already written most of it and it works with nwnnsscomp, although if you see the code you'll probably die of laughter).

The syntax properties are not a requirement for such a project, of course, but a matter of personal preference. I like NWScript and don't like Lua, that's all.

By the way, Dashus, can you please explain the bugs you mentioned? What is shortcircuiting and how to reproduce the bug with corrupted switch statements?

 

Just watch yourself, you know how legal stuff can be...

RS_Silvestri_01.jpg

 

"I'm a programmer at a games company... REET GOOD!" - Me

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...