PDA

View Full Version : Custom Slash Commands


markusdabrave
02-15-2022, 11:00 AM
I'd like to put a /hotzone slash command that lists the current hotzones for my players. Is there a data flow diagram or an example of making a custom command? Or is it even possible?

NatedogEZ
02-15-2022, 02:10 PM
You are better off using # commands in perl or lua with custom global_player code

if ($text=~/#cooldowns/i) {
$client->ResetAllCastbarCooldowns();
$client->Message(13, "ResetAllCastbarCooldowns!");
}


Example to reset all castbar cooldowns in perl

If you are getting a weird "error command not found" set this rule to true

SELECT * FROM rule_values r WHERE r.rule_name LIKE "%SuppressCommandErrors%"

markusdabrave
02-15-2022, 08:26 PM
Can anyone use # commands or do I need to somehow specify an accesslevel?

NatedogEZ
02-15-2022, 10:26 PM
Can anyone use # commands or do I need to somehow specify an accesslevel?

Just add code to restrict it to a certain Status which is a variable exported to client scripts


if ($status >= 200) { #CUSTOM GM ONLY COMMANDS
if ($text=~/#cooldowns/i) {
$client->ResetAllCastbarCooldowns();
$client->Message(13, "ResetAllCastbarCooldowns!");
} elsif ($text=~/#randomstuff/i) {
#Do more things ect.. ect..
}
}

If you need an API reference just use spire.

http://spire.akkadius.com/quest-api-explorer

markusdabrave
02-16-2022, 02:17 AM
Thanks. Appreciate the help.

markusdabrave
02-16-2022, 05:25 PM
Ok I'm feeling like a complete moron. I've #reloadquests and added the below code to my global_player.pl and it's still not working. I also enabled the error message suppressing suggested. What am I missing? Is # a special character?


# Hot Zone List - Lists Current Hotzones
sub EVENT_SAY {
if ($text=~/#hotzone/i){
$client->Message(315,'This is a test.');
}
}

Secrets
02-17-2022, 12:54 PM
You can also add slash commands by using dll injection, though it's a bit more involved.

This is how I did hooks on classless 3:

https://github.com/SecretsOTheP/classless-dll/blob/main/eqgame_dll/MQ2CommandAPI.cpp#L511

krauser1
02-18-2022, 03:00 AM
Ok I'm feeling like a complete moron. I've #reloadquests and added the below code to my global_player.pl and it's still not working. I also enabled the error message suppressing suggested. What am I missing? Is # a special character?


# Hot Zone List - Lists Current Hotzones
sub EVENT_SAY {
if ($text=~/#hotzone/i){
$client->Message(315,'This is a test.');
}
}



https://docs.eqemu.io/quest-api/events/#example_14

these examples are a working template for adding your own commands.

markusdabrave
02-18-2022, 08:03 PM
Thanks. Got it working. 99% of my problem was using nano to edit. Started using g komodo and found all sorts of syntaxes errors.