Author Topic: nwnx - loading external data to nwn  (Read 1416 times)

Legacy_henesua

  • Hero Member
  • *****
  • Posts: 6519
  • Karma: +0/-0
nwnx - loading external data to nwn
« Reply #15 on: March 23, 2016, 07:13:43 pm »


               

One word: nwn-lib



               
               

               
            

Legacy_meaglyn

  • Hero Member
  • *****
  • Posts: 1451
  • Karma: +0/-0
nwnx - loading external data to nwn
« Reply #16 on: March 23, 2016, 08:20:13 pm »


               

nwn-lib works on GFF files. Still not convinced the BLOB stored by SCORCO into mysql is a GFF file (but as I said, I could be wrong about that).   But nwn-lib by itself is not a solution to what was asked. What you really want is the toolset, it sounds like.   Aenea  had an player item build module which players used to create special items then export as erfs which AD would arrange to make available to the PC in game.  That way they had full access to the hak content and the 2das and the user interface.   Just a (stolen) idea...



               
               

               
            

Legacy_henesua

  • Hero Member
  • *****
  • Posts: 6519
  • Karma: +0/-0
nwnx - loading external data to nwn
« Reply #17 on: March 23, 2016, 08:36:34 pm »


               

My bad then.


 


I assumed the OP was talking about creating a web interface for editing assets in an external database or just folders on the server.



               
               

               
            

Legacy_meaglyn

  • Hero Member
  • *****
  • Posts: 1451
  • Karma: +0/-0
nwnx - loading external data to nwn
« Reply #18 on: March 23, 2016, 08:52:37 pm »


               

Nothing bad. I love nwn-lib '<img'>    The user friendly names and such makes it different though.  The SCORCO thing is my thing because I think it would be cool to be able to modify the persisted objects. But the OP did talk about exporting to/importing from nwnx strings so I was just extending that to NWNX persisted objects as a possible way to get around converting to string to pass the data into NWN and then parsing the string to figure out itemprops etc in nwscript to create the new item.  Using SCORCO, assuming you could modify/create the BLOB externally could make that a lot simpler.  nwn-lib could certainly be a part of a solution... (again assuming the blobs are GFF).


               
               

               
            

Legacy_Valgav

  • Full Member
  • ***
  • Posts: 118
  • Karma: +0/-0
nwnx - loading external data to nwn
« Reply #19 on: March 24, 2016, 12:12:10 am »


               I'm the one to be blamed for chaos in this thread. There are two problems. One is about parsing complicated logic to nwn. The other is outsourcing it to external calls which developed over the discussion.


Item example is a good one. We can use nwn approach and we have to parse all parameters like appearance,  properties,  item type etc. in game and provide them as String not structure.  Other approach is to built object outside and just pass the name of files to call resman/dynres to load it and create object from palette.


Sorry for making it complicated but I have habit to change and develop problems during the discussion '<img'>


So currently doing as much logic outside nwn sounds  like a better idea. I know about nwn-lib but there's still problem with parsing yaml to something easier to understand by human. Also I'm not sure for now if gff/yaml contain variables stored on object
               
               

               
            

Legacy_meaglyn

  • Hero Member
  • *****
  • Posts: 1451
  • Karma: +0/-0
nwnx - loading external data to nwn
« Reply #20 on: March 24, 2016, 01:19:12 am »


               

Any non-object variables should be there in the GFF file.   You could export the blob to gff, put that into a build module, tweak as desired, export erf, crack it open pull out the gff and insert/update it back into mysql.  I know that is not a web interface but it gives you all the human readable parts. The toolsset is more or less a fancy gff file editor after all.



               
               

               
            

Legacy_KMdS!

  • Sr. Member
  • ****
  • Posts: 364
  • Karma: +0/-0
nwnx - loading external data to nwn
« Reply #21 on: March 24, 2016, 04:15:46 am »


               


Still not convinced the BLOB stored by SCORCO into mysql is a GFF file (but as I said, I could be wrong about that).




I have done the testing. While the file exported by the database has the *.txt extension, the format remains GFF. Changing the extension of the fie to *.gff/uti, etc, will allow a specific editor read the file if the specific extension is required by the editor being used. '<img'> .  If you think about it, the gff structure must be preserved if you are going to "GetObject" the file data back into the server. NWNx does not interpret the file exorted, nor does it interpret the returning blob.


 


I now understand the request of the owner of the thread. You effectively want the toolset object editor in a web based gui. I am sorry to say that I am not aware of an actual GUI interface for RUBY. It would be a wonderful thing. I have an idea of what and how it might be done using php/moneo-nwnxleto/MySql, but it would be a bit of work. If it already exists, someone shine a light.



               
               

               
            

Baaleos

  • Administrator
  • Hero Member
  • *****
  • Posts: 1916
  • Karma: +0/-0
nwnx - loading external data to nwn
« Reply #22 on: March 24, 2016, 10:26:44 am »


               

nwn-tools.jar : allows the conversion of gff to xml.


XML can then be edited, and then recompiled back into gff for use in the game.


It seems that quite alot of people are using this approach in continuous integrations for deploying their module/pw.


Eg: They generate their module.ifo dynamically from the contents of their areas folder. etc


 


Eg:


<!-- This file was generated by the NWNTools GFF to XML writer.
     http://nwntools.sf.net/
     ** Do not hand edit unless you know what you are doing. **
 -->
<gff name="module.ifo" type="IFO " version="V3.2" >
    <struct id="-1" >
        <element name="Mod_ID" type="13" value="byte[16][1e][d6][9d][21][65][85][ac][e9][e9][41][4f][99][cd][33][32][7e]" />
        <element name="Mod_MinGameVer" type="10" value="1.69" />
        <element name="Mod_Creator_ID" type="5" value="2" />
        <element name="Mod_Version" type="4" value="3" />
        <element name="Expansion_Pack" type="2" value="3" />
        <element name="Mod_Name" type="12" value="-1" >
            <localString languageId="0" value="MyModule" />
        </element>
        <element name="Mod_Tag" type="10" value="MODULE" />
        <element name="Mod_Description" type="12" value="-1" />
        <element name="Mod_IsSaveGame" type="0" value="0" />
        <element name="Mod_CustomTlk" type="10" value="cep260" />
        <element name="Mod_Entry_Area" type="11" value="area001" />
        <element name="Mod_Entry_X" type="8" value="39.0" />
        <element name="Mod_Entry_Y" type="8" value="34.0" />
        <element name="Mod_Entry_Z" type="8" value="0.0" />
        <element name="Mod_Entry_Dir_X" type="8" value="0.0" />
        <element name="Mod_Entry_Dir_Y" type="8" value="1.0" />
        <element name="Mod_Expan_List" type="15" />
        <element name="Mod_DawnHour" type="0" value="7" />
        <element name="Mod_DuskHour" type="0" value="19" />
        <element name="Mod_MinPerHour" type="0" value="3" />
        <element name="Mod_StartMonth" type="0" value="6" />
        <element name="Mod_StartDay" type="0" value="1" />
        <element name="Mod_StartHour" type="0" value="13" />
        <element name="Mod_StartYear" type="4" value="1354" />
        <element name="Mod_XPScale" type="0" value="10" />
        <element name="Mod_OnHeartbeat" type="11" value="" />
        <element name="Mod_OnModLoad" type="11" value="_mod_load" />
        <element name="Mod_OnModStart" type="11" value="" />
        <element name="Mod_OnClientEntr" type="11" value="_on_client_enter" />
        <element name="Mod_OnClientLeav" type="11" value="_on_client_exit" />
        <element name="Mod_OnActvtItem" type="11" value="_on_activate_itm" />
        <element name="Mod_OnAcquirItem" type="11" value="_on_acquire_item" />
        <element name="Mod_OnUsrDefined" type="11" value="" />
        <element name="Mod_OnUnAqreItem" type="11" value="_on_unacquire" />
        <element name="Mod_OnPlrDeath" type="11" value="_player_death" />
        <element name="Mod_OnPlrDying" type="11" value="_on_player_dying" />
        <element name="Mod_OnPlrEqItm" type="11" value="_on_player_equip" />
        <element name="Mod_OnPlrLvlUp" type="11" value="" />
        <element name="Mod_OnSpawnBtnDn" type="11" value="_on_player_respa" />
        <element name="Mod_OnPlrRest" type="11" value="_on_player_rest" />
        <element name="Mod_OnPlrUnEqItm" type="11" value="_on_player_unequ" />
        <element name="Mod_OnCutsnAbort" type="11" value="" />
        <element name="Mod_OnPlrChat" type="11" value="" />
        <element name="Mod_StartMovie" type="11" value="" />
        <element name="Mod_CutSceneList" type="15" />
        <element name="Mod_GVar_List" type="15" />
        <element name="Mod_Area_list" type="15" >
            <struct id="6" >
                <element name="Area_Name" type="11" value="cep_starter_001" />
            </struct>
            <struct id="6" >
                <element name="Area_Name" type="11" value="darkawakening" />
            </struct>
            <struct id="6" >
                <element name="Area_Name" type="11" value="area001" />
            </struct>
            <struct id="6" >
                <element name="Area_Name" type="11" value="area" />
            </struct>
        </element>
        <element name="Mod_HakList" type="15" >
            <struct id="8" >
                <element name="Mod_Hak" type="10" value="cep2_add_doors" />
            </struct>
            <struct id="8" >
                <element name="Mod_Hak" type="10" value="cep2_add_loads" />
            </struct>
            <struct id="8" >
                <element name="Mod_Hak" type="10" value="cep2_add_skies" />
            </struct>
            <struct id="8" >
                <element name="Mod_Hak" type="10" value="cep2_add_tiles1" />
            </struct>
            <struct id="8" >
                <element name="Mod_Hak" type="10" value="cep2_add_tiles2" />
            </struct>
            <struct id="8" >
                <element name="Mod_Hak" type="10" value="cep2_build" />
            </struct>
            <struct id="8" >
                <element name="Mod_Hak" type="10" value="cep2_top_2_60" />
            </struct>
            <struct id="8" >
                <element name="Mod_Hak" type="10" value="cep2_add_phenos1" />
            </struct>
            <struct id="8" >
                <element name="Mod_Hak" type="10" value="cep2_add_phenos2" />
            </struct>
            <struct id="8" >
                <element name="Mod_Hak" type="10" value="cep2_add_phenos3" />
            </struct>
            <struct id="8" >
                <element name="Mod_Hak" type="10" value="cep2_add_phenos4" />
            </struct>
            <struct id="8" >
                <element name="Mod_Hak" type="10" value="cep2_add_phenos5" />
            </struct>
            <struct id="8" >
                <element name="Mod_Hak" type="10" value="cep2_core0" />
            </struct>
            <struct id="8" >
                <element name="Mod_Hak" type="10" value="cep2_core1" />
            </struct>
            <struct id="8" >
                <element name="Mod_Hak" type="10" value="cep2_core2" />
            </struct>
            <struct id="8" >
                <element name="Mod_Hak" type="10" value="cep2_core3" />
            </struct>
            <struct id="8" >
                <element name="Mod_Hak" type="10" value="cep2_core4" />
            </struct>
            <struct id="8" >
                <element name="Mod_Hak" type="10" value="cep2_core5" />
            </struct>
            <struct id="8" >
                <element name="Mod_Hak" type="10" value="cep2_core6" />
            </struct>
            <struct id="8" >
                <element name="Mod_Hak" type="10" value="cep2_core7" />
            </struct>
        </element>
        <element name="Mod_CacheNSSList" type="15" />
    </struct>
</gff>

               
               

               
            

Legacy_Valgav

  • Full Member
  • ***
  • Posts: 118
  • Karma: +0/-0
nwnx - loading external data to nwn
« Reply #23 on: March 24, 2016, 11:12:52 am »


               Is there any specific reason to use module.ifo instead of having files in folders and load them dynamically using resman/dynres?


Also I hate java but I must admit that xml seems to be a lot easier approach than yaml


EDIT: nwn-lib also contains conversion to xml
               
               

               
            

Baaleos

  • Administrator
  • Hero Member
  • *****
  • Posts: 1916
  • Karma: +0/-0
nwnx - loading external data to nwn
« Reply #24 on: March 24, 2016, 12:43:11 pm »


               

Well module.ifo is required in order to set the areas that are instantiated at startup.


It also sets the scripts, xp scale, day night times etc.


 


But yes - nwnx can set most of that anyway.


A module.ifo is required for it to be considered a valid module in any case.


It was just an example.


An IFO file is a gff structure, it was just being used to show how gff data can be represented as an XML, allowing you to construct your gff structures (items, creatures etc) outside of toolset , and then compile and import later.



               
               

               
            

Legacy_meaglyn

  • Hero Member
  • *****
  • Posts: 1451
  • Karma: +0/-0
nwnx - loading external data to nwn
« Reply #25 on: March 24, 2016, 01:00:29 pm »


               

@KMdS! Yes, I did the experiments once I got on a system where I could save an object. And updated one of my earlier posts with to that effect. I had just not ever seen it said before so needed to see it for myself '<img'>


 


nwn-lib, which is actively supported, does the conversion of GFF to editable text too. The yml support is better than the xml and is used more. YAML is also not as painful to look at as XML '<img'>


 


nwn-tools XML support has some bugs. It fails to handle some of the files like module.jrl.


               
               

               
            

Baaleos

  • Administrator
  • Hero Member
  • *****
  • Posts: 1916
  • Karma: +0/-0
nwnx - loading external data to nwn
« Reply #26 on: March 31, 2016, 09:25:39 am »


               

Note - I only mention this because I did experiments on it before.


nwnx_odbc StorePersistentObject does persist the gff object, albeit in the blob data field.


One way to export directly to its GFF file type is to Save the object to database, but grab an ID for where it is going (eg: its row/record number)


Then execute : 


 



select VAL into outfile "C:/mySword.uti" FIELDS TERMINATED BY '' ENCLOSED BY '' ESCAPED BY '' LINES TERMINATED BY '' STARTING BY '' from pwobjdata where id = 1; 



 


I tested this a few years ago, I was then able to take the uti file and use it successfully in toolset by dropping into the temp0 folder.


 


The inverse also works - taking a GFF object and putting it into the database, for spawning in nwn.



update pwobjdata set val = LOAD_FILE('C:/mySword.uti') where id = 1;




               
               

               
            

Legacy_virusman

  • Sr. Member
  • ****
  • Posts: 448
  • Karma: +0/-0
nwnx - loading external data to nwn
« Reply #27 on: March 31, 2016, 01:12:26 pm »


               

Yup, SCO/RCO serializes to and from GFF. You can convert that to JSON with nwn-lib and use any tool that works with JSON to make a fancy GUI around it. Then just convert JSON back to GFF to use with RCO or resman.



               
               

               
            

Legacy_KMdS!

  • Sr. Member
  • ****
  • Posts: 364
  • Karma: +0/-0
nwnx - loading external data to nwn
« Reply #28 on: April 01, 2016, 06:14:02 am »


               

select VAL into outfile "C:/mySword.uti" FIELDS TERMINATED BY '' ENCLOSED BY '' ESCAPED BY '' LINES TERMINATED BY '' STARTING BY '' from pwobjdata where id = 1; 


 



 


 


 


 


update pwobjdata set val = LOAD_FILE('C:/mySword.uti') where id = 1;

 


Thanks, never got around to writing the SQL statements myself. Should come in handy when I get around to tinkering.