PDA

View Full Version : Lua / Perl events for character creation / deletion


Eudith
12-20-2018, 09:34 AM
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!

Kingly_Krab
12-20-2018, 06:57 PM
Only way to do it would be to run a query based on what characters have been deleted versus the data buckets table.

Eudith
12-20-2018, 08:50 PM
Oh, that's clever! Thank you for the work-around!

Akkadius
12-20-2018, 10:25 PM
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


$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


#::: 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");
}

Eudith
12-21-2018, 01:36 AM
Thank you, I will study this code and see what I can do.