Go Back   EQEmulator Home > EQEmulator Forums > Development > Development::Feature Requests

Development::Feature Requests Post suggestions/feature requests here.

Reply
 
Thread Tools Display Modes
  #1  
Old 12-20-2018, 09:34 AM
Eudith
Fire Beetle
 
Join Date: Dec 2018
Posts: 12
Default Lua / Perl events for character creation / deletion

Hi all!

I want to have scripts run only once on character creation and only once on character deletion. Right now I have a workaround for character creation involving data buckets flagging whether or not initialization has been done on a character, but I don't have a solution for clearing this data out when a character is deleted.

Am I missing a way to do it currently? If not, could we get this functionality?

Thank you very much!
Reply With Quote
  #2  
Old 12-20-2018, 06:57 PM
Kingly_Krab's Avatar
Kingly_Krab
Demi-God
 
Join Date: May 2013
Location: United States
Posts: 1,514
Default

Only way to do it would be to run a query based on what characters have been deleted versus the data buckets table.
Reply With Quote
  #3  
Old 12-20-2018, 08:50 PM
Eudith
Fire Beetle
 
Join Date: Dec 2018
Posts: 12
Default

Oh, that's clever! Thank you for the work-around!
Reply With Quote
  #4  
Old 12-20-2018, 10:25 PM
Akkadius's Avatar
Akkadius
Administrator
 
Join Date: Feb 2009
Location: MN
Posts: 1,996
Default

Here's some database call example syntax for you to work with, this should work out of box from a vanilla install of EQEmu Server

Code:
$query = "SELECT
	COUNT(id) as count
	FROM
	character_data
	WHERE
	(character_data.last_login > UNIX_TIMESTAMP() - 600)
	and zone_instance = ?";

$ex = plugin::LoadMysql()->prepare($query);
$ex->execute($realm_instance);
while (@row = $ex->fetchrow_array()){
    return $row[0];
}
Here are some other examples too to help you out

Code:
#::: Guild Online Messages :: Only for mains
if ($uguild_id > 0) {
	$query = "
		SELECT
		guild_members.char_id
		FROM
		guild_members
		WHERE alt = 0
		and char_id = ?
	";
	$ex = plugin::LoadMysql()->prepare($query); 
	$ex->execute($client->CharacterID()); 
	while (@row = $ex->fetchrow_array()) {
		quest::gmsay("[Guild] " . $client->GetCleanName() . " is now online", 15, 1, $uguild_id, 0); 
	}
}

#::: Friend online messages
$query = "
	SELECT
	character_data.name
	FROM
	friends
	INNER JOIN character_data ON friends.charid = character_data.id
	WHERE 
	friends.name = ? 
	and friends.type = 1
	and (character_data.last_login > UNIX_TIMESTAMP() - 600)
";
$ex = plugin::LoadMysql()->prepare($query); 
$ex->execute($client->GetCleanName()); 
while (@row = $ex->fetchrow_array()) { 
	quest::crosszonemessageplayerbyname(15, $row[0], "[Friend] " . $client->GetCleanName() . " is now online");
}
__________________
Reply With Quote
  #5  
Old 12-21-2018, 01:36 AM
Eudith
Fire Beetle
 
Join Date: Dec 2018
Posts: 12
Default

Thank you, I will study this code and see what I can do.
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 08:14 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 - 2019, Jelsoft Enterprises Ltd.
Template by Bluepearl Design and vBulletin Templates - Ver3.3