Jump to content
  • 0

Custom chat commands - connect command with function


Zorak

Question

Posted

Hi, I am trying to dd a custom command we need on our server.

But I cannot figure out, how to connect proper function to that comand.

 

I got through the project tree like searching for a name of an existing function of an existing command, but I haven't found anything.

 

Well, the logic obviously is:

ChatHandler::ParseCommands > ChatHandler::ExecuteCommand(text-from-chat-window);

But in ExecuteCommand I cannot see any connection for an actual precessing of that command. Even if I try to find some function name (like HandleGoXYZCommand) in whole project tree, there is only once (so twice in total, one prototype in chat.h, one in Level1.cpp). I would expect something like huge switch calling the funtions depenting on what chat command was sent...

Like I simply cannot find where in code is something like

switch (command){

case (goxyzCommand){HandleGoXZYCommand(params);}

}

So the question is simple.

1) I add a comand into a DB

2) I add sme function doing someting into e.g. Level1.cpp

3) How do I connect my function with my commmand string?

 

 

Thank you :)

10 answers to this question

Recommended Posts

Posted

Okey, that is sad ... well, are you able at least not to explain everything, but well .. point me in right direction? like ... See this and this file, see this function, this class or this structure and try to figure it for yourself?

Well .. I think I am not probably the first one trying to add some custom commands, am I? I think this would be maybe useful for other minor developers/users...

 

Thanks

Posted

Sorry for the delay in responding... I was busy preparing some big db updates and needed to focus:

 
Is this a completely new command or a subcommand of an existing command (eg. some new functionality for .lookup) ?
 
Posted

Hello, thanks for responding, sure work has a priority :)

Yes, I need to create a custom command - as vanilla does not support flying, I need to create some workaround ... it is not a problem to create the function. I just cannot find out, how to connect the command with that function ...

 

So the question is simple.

1) I add a comand into a DB

2) I add sme function doing someting into e.g. Level1.cpp

3) How do I connect my function with my commmand string?

so far, I got through :

bool ChatHandler::ParseCommands(const char* text)
{

....

ExecuteCommand(...);

}

void ChatHandler::ExecuteCommand(const char* text)
{

FindCommand(...);

...

}

But I cannot see anywhere in code, and also searching for that in whole project tree failed - for example - in Level1.cpp is a function HandleGoXYZCommand(...){...}. Searching for "HandleGoXYZCommand" will result in only 2 appearences, function prototype in Chat.h and function itself in Level1.cpp .... but the function is not called anywhere in whole project .. Any function form those files are not called anywhere... I need to find out, how to say "bool HandleSomeMyfunctionCommand (...){...}" is executed, when command ".abcmycomand whatever" is parsed...

my writings are maybe hard to read, so the image will make it probably clear :)

 

goxyz.png

Posted

Okey guys, I am blind :D Or ... my VisualStudio is blind :D Found the calling statement in Chat.cpp (wonder why after so much time, while that is about 800 rows of staements :D )... just wonder, why it is not shown when I search for it ...

Never mind, anyway, thanks fore responses

Wish you many rows without error.

return;

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue. Privacy Policy Terms of Use