Go Back   EQEmulator Home > EQEmulator Forums > Quests > Quests::Q&A

Quests::Q&A This is the quest support section

Reply
 
Thread Tools Display Modes
  #1  
Old 02-08-2012, 10:16 AM
trevius's Avatar
trevius
Developer
 
Join Date: Aug 2006
Location: USA
Posts: 5,946
Default

Your request isn't really a quest related question. It is more of a general perl or scripting question. I am sure it can be done easy enough how you are wanting to do it.

You could probably just save yourself some time and use notepad++ to edit your item name list into queries for the item id SELECT. Then, do the same to make the results into queries to insert into the loot tables. You can hold ALT then click and drag up or down to select a column to type in for all rows selected. This means you can select the row in front of your column of item names, and type:

Code:
SELECT * FROM items WHERE `name`="
Then put your cursor at the left of the first line and click Macro->Start Recording. Then hit the END key on your keyboard. Then type the following:

Code:
");
Then hit the DOWN arrow on your keyboard. Then click Macro->Stop Recording. Then Macro->Run a Macro Multiple Times....

Next, select the radio button for "Run until the end of file" and click Run. That should make all lines look like a query. Sometimes you might get a weird character when you run macros, but you can just do a find/replace on that character to remove it if needed.

At that point, you can just run your queries from that list and do the same again with the query results. Once you get used to using notepad++, stuff like that gets really quick and easy to do.

Otherwise, if you are set on getting the script working, here is an example plugin I use on my server to query the DB. Should be able to use it to figure out what you are wanting:

Code:
# Usage: plugin::SetCharVarByName(CharName, VarName, VarValue);
sub SetCharVarByName {

	my $CharName = $_[0];
	my $VarName = $_[1];
	my $VarValue = $_[2];
	
	use DBI;
	use DBD::mysql;

	$tablename = "charvars";

	# Set Database Connection
	my $connect = DBConnect();

	if (plugin::GetCharVarByName($CharName, $VarName))
	{
		# Create the Query
		$query = "UPDATE $tablename SET value = '$VarValue' WHERE name = '$CharName' AND variable = '$VarName'";		
	}
	else
	{
		# Create the Query
		$query = "INSERT INTO $tablename (name, variable, value) VALUES('$CharName', '$VarName', '$VarValue')";
	}
	# Prepare and Execute the Query
	$query_handle = $connect->prepare($query);
	$query_handle->execute();
	$connect->disconnect();

	return 1;

}

sub DBConnect {

	# Configuration Settings
	my $database = "dbname";
	my $host = "192.168.1.100";
	my $port = "3306";
	
	# Set Connect String
	my $dsn = "dbi:mysql:$database:$host:$port";
	my $user = "dbusername";
	my $pw = "password";
  
	# Set Database Connection
	my $connect =  DBI->connect($dsn, $user, $pw);
	return $connect;

}
__________________
Trevazar/Trevius Owner of: Storm Haven
Everquest Emulator FAQ (Frequently Asked Questions) - Read It!
Reply With Quote
Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump

   

All times are GMT -4. The time now is 11:20 PM.


 

Everquest is a registered trademark of Daybreak Game Company LLC.
EQEmulator is not associated or affiliated in any way with Daybreak Game Company LLC.
Except where otherwise noted, this site is licensed under a Creative Commons License.
       
Powered by vBulletin®, Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Template by Bluepearl Design and vBulletin Templates - Ver3.3