When an event fires it will have in it a few parameters. Like in a chat event it will have parameters of who sent it, what they said, and what channel it was in.
I'm sure that chat line will send the whole line of text, and you could just search for the first word in the string. (As a matter of fact, you could probably get the exact code you're looking for out of some of the macros in the depot)
Edit:
Here's the command to search the string sent to the event, straight outta the manual:
Code: Select all
$instr(word,"string"|"@varname")
Returns the location of word inside string, returns -1 if not found