AI script: processing chats

For code related discussions and questions
Post Reply
User avatar
DylanDog
Code contributor
Code contributor
Posts: 347
Joined: 08 Apr 2009, 15:15
Location: Germany
Contact:

AI script: processing chats

Post 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...
My Warzone 2100 mods:
Download DyDo-AI for Warzone skirmish/multiplayer games.
Download A2C-HM (Alpha 2 Campaign - Hard Mode).
Download A3C-HM (Alpha 3 Campaign - Hard Mode).
Per
Warzone 2100 Team Member
Warzone 2100 Team Member
Posts: 3780
Joined: 03 Aug 2006, 19:39

Re: AI script: processing chats

Post 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... ;)
User avatar
DylanDog
Code contributor
Code contributor
Posts: 347
Joined: 08 Apr 2009, 15:15
Location: Germany
Contact:

Re: AI script: processing chats

Post 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. 
My Warzone 2100 mods:
Download DyDo-AI for Warzone skirmish/multiplayer games.
Download A2C-HM (Alpha 2 Campaign - Hard Mode).
Download A3C-HM (Alpha 3 Campaign - Hard Mode).
Per
Warzone 2100 Team Member
Warzone 2100 Team Member
Posts: 3780
Joined: 03 Aug 2006, 19:39

Re: AI script: processing chats

Post by Per »

Thank you! :D
Post Reply