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, 04:35 PM
blackdragonsdg
Dragon
 
Join Date: Dec 2008
Location: Tennessee
Posts: 656
Default

Didn't know where exactly to post this question as it doesn't really fit anywhere. I'll give the notepad++ thing a try. Looking up one hundred plus item id numbers manually is not exactly fun so I was attempting to automate it.
Reply With Quote
  #2  
Old 02-08-2012, 11:47 PM
blackdragonsdg
Dragon
 
Join Date: Dec 2008
Location: Tennessee
Posts: 656
Default

Well notepad++ is an interesting program with lots of potential uses but for what I am doing I think i can create loottables just as fast without it.

I took the script segment trevius posted and started trying to adapt it to what I was working on. While I have made some progress I am still unable to get the id to transfer through. Here is where I am at now

Code:
#Item id look up by item name

$tablename = "items";
$columnname = "Name";

use DBI;
use DBD::mysql;

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

open (FILE, 'data.txt');
while (<FILE>) {
	chomp;

if ($_)
{
	$query = "Select id from $tablename where $columnname = '$_'";
	
}

# Prepare and Execute the Query
$query_handle = $connect->prepare($query);
$query_handle->execute();

open (MYFILE2, '>>data2.txt');
print MYFILE2 "INSERT INTO `lootdrop_entries` (`lootdrop_id`, `item_id`, `item_charges`, `equip_item`, `chance`) VALUES (x, $id, 1, 0, z);	/* $_ */\n";
 }
close (MYFILE);
close (MYFILE2);

sub DBConnect {

	# Configuration Settings
	my $database = "peq";
	my $host = "localhost";
	my $port = "3306";
	
	# Set Connect String
	my $dsn = "dbi:mysql:$database:$host:$port";
	my $user = "root";
	my $pw = "password";
  
	# Set Database Connection
	my $connect =  DBI->connect($dsn, $user, $pw);
	return $connect;
}
I am not sure how to pull the id values out of the select statement. Only reason I got the name to go through was because of a default to $_ when reading the file text. Any hints would be welcomed.
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 09:23 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