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 03-13-2017, 05:24 PM
Castious
Fire Beetle
 
Join Date: Jun 2015
Posts: 19
Default Account Status

I did a ton of searching but couldn't find what I was after, so quick question please.

How would you script an Accounts status to increase or decrease, like say if a player met certain conditions their accounts status would increase from 1 to 2?
Reply With Quote
  #2  
Old 03-13-2017, 06:00 PM
ghanja's Avatar
ghanja
Dragon
 
Join Date: Aug 2012
Location: Hershey, PA
Posts: 499
Default

Code:
sub UpdateStatus { ## Usage: UpdateStatus($charid, xx) where xx is new status level
	my $dbh = plugin::MySQL_Connect();
	$dbh->do("UPDATE `account` SET `status` = '$_[1]' WHERE `id` = '$_[0]' ");
	$dbh->disconnect();
	$client->UpdateAdmin();
}
Reply With Quote
  #3  
Old 03-13-2017, 06:50 PM
Castious
Fire Beetle
 
Join Date: Jun 2015
Posts: 19
Default

Interesting. Thanks ghanja, so how would that work for a client on like say:

sub ENTERZONE {
}

I'd like to be able to allow clients access to the #flymode command but only in a specific zone and when they zone out have it set their status back to 1 so they can no longer access that #command. Just one example of things I have in mind for this, but I'm having a dumb moment.

Also, $client->SetAccountFlag(flag, value)
I was trying this, but it hasn't been working right for me. I'm missing something I guess with this one.
Reply With Quote
  #4  
Old 03-13-2017, 07:00 PM
ghanja's Avatar
ghanja
Dragon
 
Join Date: Aug 2012
Location: Hershey, PA
Posts: 499
Default

You don't have to do that via status. I either didn't know about SetAccountFlag, it didn't work for me or was added after I made the code I exampled above.

Code:
sub EVENT_ENTERZONE {
	my @flyzones = ("commons","freportw","oasis");
	if ($zonesn ~~ @flyzones) {
		$client->SetFlyMode(1);
	}
}

sub EVENT_ZONE {
	$client->SetFlyMode(0);
}
Reply With Quote
  #5  
Old 03-13-2017, 07:07 PM
Castious
Fire Beetle
 
Join Date: Jun 2015
Posts: 19
Default

That's perfect, but I also have other more devious plans for the status up's and down's. >
Reply With Quote
  #6  
Old 03-15-2017, 12:48 AM
ghanja's Avatar
ghanja
Dragon
 
Join Date: Aug 2012
Location: Hershey, PA
Posts: 499
Default

Trying copy/paste usually fails for me, in an attempt to be quick about things. My apologies.

Code:
Usage: UpdateStatus($client->AccountName(), "50");   Where the number in quotes is the new desired account status (level).
Code:
sub UpdateStatus { ## Usage: UpdateStats(accountname, xx) where xx is new status level
	my $dbh = plugin::MySQL_Connect();
	$dbh->do("UPDATE `account` SET `status` = '$_[1]' WHERE `name` = '$_[0]' ");
	$dbh->disconnect();
	$client->UpdateAdmin();
}
As mentioned in PM, you'll need the DBI Perl and make sure your
plugins/MySQL_Connect.pl

has the proper credentials. If you dont have MySQL_Connect.pl then look for LoadMysql.pl (I believe it is) and ensure the credentials are correct there.

It took that PM to me to look at this thread to see what was up, sorry about that.
Reply With Quote
  #7  
Old 03-24-2017, 10:18 PM
Castious
Fire Beetle
 
Join Date: Jun 2015
Posts: 19
Default

Still struggling to get this to work. Can't change the status level to allow #commands to be used by players via a progressive quest line. Please help?
Reply With Quote
  #8  
Old 03-24-2017, 11:19 PM
GRUMPY
Discordant
 
Join Date: Oct 2016
Posts: 445
Default

I put this right on the npc script. It will put a marqee in the client window informing them of status update (plugin::MM)
Code:
sub EVENT_SAY {
	if ($text=~/hail/i && $status == 0) {
		my $actid = $client->AccountID();
		UpdateStatus($actid,1);
		plugin::MM("Greetings $name Your status has been set to 1.");
	}
}
	
sub UpdateStatus {
	my $idargument = $_[0];
	my $statuslevel = $_[1];
	my $dbh = plugin::MySQL_Connect();
	my $query = "UPDATE account SET status = ".$statuslevel." WHERE id = ".$idargument.";";
	$dbh->do($query);
	$dbh->disconnect();
	$client->UpdateAdmin();
}
Reply With Quote
  #9  
Old 03-24-2017, 11:41 PM
ghanja's Avatar
ghanja
Dragon
 
Join Date: Aug 2012
Location: Hershey, PA
Posts: 499
Default

Quote:
Originally Posted by Castious View Post
Still struggling to get this to work. Can't change the status level to allow #commands to be used by players via a progressive quest line. Please help?
You must ensure you have the Perl DBI installed.

Ensure a filename by name of "MySQL.pl" exists in /plugins/ directory (not! /quests/plugins -- that isnt used)

It should look like:

Code:
## plugins/MySQL.pl -- be sure to change "peq" to whatever the name of your DB is you use, and change the first "root" to whatever
## MySQL you may be using with access (usually root fwiw) and the second "root" with whatever the password of said MySQL user is
sub MySQL_Connect {
	use DBI;
	use DBD::mysql;
	$dbh = DBI->connect("DBI:mysql:peq:localhost:3306;", "root", "root", {RaiseError => 1, AutoCommit =>1});
	return $dbh;
}

return 1;
Then place this on an any NPC (preferably one without a script already or just rename the existing script of a NPC to npc_name.pl.bak and replace with the below -- whichever method you choose):

Code:
# any NPC you want
sub EVENT_SAY
{
	my $dbh = plugin::MySQL_Connect();
	$npc->Shout ("By golly, I think he's got it!") if ($dbh->ping);
}
http://wiki.eqemulator.org/p?Install..._other_Modules
Reply With Quote
Reply


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 04:33 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 - 2024, Jelsoft Enterprises Ltd.
Template by Bluepearl Design and vBulletin Templates - Ver3.3