View previous topic :: View next topic |
Author |
Message |
Zunath
Joined: 06 Jul 2006 Posts: 183
|
Posted: Tue Jul 21, 2009 1:47 Post subject: Trouble with storing objects |
|
|
I've searched all over the forums but nothing has fixed a problem I'm having. I can store strings, floats, ints, etc. all perfectly into my MySQL database, but when I go to store objects like placeables and inventory items, nothing works.
I have a custom table set up for use with my banking system. There is an ID field, which is a unique ID assigned to every character that joins. Then there are 50 "Item#" fields which are intended to store the items inside of a bank chest in the game.
Code: |
sSQL = "UPDATE " + sTable + " SET Item" + IntToString(iCurItem) + "=%s WHERE ID=" + IntToString(iID) + ";";
SetLocalString(GetModule(), "NWNX!ODBC!SETSCORCOSQL", sSQL);
StoreCampaignObject ("NWNX", "-", oItem);
|
I get no syntax errors and the table it is writing to does, in fact, exist so I know that isn't the problem. iCurItem tracks the number of items in the chest. I also tried to just use the built-in SetPersistentObject in aps_include, but that also did not work.
It may help, so here is my code for the table I am using:
Code: |
string sSQL = "CREATE TABLE `nwn`.`" + sTableName + "` (" +
"`ID` INTEGER NULL," +
"`Item1` BLOB NULL DEFAULT NULL," +
"`Item2` BLOB NULL DEFAULT NULL," +
"`Item3` BLOB NULL DEFAULT NULL," +
"`Item4` BLOB NULL DEFAULT NULL," +
"`Item5` BLOB NULL DEFAULT NULL," +
"`Item6` BLOB NULL DEFAULT NULL," +
"`Item7` BLOB NULL DEFAULT NULL," +
"`Item8` BLOB NULL DEFAULT NULL," +
"`Item9` BLOB NULL DEFAULT NULL," +
"`Item10` BLOB NULL DEFAULT NULL," +
"`Item11` BLOB NULL DEFAULT NULL," +
"`Item12` BLOB NULL DEFAULT NULL," +
"`Item13` BLOB NULL DEFAULT NULL," +
"`Item14` BLOB NULL DEFAULT NULL," +
"`Item15` BLOB NULL DEFAULT NULL," +
"`Item16` BLOB NULL DEFAULT NULL," +
"`Item17` BLOB NULL DEFAULT NULL," +
"`Item18` BLOB NULL DEFAULT NULL," +
"`Item19` BLOB NULL DEFAULT NULL," +
"`Item20` BLOB NULL DEFAULT NULL," +
"`Item21` BLOB NULL DEFAULT NULL," +
"`Item22` BLOB NULL DEFAULT NULL," +
"`Item23` BLOB NULL DEFAULT NULL," +
"`Item24` BLOB NULL DEFAULT NULL," +
"`Item25` BLOB NULL DEFAULT NULL," +
"`Item26` BLOB NULL DEFAULT NULL," +
"`Item27` BLOB NULL DEFAULT NULL," +
"`Item28` BLOB NULL DEFAULT NULL," +
"`Item29` BLOB NULL DEFAULT NULL," +
"`Item30` BLOB NULL DEFAULT NULL," +
"`Item31` BLOB NULL DEFAULT NULL," +
"`Item32` BLOB NULL DEFAULT NULL," +
"`Item33` BLOB NULL DEFAULT NULL," +
"`Item34` BLOB NULL DEFAULT NULL," +
"`Item35` BLOB NULL DEFAULT NULL," +
"`Item36` BLOB NULL DEFAULT NULL," +
"`Item37` BLOB NULL DEFAULT NULL," +
"`Item38` BLOB NULL DEFAULT NULL," +
"`Item39` BLOB NULL DEFAULT NULL," +
"`Item40` BLOB NULL DEFAULT NULL," +
"`Item41` BLOB NULL DEFAULT NULL," +
"`Item42` BLOB NULL DEFAULT NULL," +
"`Item43` BLOB NULL DEFAULT NULL," +
"`Item44` BLOB NULL DEFAULT NULL," +
"`Item45` BLOB NULL DEFAULT NULL," +
"`Item46` BLOB NULL DEFAULT NULL," +
"`Item47` BLOB NULL DEFAULT NULL," +
"`Item48` BLOB NULL DEFAULT NULL," +
"`Item49` BLOB NULL DEFAULT NULL," +
"`Item50` BLOB NULL DEFAULT NULL," +
"PRIMARY KEY (`ID`))" +
"ENGINE = MyISAM;";
SQLExecDirect(sSQL);
|
I am using the ODBC plugin on Virusman's downloader. I tried to get the one from NWNX-Easy, but it wouldn't compile for me.
As the instructions say, I use the command: sudo apt-get install build-essential gcc libmysqlclient-dev zlib1g-dev and receive this message:
Code: |
zunath@NWNServer:~/Desktop/nwnx_easy$ sudo apt-get install build-essential gcc libmysqlclient-dev zlib1g-dev
[sudo] password for zunath:
Reading package lists... Done
Building dependency tree
Reading state information... Done
build-essential is already the newest version.
gcc is already the newest version.
Package libmysqlclient-dev is a virtual package provided by:
libmysqlclient15-dev 5.1.30really5.0.75-0ubuntu10.2
You should explicitly select one to install.
E: Package libmysqlclient-dev has no installation candidate
|
So then I run ./install.sh and get the following:
Code: |
zunath@NWNServer:~$ cd '/home/zunath/Desktop/nwnx_easy'
zunath@NWNServer:~/Desktop/nwnx_easy$ ./install.sh
checking for gcc... gcc
checking for C compiler default output... a.out
checking whether the C compiler works... yes
checking whether we are cross compiling... no
checking for executable suffix...
checking for object suffix... o
checking whether we are using the GNU C compiler... yes
checking whether gcc accepts -g... yes
checking for g++... g++
checking whether we are using the GNU C++ compiler... yes
checking whether g++ accepts -g... yes
checking how to run the C preprocessor... gcc -E
checking for ANSI C header files... yes
checking for sys/wait.h that is POSIX.1 compatible... yes
checking for fcntl.h... yes
checking for netinet/in.h... yes
checking for stdlib.h... yes
checking for string.h... yes
checking for sys/ioctl.h... yes
checking for sys/mman.h... yes
checking for sys/socket.h... yes
checking for sys/time.h... yes
checking for unistd.h... yes
checking for dlfcn.h... yes
checking for gcc option to accept ANSI C... none needed
checking for an ANSI C-conforming const... yes
checking for sys/types.h... yes
checking for sys/stat.h... yes
checking for stdlib.h... (cached) yes
checking for string.h... (cached) yes
checking for memory.h... yes
checking for strings.h... yes
checking for inttypes.h... yes
checking for stdint.h... yes
checking for unistd.h... (cached) yes
checking for size_t... yes
checking for stdlib.h... (cached) yes
checking for working malloc... yes
checking for bzero... yes
checking for getspnam... yes
checking for inflateEnd in -lz... yes
configure: creating ./config.status
config.status: creating Makefile
config.status: creating mnx/Makefile
config.status: creating functions/Makefile
config.status: creating hashset/Makefile
config.status: creating chat/Makefile
config.status: creating events/Makefile
config.status: creating fixes/Makefile
config.status: creating leto/Makefile
config.status: creating odmbc/Makefile
config.status: creating profiler/Makefile
config.status: creating resman/Makefile
config.status: creating structs/Makefile
config.status: creating tmi/Makefile
config.status: creating config.h
g++ -mcpu=i386 -c -o nwnx2lib.o nwnx2lib.cpp
`-mcpu=' is deprecated. Use `-mtune=' or '-march=' instead.
nwnx2lib.cpp: In function ‘void PayLoad(const char**, const char**)’:
nwnx2lib.cpp:215: error: ‘free’ was not declared in this scope
nwnx2lib.cpp:223: error: ‘free’ was not declared in this scope
nwnx2lib.cpp: In function ‘void Configure()’:
nwnx2lib.cpp:508: warning: deprecated conversion from string constant to ‘char*’
nwnx2lib.cpp:515: warning: deprecated conversion from string constant to ‘char*’
nwnx2lib.cpp:520: error: ‘atoi’ was not declared in this scope
nwnx2lib.cpp:525: error: ‘atoi’ was not declared in this scope
nwnx2lib.cpp: In function ‘void Log(int, const char*, ...)’:
nwnx2lib.cpp:618: warning: format not a string literal and no format arguments
nwnx2lib.cpp:624: warning: format not a string literal and no format arguments
nwnx2lib.cpp: In constructor ‘startstop::startstop()’:
nwnx2lib.cpp:650: warning: format ‘%p’ expects type ‘void*’, but argument 2 has type ‘long unsigned int’
nwnx2lib.cpp:650: warning: format ‘%p’ expects type ‘void*’, but argument 3 has type ‘long unsigned int’
nwnx2lib.cpp:652: warning: format ‘%p’ expects type ‘void*’, but argument 2 has type ‘long unsigned int’
nwnx2lib.cpp:652: warning: format ‘%p’ expects type ‘void*’, but argument 3 has type ‘long unsigned int’
make: *** [nwnx2lib.o] Error 1
for i in mnx functions hashset chat events fixes leto odmbc profiler resman structs tmi; do make -C $i clean; done
make[1]: Entering directory `/home/zunath/Desktop/nwnx_easy/mnx'
/bin/rm -f *.o *.so *~ plugin-t
make[1]: Leaving directory `/home/zunath/Desktop/nwnx_easy/mnx'
make[1]: Entering directory `/home/zunath/Desktop/nwnx_easy/functions'
/bin/rm -f *.o *.so *~ plugin-t
make[1]: Leaving directory `/home/zunath/Desktop/nwnx_easy/functions'
make[1]: Entering directory `/home/zunath/Desktop/nwnx_easy/hashset'
/bin/rm -f *.o *.so *~ plugin-t
make[1]: Leaving directory `/home/zunath/Desktop/nwnx_easy/hashset'
make[1]: Entering directory `/home/zunath/Desktop/nwnx_easy/chat'
/bin/rm -f *.o *.so
make[1]: Leaving directory `/home/zunath/Desktop/nwnx_easy/chat'
make[1]: Entering directory `/home/zunath/Desktop/nwnx_easy/events'
/bin/rm -f *.o *.so
make[1]: Leaving directory `/home/zunath/Desktop/nwnx_easy/events'
make[1]: Entering directory `/home/zunath/Desktop/nwnx_easy/fixes'
/bin/rm -f *.o *.so *~ plugin-t
make[1]: Leaving directory `/home/zunath/Desktop/nwnx_easy/fixes'
make[1]: Entering directory `/home/zunath/Desktop/nwnx_easy/leto'
/bin/rm -f *.o *.so *~ LetoSo
make[1]: Leaving directory `/home/zunath/Desktop/nwnx_easy/leto'
make[1]: Entering directory `/home/zunath/Desktop/nwnx_easy/odmbc'
/bin/rm -f *.o *.so
make[1]: Leaving directory `/home/zunath/Desktop/nwnx_easy/odmbc'
make[1]: Entering directory `/home/zunath/Desktop/nwnx_easy/profiler'
/bin/rm -f *.o *.so
make[1]: Leaving directory `/home/zunath/Desktop/nwnx_easy/profiler'
make[1]: Entering directory `/home/zunath/Desktop/nwnx_easy/resman'
/bin/rm -f *.o *.so
make[1]: Leaving directory `/home/zunath/Desktop/nwnx_easy/resman'
make[1]: Entering directory `/home/zunath/Desktop/nwnx_easy/structs'
/bin/rm -f *.o *.so
make[1]: Leaving directory `/home/zunath/Desktop/nwnx_easy/structs'
make[1]: Entering directory `/home/zunath/Desktop/nwnx_easy/tmi'
/bin/rm -f *.o *.so
make[1]: Leaving directory `/home/zunath/Desktop/nwnx_easy/tmi'
/bin/rm -f *.o *.so *~
for i in mnx functions hashset chat events fixes leto odmbc profiler resman structs tmi; do make -C $i distclean; done
make[1]: Entering directory `/home/zunath/Desktop/nwnx_easy/mnx'
/bin/rm -f *.o *.so *~ plugin-t
/bin/rm -f Makefile
make[1]: Leaving directory `/home/zunath/Desktop/nwnx_easy/mnx'
make[1]: Entering directory `/home/zunath/Desktop/nwnx_easy/functions'
/bin/rm -f *.o *.so *~ plugin-t
/bin/rm -f Makefile
make[1]: Leaving directory `/home/zunath/Desktop/nwnx_easy/functions'
make[1]: Entering directory `/home/zunath/Desktop/nwnx_easy/hashset'
/bin/rm -f *.o *.so *~ plugin-t
/bin/rm -f Makefile
make[1]: Leaving directory `/home/zunath/Desktop/nwnx_easy/hashset'
make[1]: Entering directory `/home/zunath/Desktop/nwnx_easy/chat'
/bin/rm -f *.o *.so
/bin/rm -f Makefile
make[1]: Leaving directory `/home/zunath/Desktop/nwnx_easy/chat'
make[1]: Entering directory `/home/zunath/Desktop/nwnx_easy/events'
/bin/rm -f *.o *.so
/bin/rm -f Makefile
make[1]: Leaving directory `/home/zunath/Desktop/nwnx_easy/events'
make[1]: Entering directory `/home/zunath/Desktop/nwnx_easy/fixes'
/bin/rm -f *.o *.so *~ plugin-t
/bin/rm -f Makefile
make[1]: Leaving directory `/home/zunath/Desktop/nwnx_easy/fixes'
make[1]: Entering directory `/home/zunath/Desktop/nwnx_easy/leto'
/bin/rm -f *.o *.so *~ LetoSo
/bin/rm -f Makefile
make[1]: Leaving directory `/home/zunath/Desktop/nwnx_easy/leto'
make[1]: Entering directory `/home/zunath/Desktop/nwnx_easy/odmbc'
/bin/rm -f *.o *.so
/bin/rm -f Makefile
make[1]: Leaving directory `/home/zunath/Desktop/nwnx_easy/odmbc'
make[1]: Entering directory `/home/zunath/Desktop/nwnx_easy/profiler'
/bin/rm -f *.o *.so
/bin/rm -f Makefile
make[1]: Leaving directory `/home/zunath/Desktop/nwnx_easy/profiler'
make[1]: Entering directory `/home/zunath/Desktop/nwnx_easy/resman'
/bin/rm -f *.o *.so
/bin/rm -f Makefile
make[1]: Leaving directory `/home/zunath/Desktop/nwnx_easy/resman'
make[1]: Entering directory `/home/zunath/Desktop/nwnx_easy/structs'
/bin/rm -f *.o *.so
/bin/rm -f Makefile
make[1]: Leaving directory `/home/zunath/Desktop/nwnx_easy/structs'
make[1]: Entering directory `/home/zunath/Desktop/nwnx_easy/tmi'
/bin/rm -f *.o *.so
/bin/rm -f Makefile
make[1]: Leaving directory `/home/zunath/Desktop/nwnx_easy/tmi'
/bin/rm -f Makefile config.h config.status config.cache config.log *.o *.so *~
NWNX has not been compiled, because the scripts seem to be corrupted, or your compiler is incapable of compiling them. Please refer to the NWNX forum for help.
|
My server box is running Ubuntu 32bit 9.04. I'm able to store objects just fine on my windows XP PC.
Sorry for the long post, just want to be thorough. Thanks for any help. |
|
Back to top |
|
|
virusman
Joined: 30 Jan 2005 Posts: 1020 Location: Russia
|
Posted: Tue Jul 21, 2009 6:23 Post subject: |
|
|
Please show us your nwnx2.ini config and odmbc.txt log file contents. |
|
Back to top |
|
|
Zunath
Joined: 06 Jul 2006 Posts: 183
|
Posted: Tue Jul 21, 2009 6:46 Post subject: |
|
|
nwnx2.ini
Code: |
[NWNX]
disablenwnxinit=y #Set to "y" to not enforce the NWNX!INIT requirement
[ODBC2]
source=mysql
server=127.0.0.1 #name of the database server
user=XXX #username to access db
pass=XXX #password for username
db=nwn #database to connect to
hookscorco=true
[Debug]
debuglevel=1 #Set to 1 or higher to output successively
# # verbose debug information
[LogDir]
logdir=logs.0 #Set to the relative root of the log directory.
[CHAT]
chat_script=
server_script=
[FIXES]
copy_vars = 1 # Copy local variables on stack split and on store transaction,
# fire OnDisturbed when you merge a stack from a placeable
compare_vars = 1 # If set to 1, items with different local vars don't stack
keep_hidden_in_conversation = 1 # If set to 1, creatures don't unhide when they start a conversation
hp_limit = -10 # Negative HP limit - values up to -127 are allowed
hide_charlist_all = 0 # Hide the whole online characters list on login (appears empty)
hide_charlist_levels = 1 # Hide the class(es) (displays nothing instead of class list)
hide_charlist_portraits = 0 # Hide the portrait (shows default male/female portrait)
|
odmbc.txt
Code: |
NWNX2 ODBC2 version 0.3 for Linux.
(c) 2005-2006 by dumbo (dumbo@nm.ru) & virusman (virusman@virusman.ru)
o SCO located at 82d9c44.
o RCO located at 82d9b60.
o Connect successful.
o Shutdown.
|
|
|
Back to top |
|
|
Zunath
Joined: 06 Jul 2006 Posts: 183
|
Posted: Wed Jul 29, 2009 7:14 Post subject: |
|
|
Sorry but it's been about a week now. Does anyone know what to do to fix this? Persistent object storage is pretty important for our world. |
|
Back to top |
|
|
virusman
Joined: 30 Jan 2005 Posts: 1020 Location: Russia
|
Posted: Wed Jul 29, 2009 7:39 Post subject: |
|
|
Set ODBC2 debuglevel to 4 and post log contents here.
Btw, you can only store items and creatures using SCO/RCO. It doesn't work on placeables, triggers, doors, waypoints, etc. |
|
Back to top |
|
|
Zaith
Joined: 05 Jun 2007 Posts: 21
|
Posted: Wed Jul 29, 2009 8:40 Post subject: Re: Trouble with storing objects |
|
|
Zunath wrote: | Code: |
zunath@NWNServer:~/Desktop/nwnx_easy$ sudo apt-get install build-essential gcc libmysqlclient-dev zlib1g-dev
[sudo] password for zunath:
Reading package lists... Done
Building dependency tree
Reading state information... Done
build-essential is already the newest version.
gcc is already the newest version.
Package libmysqlclient-dev is a virtual package provided by:
libmysqlclient15-dev 5.1.30really5.0.75-0ubuntu10.2
You should explicitly select one to install.
E: Package libmysqlclient-dev has no installation candidate
|
|
This probably won't help you much, but did you ever install the libmysqlclient15-dev like that error told you to? |
|
Back to top |
|
|
Zunath
Joined: 06 Jul 2006 Posts: 183
|
Posted: Wed Jul 29, 2009 9:02 Post subject: |
|
|
Quote: |
NWNX2 ODBC2 version 0.3 for Linux.
(c) 2005-2006 by dumbo (dumbo@nm.ru) & virusman (virusman@virusman.ru)
o SCO located at 82d9c44.
o RCO located at 82d9b60.
o Connect successful.
o Got request: SHOW TABLES LIKE 'PC_HitPoints'
o Sent response (12 bytes): PC_HitPoints
o Got request: SHOW TABLES LIKE 'BANK_PARADISUS'
o Sent response (14 bytes): BANK_PARADISUS
o Got request: SHOW TABLES LIKE 'LAND_AREA_LIST'
o Sent response (14 bytes): LAND_AREA_LIST
o Got request: SELECT val FROM pwdata WHERE player='~' AND tag='PARADISUS' AND name='PC_COUNT'
o Sent response (1 bytes): 7
o Got request: SELECT HP FROM PC_HitPoints WHERE ID='7'
o Sent response (1 bytes): 9
o Got request: SELECT val FROM pwdata WHERE player='~' AND tag='PARADISUS' AND name='FKY_CHT_BANSHOUTFTMU44GR'
o Sent response (0 bytes):
o Got request: SELECT val FROM pwdata WHERE player='~' AND tag='PARADISUS' AND name='FKY_CHT_BANPLAYERFTMU44GR'
o Sent response (0 bytes):
o Got request: DELETE FROM BANK_PARADISUS WHERE ID=7;
o Got request: INSERT INTO BANK_PARADISUS(ID) VALUES (7)
o Got request (scorco): UPDATE BANK_PARADISUS SET Item1=%s WHERE ID=7;
o SCO: db='NWNX', key='-', player='(null)', flags=0000004F, pData=0F9302A0, size=00000977
|
@Zaith: Thanks, but that didn't seem to do anything. >< |
|
Back to top |
|
|
Zunath
Joined: 06 Jul 2006 Posts: 183
|
Posted: Wed Jul 29, 2009 20:50 Post subject: |
|
|
Well, I'm not really sure what I did but it seems to be storing the item correctly. Thanks for all the support! |
|
Back to top |
|
|
|
|
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
|