quote:
Originally posted by SpunkyLoveMuff
quote:
Originally posted by Plan-1130
make it work with commands too, like "/google <seach query>"
That'd only work with pre-defined browsers as I'd need to assign a command to each one.
No...
You/script don't need to do anything. It's the user who needs to define a command for it, but that is actually just the same.
Making commands in scripts is nothing more than sending some text to Plus! (to make them visible in the command helper window) and to check on the entered message in the chat window (to see if it is a command which your script reconizes).
But there is no difference between pre-defined commands and commands added by the user within your script, other than the latter being variable strings instead of pre-defined strings....
A statement like:
If (message === "/mycommand") {}
is just the same as
var usercommand = "/mycommand"
If (message === usercommand) {}
The only difference being that you can change
usercommand on the fly before doing the check because it is a variable (and thus read it from the user settings of the script for example; which also doesn't _need_ to be XML as markee suggested, it can be anything from the registry to a text file).