EQEmulator Forums

EQEmulator Forums (https://www.eqemulator.org/forums/index.php)
-   General::Server Discussion (https://www.eqemulator.org/forums/forumdisplay.php?f=601)
-   -   Custom Slash Commands (https://www.eqemulator.org/forums/showthread.php?t=43578)

markusdabrave 02-15-2022 11:00 AM

Custom Slash Commands
 
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

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

Code:

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

Quote:

Originally Posted by markusdabrave (Post 267806)
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

Code:

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?

Code:

# 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/clas...ndAPI.cpp#L511

krauser1 02-18-2022 03:00 AM

use event_command not event_say in global_player.pl or .lua
 
Quote:

Originally Posted by markusdabrave (Post 267817)
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?

Code:

# 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.


All times are GMT -4. The time now is 07:19 AM.

Powered by vBulletin®, Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.