Page 1 of 1

issues with char*

Posted: Thu Feb 08, 2018 2:26 pm
by Ememjr
i am have an issue where

Code: Select all

MYSQL_RES* result = query.RunQuery2(Q_SELECT, "SELECT `quest_id`, `name`, `type`, `zone`, `level`, `enc_level`, `description`, `lua_script`, `completed_text`, `spawn_id` FROM `quests`");
char* script = 0;
script = row[7];
that is the 3 lines of the code i am working with which works as written
and script will equal what was in row[7] which is the quest luascript ie.. "Quests/zone1/quest1.lua

now my issue is i want to prepend "c:\content\" the the lua script location the "c:\content\" will be either in rules or an ini file (to be determined later)
and will allow me to point the server to a different location for the lua scripts, so when running multiple servers there only has to be one copy of all the script files for this instance c:\content

how do i add to the varible `script` inorder to get the proper path

Re: issues with char*

Posted: Thu Feb 08, 2018 3:07 pm
by Cynnar
Can't test this theory, but if you change the location of the script in the db you can put the script wherever you want. Like the spawns table has a place for the script location.

Re: issues with char*

Posted: Thu Feb 08, 2018 3:17 pm
by Ememjr
that would not make it so you could just change 1 rule or ini config line and change the location
i dont want to change every script in the db

Re: issues with char*

Posted: Thu Feb 08, 2018 3:43 pm
by Jabantiz
Again symbolic links to the folders would be simpler as you just make the links to the scripts folder and the server will think those folders are in the same directory so all your scripts are in one place and any changes to a script would effect all servers. Linux has the same thing but forgot what they are called on Linux.

If you are set on using the ini then I would work with strings as it is much easier and if you need a char array from the string you can do .c_str(). Also database_new is the preferred DB now and it is simpler to use with more features.

Re: issues with char*

Posted: Thu Feb 08, 2018 7:35 pm
by Ememjr
i dont see this database_new where is it located

Re: issues with char*

Posted: Thu Feb 08, 2018 7:49 pm
by Cynnar
Jabantiz wrote: Thu Feb 08, 2018 3:43 pm Linux has the same thing but forgot what they are called on Linux
soft link, symlink, or symbolic link is what I have always heard for Linux.

Here is a guide for windows
Ememjr wrote: Thu Feb 08, 2018 7:35 pm i dont see this database_new where is it located
I'm lost here as well. So don't feel bad.

Re: issues with char*

Posted: Thu Feb 08, 2018 9:59 pm
by Jabantiz
It is part of the normal db class, you can take a look at the botDB.cpp to see how to use it.

Re: issues with char*

Posted: Thu Feb 08, 2018 10:18 pm
by tyrbo
Make sure to check under Common Source Files and not just Source Files.