logo logo

 Back to main page

The NWNX Community Forum

 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 
 
Alot of questions
Goto page 1, 2, 3  Next
 
Post new topic   Reply to topic    nwnx.org Forum Index -> Database related
View previous topic :: View next topic  
Author Message
Peskyone



Joined: 04 Nov 2005
Posts: 27

PostPosted: Fri Nov 04, 2005 17:29    Post subject: Alot of questions Reply with quote

Alright very very new to building..trying to add a teleport spell system. The creator suggests SQL so I followed the directions imported the erf into my mod added the dll file..made sure everything was set to SQL but where do i put the datebase? How do I make SQL file? He gave a example but when I plugged it into the mod script compiler it did not compile...does it go under NWN folder database? How do I make it a SQL file? I see no editor included with the download...

here is a example the creator provided

--
-- Table structure for table `teleport`
--

CREATE TABLE teleport (
Id int(10) unsigned NOT NULL auto_increment,
Spoken char(20) NOT NULL default '',
Target char(50) NOT NULL default '',
Familiarity char(20) NOT NULL default '',
FQHN char(255) NOT NULL default 'localhost.localnet',
Password char(20) NOT NULL default '',
Direction enum('None','Both','In','Out') NOT NULL default 'None',
Random enum('None','Both','In','Out') NOT NULL default 'None',
PRIMARY KEY (Id)
) TYPE=MyISAM;

--
-- Dumping data for table `teleport`
--


INSERT INTO teleport VALUES (1,'caverns','Caverns_below_Tower','TP_CAVERN','localhost.localnet','','Both','None');
INSERT INTO teleport VALUES (2,'containment','Containment_Area','TP_CONTAIN','localhost.localnet','','Both','None');
INSERT INTO teleport VALUES (3,'exterior','Tower_exterior','TP_EXTERIOR','localhost.localnet','','Both','None');
INSERT INTO teleport VALUES (4,'ground','Tower_ground_floor_Kitchen','TP_GROUND','localhost.localnet','','Both','None');
INSERT INTO teleport VALUES (5,'first','Tower_first_floor_Guest_room','TP_FIRST','localhost.localnet','','Out','None');
INSERT INTO teleport VALUES (6,'second','Tower_second_floor_Bedroom','TP_SECOND','localhost.localnet','','Both','Both');
INSERT INTO teleport VALUES (7,'third','Tower_third_floor_Library','TP_THIRD','localhost.localnet','','Both','None');
INSERT INTO teleport VALUES (8,'fourth','Tower_fourth_floor_Laboratory','TP_FOURTH','localhost.localnet','','Both','None');
INSERT INTO teleport VALUES (9,'portal','MD_SH_PORTAL','TP_EXTERIOR','localhost.localnet','','Both','None');


of course i had to paste with notebook..is there a sql editor? how and where do i put this after I adjust it to fit my areas?
Back to top
View user's profile Send private message Send e-mail
Peskyone



Joined: 04 Nov 2005
Posts: 27

PostPosted: Fri Nov 04, 2005 17:37    Post subject: Reply with quote

I guess to make my questions clearer they are..

1.How do I make a database file? and

2.Where do I put it after it is made?
Back to top
View user's profile Send private message Send e-mail
monezz



Joined: 03 Jan 2005
Posts: 52
Location: The Netherlands

PostPosted: Sat Nov 05, 2005 1:41    Post subject: Reply with quote

sql files basicly have nothing to do with nwn.
It are just plain text files with sql statements in it.

In youre case, copy the sample text and paste it into a file.
Give it the extention sql (ie something like teleport.sql) to recognize it as such in the future.
You can execute the statements in the file from the mysql command prompt with: \. path_to\teleport.sql
Back to top
View user's profile Send private message Visit poster's website
Peskyone



Joined: 04 Nov 2005
Posts: 27

PostPosted: Sat Nov 05, 2005 13:00    Post subject: Reply with quote

That answered it! Thank you ever so much
Back to top
View user's profile Send private message Send e-mail
Peskyone



Joined: 04 Nov 2005
Posts: 27

PostPosted: Tue Nov 22, 2005 17:08    Post subject: Reply with quote

Still doesn't seem to be functioning...where do i put the database file? in NWN? or on the mod itself?

Second question is there a seperate table file? and if so where does that go?
Back to top
View user's profile Send private message Send e-mail
Peskyone



Joined: 04 Nov 2005
Posts: 27

PostPosted: Tue Nov 22, 2005 17:10    Post subject: Reply with quote

monezz wrote:
sql files basicly have nothing to do with nwn.
It are just plain text files with sql statements in it.

In youre case, copy the sample text and paste it into a file.
Give it the extention sql (ie something like teleport.sql) to recognize it as such in the future.
You can execute the statements in the file from the mysql command prompt with: \. path_to\teleport.sql


Another question...i looked for where I am to put that prompt could you give me a example of where it goes?


; Use these two settings for the SQLite internal database
source = sqlite
file = sqlite.db

; Use these two settings for ODBC connections
;source = odbc
;dsn = nwn

; Use these five settings for MySQL connections
;source = mysql
;server = localhost
;user = nwn
;pwd = nwn
;db = nwn


does it go in this file somewhere?
Back to top
View user's profile Send private message Send e-mail
Acrodania



Joined: 02 Jan 2005
Posts: 208

PostPosted: Tue Nov 22, 2005 18:54    Post subject: Reply with quote

Peskyone wrote:
monezz wrote:
sql files basicly have nothing to do with nwn.
It are just plain text files with sql statements in it.

In youre case, copy the sample text and paste it into a file.
Give it the extention sql (ie something like teleport.sql) to recognize it as such in the future.
You can execute the statements in the file from the mysql command prompt with: \. path_to\teleport.sql


Another question...i looked for where I am to put that prompt could you give me a example of where it goes?


These lines say use an SQLite database, comment them out if you are going to use MySQL
Quote:

; Use these two settings for the SQLite internal database
source = sqlite
file = sqlite.db

; Use these two settings for ODBC connections
;source = odbc
;dsn = nwn

These lines tell you to use MySQL. UNCOMMENT them and set the correct parameters if you are going to use MySQL instead of SQLite
Quote:

; Use these five settings for MySQL connections
;source = mysql
;server = localhost
;user = nwn
;pwd = nwn
;db = nwn


does it go in this file somewhere?


Some comments which I think you are missing....

NWNX is actually THREE parts. First is the scripts that are imported into the module. Second part is the external executeable (nwnx.exe and the DLLs). The THIRD part is an EXTERNAL DATABASE like SQLite, MySQL, Firebird, Access, etc...

The DATABASE is seperate from your module. You do NOT put it in the module, it runs externally. The SQL commands you were given can be used through SQLExecDirect in your module to POPULATE that database; they are not the whole database though....

If you are intending on using SQLite (NWNX's default), you need to use the command line utility provided with SQLite's download to create the database file. Follow the instructions on their site on creating a new database. If you are running MySQL then you need to download IT and install, then create the database using ITS utilities. The SQLite database is stored in your NWN directory, the MySQL databases are stored in its OWN directory. Note: You don't just "copy" your .sql file to create a database, the .sql file contains the COMMANDS to create that database....

The following is a direct download to a functional SQLite database and its utilities that will work without you specifically making a new database via command line, you would copy the files into your c:\neverwinternights\nwn folder and set your NWNX.INI file accordingly:

http://nurrana.radcon.org/Downloads/sqlite.zip

The following link is an external utility for controlling MySQL databases that is easy to use if you go that route:
http://nurrana.radcon.org/Downloads/MySQL_Front.exe
Back to top
View user's profile Send private message
Peskyone



Joined: 04 Nov 2005
Posts: 27

PostPosted: Tue Nov 22, 2005 19:21    Post subject: Reply with quote

wow thank you for aswering so quickly and throughly!
Back to top
View user's profile Send private message Send e-mail
Peskyone



Joined: 04 Nov 2005
Posts: 27

PostPosted: Tue Nov 22, 2005 19:47    Post subject: Reply with quote

hmm for some reason iI can't seem to do much with it..i typed in help but nothing comes up that is the command line prompter i tried the second utility but it gives me a message saying it cannot connect...
Back to top
View user's profile Send private message Send e-mail
Peskyone



Joined: 04 Nov 2005
Posts: 27

PostPosted: Tue Nov 22, 2005 19:59    Post subject: Reply with quote

I imported aps2.erf
overwrite all it asked to...


#include "aps_include"
#include "x2_inc_switches"
#include "x2_inc_restsys"
void main()
{
SQLInit();
if (GetGameDifficulty() == GAME_DIFFICULTY_CORE_RULES || GetGameDifficulty() == GAME_DIFFICULTY_DIFFICULT)
{


I have that in the onmodload ..under module events

I have only have sqllite uncomment

added all the files to my nwn directory

I am still at a lose...how do i make and link this database?

The commandprompt...well I am not sure how to use it there is no read me it said to type help for directions but when i do nothing happens

I tried help
.help
and ".help"
all with nothing coming up

I tried the outside utility and it says it won't connect

I looked up the outside utilities manual MySQL-Font for a answer

and all it said was

**
Menu: File / Connection... (only standard mode)


Opens a connection with a database.
**
Which unfortunatly doesn't tell my novice self much

Is there anything...a walkthrough in laymens terms for a non programer?

Thank you ever so much for your help and patience thus far.
Back to top
View user's profile Send private message Send e-mail
Peskyone



Joined: 04 Nov 2005
Posts: 27

PostPosted: Tue Nov 22, 2005 20:33    Post subject: Reply with quote

Alright so it seems this is set up for mysql....is there a way I can make it use sqllite instead since it seems to be the easier database for a novice..if not i take it i need to find this Mysql and download it?
Back to top
View user's profile Send private message Send e-mail
Acrodania



Joined: 02 Jan 2005
Posts: 208

PostPosted: Tue Nov 22, 2005 21:10    Post subject: Reply with quote

The INI file you posted above was already setup for SQLite. Reread my post for instructions Smile

As for "setting up" or "linking" the database, just copy the one in the link I sent you into your NWN directory and make sure the entry in the NWNX.INI file is the same as the name. It should be, but verify Smile You DO NOT set anything inside the module; the NWNX process handles that for you. It is the INI file that determines where the database file is located and which one is being used.....

Once you have the database in place you should be able to run the "aps_demo" module to test it.

IMPORTANT: In case you missed this, you MUST START THE NWNX APPLICATION FIRST!!! You do not start the NWServer, you do NOT start NWN and then open a module. To use NWNX you must let IT control the server process just like you were hosting a PW or the database connections won't work.... Read the documentation. Make sure you edit your INI file with the NAME of the module but do NOT put the .mod on the end.....

Luck!
Back to top
View user's profile Send private message
Peskyone



Joined: 04 Nov 2005
Posts: 27

PostPosted: Tue Nov 22, 2005 23:42    Post subject: Reply with quote

alright but will the scripts i posted care if it is mysql or sqlite?
Back to top
View user's profile Send private message Send e-mail
Peskyone



Joined: 04 Nov 2005
Posts: 27

PostPosted: Wed Nov 23, 2005 12:41    Post subject: Reply with quote

One more question my apoliges I finally have it connecting but now what?

Are the table and database seperate? Do I make both in the sqlite command prompt window? if not which one? and where does the other go?
Back to top
View user's profile Send private message Send e-mail
Peskyone



Joined: 04 Nov 2005
Posts: 27

PostPosted: Wed Nov 23, 2005 16:43    Post subject: Reply with quote

Still not funtioning

I have read the manual at http://www.nwnx.org/index.php?id=doc_odbc2

several times through

I tried my best to follow all the direction given here I really want teleport spells for my mod and would appreciate some aid with credit board kudos...

1st I did what was I think i was told to do I am attempting to make this work on a test mode with only two areas so I used notepad to make a database and named it teleport.db


Spoken Target Familiarity FQHN Password Direction Random
0 farms Farms TP_FARMS localhost.localnet **** Both None
1 forest Forest TP_FOREST localhost.localnet**** Both None


then I linked it through nwnx.ini
; Use these two settings for the SQLite internal database
source = sqlite
file = teleport.db

then ran the mod on gamespy via nwnx

and no teleporting yet if i add this same file and name it teliport.2da into a hak and uncomment this line and comment 2da

//#include "md_teleport_2da" // Enables teleport functionality via teleport.2da
#include "md_teleport_sql" // Enables teleport functionality via MySQL/NWNASPX

It works and i have teliport

unfortinatly the creator who doesn't answer any questions via the vault says this system is undesirable for a PW and to use sql

now i was under the impression that sqlite is self linking..no set up ie CREATE TABLE functions needed? am I wrong? I have the SQLite files from the previous link generously given in my NWN folder and

this is a line from md_teleport_sql to find the databas
// Local constants
const string MD_TELEPORT_SQL_TABLE = "teleport"; // Table to retrieve teleport locations from

and i have this in onmodload

#include "aps_include"
#include "x2_inc_switches"
#include "x2_inc_restsys"
void main()
{
SQLInit();

and downloaded the aps.erf
am i just missing something?

Happy to give more infor if needed I have downloaded two sqLite editors and have yet to be sucessful in making a sqlite file if that is what I need other then a db...been thought the directions from the creators and aps..at a loss please help
Back to top
View user's profile Send private message Send e-mail
Display posts from previous:   
Post new topic   Reply to topic    nwnx.org Forum Index -> Database related All times are GMT + 2 Hours
Goto page 1, 2, 3  Next
Page 1 of 3

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group