View Single Post
  #1  
Old 09-26-2015, 01:12 AM
Trackye
Sarnak
 
Join Date: Feb 2008
Posts: 87
Default Large SQL statements in a quest?

Is it possible to do something like this

Code:
use DBI;
#database configuration information
$db="DATABASECORRECT";
$host="localhost";
$user="USERCORRECT";
$password="PASSWORDCORRECT"; 

#connect to MySQL database
my $dbh = DBI->connect ("DBI:mysql:database=$db:host=$host", $user, $password);



sub EVENT_SAY 
{ 
	my $wares = quest::saylink("wares", 1);
	if($text=~/Hail/i)
	{
		plugin::Whisper("Would you like me to reset my $wares ?") ;
	}
	if($text=~/wares/i)
	{
	plugin::Whisper("Restocking now!") ;
	my $Sql1 = $dbh->prepare("Delete from Merchantlist_temp where npcid =999260;");
	$Sql1->execute( );
	plugin::Whisper("Restock complete!") ;
	}
}
But I need it to run approximately 60 Sql statements?
Eventually on a timer like every 2 hours? I only set it up as a manual Hail so i could test it.

Everything works up until clicking Wares. The NPC says restocking now and then nothing

Questerrors command shows the Npc then a number of Boxes or something after that...

Any help with this would be greatly appreciated.
Reply With Quote