Author Topic: external libraries in nwn script  (Read 952 times)

Legacy_dandroid91

  • Newbie
  • *
  • Posts: 14
  • Karma: +0/-0
external libraries in nwn script
« on: July 14, 2011, 01:42:58 pm »


               Hello,

I was wondering if it is possible to use non nwnscript libraries when writing nwn script code and perhaps call functions defined in another language from within nwnScript. I was interested in writing a specific game component that I want to reuse for multiple games and was interested in whether I could test it with a neverwinter nights module without haing to write it in nwnscript.

If nwn does not support this, is there any other toolset of some other bioware game that supports it? 

In case i do decide  to just rewrite that component in a specific scripting language, which of the rpg toolsets is the most potent? (I am interested in nwn 1, nwn 2, dragon age, kotor pretty much any of their rpgs)

I apologize, I have no knowledge at this point of modding any of their games, I just wanted some information from some experienced users so that i know whether these games are appropriate for what i need.

Thank you for your help.
               
               

               
            

Legacy_henesua

  • Hero Member
  • *****
  • Posts: 6519
  • Karma: +0/-0
external libraries in nwn script
« Reply #1 on: July 14, 2011, 03:00:07 pm »


               This might be possible using nwnx but I don't know its capabilities, someone else will have to weigh in.

Otherwise you are limited to NSS includes.
               
               

               
            

Legacy_CID-78

  • Sr. Member
  • ****
  • Posts: 261
  • Karma: +0/-0
external libraries in nwn script
« Reply #2 on: July 14, 2011, 03:08:45 pm »


               you can do it in both NWN and NWN2 by using databases, and allow your external code to access the same database. NWNX has this setup but you don't necissary need to use it to accomlish your goal.

the question is what are you going to use the external libraries for. webpages?
               
               

               
            

Legacy_dandroid91

  • Newbie
  • *
  • Posts: 14
  • Karma: +0/-0
external libraries in nwn script
« Reply #3 on: July 14, 2011, 04:03:09 pm »


               Thank you very much for the quick response. What I wanted was to just to tweak game content aspects through code that is extraneous to nwn script. A basic example of something that I would like to do would be: my external code checks the players status and if he's low on hitpoints (by reading some data from somewhere), tells the game to spawn some healing potions in a chest in the next chamber (this last spawning thing is of course accomplished by nwnScript - my external would just send a message like "give health" and the nwnScript will know what function to call to cater for that). The reasons I'm doing this is that I want that particular piece of code to run stuck to other games too, maybe with just a few tweaks here and there.

So what you are saying is that you can access disk stored databases in nwnScript? Then yes, I could just make some protocol of communication between the 2 processes so they exchange information by writing and reading from that shared memory region (the database).

Would this be the best course of action? If I wanted to do the same with some other bioware rpg toolkit, would a similar solution be available? Many thanks again for your support.
               
               

               
            

Legacy_henesua

  • Hero Member
  • *****
  • Posts: 6519
  • Karma: +0/-0
external libraries in nwn script
« Reply #4 on: July 14, 2011, 04:57:56 pm »


               You aren't going to be able to do this by using databases only. The bioware database alone will not let you do this, and the built in database is the only database that NWN has access to (without help). Also, you need something other than NWN to execute the code in the database.

NWNX is an "external" as CID-78 says - that is additional software that you run around NWN. NWNX is your best bet in my opinion for doing this with NWN.
               
               

               


                     Modifié par henesua, 14 juillet 2011 - 03:59 .
                     
                  


            

Legacy_CID-78

  • Sr. Member
  • ****
  • Posts: 261
  • Karma: +0/-0
external libraries in nwn script
« Reply #5 on: July 14, 2011, 05:16:41 pm »


               Seriously, that kind of functionality should reamin wiithin NWscript. there is no need for a external process that checks HP. Unless you want to post the player current status on a webpage in which case only a simple one way communication is necissary. monitoring the player is best and easiest done within the game. adding external sources will only slow down the process.

I hope you got something better up your sleeve before going the NWNX approach. having a loot system that adapt to how much the player get hurt is a game feature that you can do in any bioware game. DA:O has it in the OC. ie depending on number of potions you carry and what difficulty you are playing on, effect the likelyhood of getting a potion in your next loot pile.
               
               

               
            

Legacy_henesua

  • Hero Member
  • *****
  • Posts: 6519
  • Karma: +0/-0
external libraries in nwn script
« Reply #6 on: July 14, 2011, 08:57:58 pm »


               CID-78 - I agree with you, but the original poster did say that he's trying to build up code libraries that he can move between different game engines. So its not that he wants to go beyond the capabilities of NSS but that he doesn't want to have to rewrite game behaviors.

I don't agree that its worth his time to use any non-commercial engine if thats his approach, but whatever.
               
               

               
            

Legacy_FunkySwerve

  • Hero Member
  • *****
  • Posts: 2325
  • Karma: +0/-0
external libraries in nwn script
« Reply #7 on: July 14, 2011, 10:04:46 pm »


               

dandroid91 wrote...

Hello,

I was wondering if it is possible to use non nwnscript libraries when writing nwn script code and perhaps call functions defined in another language from within nwnScript. I was interested in writing a specific game component that I want to reuse for multiple games and was interested in whether I could test it with a neverwinter nights module without haing to write it in nwnscript.

If nwn does not support this, is there any other toolset of some other bioware game that supports it? 

In case i do decide  to just rewrite that component in a specific scripting language, which of the rpg toolsets is the most potent? (I am interested in nwn 1, nwn 2, dragon age, kotor pretty much any of their rpgs)

I apologize, I have no knowledge at this point of modding any of their games, I just wanted some information from some experienced users so that i know whether these games are appropriate for what i need.

Thank you for your help.


In point of fact, this is exactly what some nwnx plugins, like NWNX_letoscript, do. They pass information by hooking local strings. Code written in letoscript is set in strings in nwnscript, and passed on to the editor when the character logs out. You can't compile it in this form, but you can certainly write it. Unless you have a very specific reason for doing this, however, as dragonsong did with letoscript, this is really not a good way to do things.

Funky
               
               

               
            

Legacy_Shadooow

  • Hero Member
  • *****
  • Posts: 7698
  • Karma: +0/-0
external libraries in nwn script
« Reply #8 on: July 14, 2011, 10:13:10 pm »


               <Fluffy-Kooshy> NWNx plugin is to this as nuclear warheads are to getting rid of fire ants.
               
               

               
            

Legacy_FunkySwerve

  • Hero Member
  • *****
  • Posts: 2325
  • Karma: +0/-0
external libraries in nwn script
« Reply #9 on: July 15, 2011, 12:03:14 am »


               

ShaDoOoW wrote...

<Fluffy-Kooshy> NWNx plugin is to this as nuclear warheads are to getting rid of fire ants.


Not really, in this case. You can't multiplatform with nwscript alone. Though I still love that quote in its original context. '<img'>

Funky
               
               

               
            

Legacy_CID-78

  • Sr. Member
  • ****
  • Posts: 261
  • Karma: +0/-0
external libraries in nwn script
« Reply #10 on: July 15, 2011, 07:07:27 am »


               i think He should look at the extended external compiler instead. you can simply add #IF, #ELSE for game specific code. and with one easy compile flag change it will run fine on any of the older bioware games. (DA:O excluded at the time). But NWNX only support NWN and NWN2 which basically share almost all common functions. so there is very little you need to change to get a system between the two games as it is.

So with a external compiler he get more out from having a nwscript library then he can ever get out from having a NWNX and a external execution.
               
               

               
            

Legacy_dandroid91

  • Newbie
  • *
  • Posts: 14
  • Karma: +0/-0
external libraries in nwn script
« Reply #11 on: July 15, 2011, 05:23:08 pm »


               Back at it guys. Thank you very much for your help. I can understand what you mean, and I think my overly simplistic example was confusing, sorry. I was just trying to illustrate in which way I would want to exchange data between a nwn and some external code. Even though I could code that entire functionality in nwn script as CID-78 suggested, my code will require some data outputted by some other process running simultaneously. All this in real time. The whole external code thing was more meant to act as an intermediary between the 2 (the game and the process that provides the useful output). Sorry if I am being confusing.

So again, the big picture is some process is outputting some data, the external code processes that data in some way, and passes some messages to the nwn code. I guess that would mean I have actually 3 processes running.
               
               

               
            

Legacy_dandroid91

  • Newbie
  • *
  • Posts: 14
  • Karma: +0/-0
external libraries in nwn script
« Reply #12 on: July 15, 2011, 05:32:23 pm »


               CID-78 What you said is perfectly valid if I want to reuse the code for games that run on nwn script but i wanted to use it on more than just those. henesua got my point. Worth my time or not, I was just curious with experimenting with this stuff.
               
               

               
            

Legacy_CID-78

  • Sr. Member
  • ****
  • Posts: 261
  • Karma: +0/-0
external libraries in nwn script
« Reply #13 on: July 15, 2011, 06:45:34 pm »


               can't you be a more specific in what you want todo. most computer only run one game/server at the time so what is it you trying to communicate with? and what is the data your exernal library need that the game doesn't provide?
               
               

               
            

Legacy_dandroid91

  • Newbie
  • *
  • Posts: 14
  • Karma: +0/-0
external libraries in nwn script
« Reply #14 on: July 15, 2011, 07:21:48 pm »


               the process that I'm trying to communicate with is not written by me, it's some sort of player state analyser (the actual human player) that gives data on player's state. All I know at the moment is that it provides some numerical data of the player's state, this gets picked by an intermediate module (which is my responsibility) and based on that data the intermediate sends messages to the game so it can make appropriate changes. Now my issue is: how to I get the intermediate process (which is some kind of interface between the 2 but does some processing of it's own) to communicate with the game? How can you implement in nwn script some form of message exchange with another running process? Which would be the right way to do it?
               
               

               


                     Modifié par dandroid91, 15 juillet 2011 - 06:22 .