issues with char*

EQ2Emulator Development forum.

Moderator: Team Members

Post Reply
User avatar
Ememjr
Team Member
Posts: 975
Joined: Wed Mar 15, 2017 9:41 am
EQ2Emu Server: Perseverance

issues with char*

Post by Ememjr » Thu Feb 08, 2018 2:26 pm

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

User avatar
Cynnar
Project Leader
Posts: 738
Joined: Sat Sep 27, 2014 1:22 am
EQ2Emu Server: Eq2emulator
Characters: Vlash
Veinlash
Taragak
Cynnar

Re: issues with char*

Post by Cynnar » Thu Feb 08, 2018 3:07 pm

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.
[ 01000011 01111001 01101110 01101110 01100001 01110010 ]

Follow on:
Twitter Facebook

Contact me:
PM Discord chat email

Hardware: the parts of a computer that can be kicked

User avatar
Ememjr
Team Member
Posts: 975
Joined: Wed Mar 15, 2017 9:41 am
EQ2Emu Server: Perseverance

Re: issues with char*

Post by Ememjr » Thu Feb 08, 2018 3:17 pm

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

Jabantiz
Lead Developer
Posts: 2912
Joined: Wed Jul 25, 2007 2:52 pm
Location: California

Re: issues with char*

Post by Jabantiz » Thu Feb 08, 2018 3:43 pm

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.

User avatar
Ememjr
Team Member
Posts: 975
Joined: Wed Mar 15, 2017 9:41 am
EQ2Emu Server: Perseverance

Re: issues with char*

Post by Ememjr » Thu Feb 08, 2018 7:35 pm

i dont see this database_new where is it located

User avatar
Cynnar
Project Leader
Posts: 738
Joined: Sat Sep 27, 2014 1:22 am
EQ2Emu Server: Eq2emulator
Characters: Vlash
Veinlash
Taragak
Cynnar

Re: issues with char*

Post by Cynnar » Thu Feb 08, 2018 7:49 pm

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.
[ 01000011 01111001 01101110 01101110 01100001 01110010 ]

Follow on:
Twitter Facebook

Contact me:
PM Discord chat email

Hardware: the parts of a computer that can be kicked

Jabantiz
Lead Developer
Posts: 2912
Joined: Wed Jul 25, 2007 2:52 pm
Location: California

Re: issues with char*

Post by Jabantiz » Thu Feb 08, 2018 9:59 pm

It is part of the normal db class, you can take a look at the botDB.cpp to see how to use it.

tyrbo
Team Member
Posts: 271
Joined: Thu Feb 18, 2016 12:33 pm

Re: issues with char*

Post by tyrbo » Thu Feb 08, 2018 10:18 pm

Make sure to check under Common Source Files and not just Source Files.

Post Reply

Who is online

Users browsing this forum: No registered users and 0 guests