Page 1 of 1

AI script: processing chats

Posted: 26 Nov 2009, 13:42
by DylanDog
Hello

I am working on DyDo to add chat message capabilities and I have not been able to find anything in the AI manual . I have obviusly looked at the WZ ai script and I have found there how to process the chat messages but I think you should put someting into the AI manual too.

I have made a web search and have found this:

Code: Select all

  VOID  processChatMsg { STRING string }
  Process STRING string.

  STRING getChatCmdDescription { INT index }
  Returns a string representing a certain chat command,
  based on the command index provided.

  INT getNumArgsInCmd
  Returns number of command arguments for a certain
  chat command that could be extracted.

  BOOL getChatCmdParam { INT commandIndex, INT paramIndex }
  Returns a certain parameter of a certain chat command.
  Returns FALSE if failed.

  BOOL chatCmdIsPlayerAddressed { INT commandIndex, INT player }
  Returns true if a certain command was addressed to a certain player.
This could be outdated...

Re: AI script: processing chats

Posted: 26 Nov 2009, 17:18
by Per
DylanDog wrote:I am working on DyDo to add chat message capabilities and I have not been able to find anything in the AI manual . I have obviusly looked at the WZ ai script and I have found there how to process the chat messages but I think you should put someting into the AI manual too.
Could you add this info (it is a wiki page)? You see, you probably know the AI script code better than any of the currently active developers...

I know, not quite the answer you wanted... ;)

Re: AI script: processing chats

Posted: 27 Nov 2009, 11:11
by DylanDog
Per wrote: Could you add this info (it is a wiki page)? You see, you probably know the AI script code better than any of the currently active developers...
Sure.I have just update the AI manual and added :

Code: Select all

[b]Callbacks with parameters[/b]

CALL_AI_MSG, int player, ref sender, ref message
    This is triggered when a chat message is received 
CALL_CONSOLE, ref sender, ref message
    This is triggered console message is received 
CALL_BEACON, player, ref sender, ref x, ref y, ref message
    This is triggered when a beacon is dropped 
and

Code: Select all

[b]Chat[/b]

void msg(string message, int playerFrom, int playerTo)
    Sends a chat message from playerFrom to playerTo. 
void processChatMsg( STRING string )
    Process STRING string. 
string getChatCmdDescription( INT index )
    Returns a string representing a certain chat command, based on the command index provided. 
int getNumArgsInCmd
    Returns number of command arguments for a certain chat command that could be extracted. 
bool getChatCmdParam ( INT commandIndex, INT paramIndex )
    Returns a certain parameter of a certain chat command. Returns FALSE if failed. 
bool chatCmdIsPlayerAddressed ( INT commandIndex, INT player )
    Returns true if a certain command was addressed to a certain player. 

Re: AI script: processing chats

Posted: 28 Nov 2009, 13:37
by Per
Thank you! :D