Tillmen
07-02-2012, 02:57 AM
For some reason that I don't yet understand, I just uploaded a script called xmpp4me. This script is for people in Shattered who know how to write scripts. I don't want to generalize the script enough to make it perfect for everyone, and I don't want to tell each person how to edit it. However, getting XMPP to work is not obvious. I think there's a fair number of people that will be able to edit the script themselves but wouldn't have known how to get XMPP to work.
For starters, the script will send you an instant message when you die, get a rank 2 or 3 injury, get an empty mind, when there's an obvious in-game announcement, or you get a private chat. There are a few Thread.new's towards the end of the script that are fairly independent from the rest of the script. You can comment them out or add new ones for other random things you want a notification for. These threads are for things that don't need to check game lines. At the end of the script there's a loop that checks each game line for something to notify you about. It should be pretty easy to add an elsif to that loop, but keep in mind the loop is looking at the xml stream.
Next, you can send instant messages back to the script. The command I use most often is:
,xp
The comma tells the script to take whatever comes after it and pretend you typed it into the front end. This includes starting scripts or using aliases. In this case, xp is an alias to ;xp, so it starts that script and sends back all the game lines it sees for the next second. If the default one second of game lines doesn't work in some situation, just put a the number of seconds in front of the comma. Or if you want to specify the number of lines instead of the number of seconds, use two commas.
To send a private chat, just use:
@<name> <message>
There are a few other random commands you can send to the script.
tune <channel>
This doesn't actually make LNet tune to the given channel, but instead sends you an IM when it sees an LNet chat from that channel. This means you can't abbreviate the channel name, and you may have to also do ,;tune <channel>
untune <channel>
Untunes the channel...
channels
Lists the channels you're tuned to.
.<chat message>
Sends the message to the channel you're tuned to, if you're only tuned to one channel.
<channel>.<chat message>
Sends the message to the given channel
goals
Gives you the link to train your character. I wasn't able to scroll down to see all the skills on my phone's browser.
XMPP is the instant message protocol used by Google Talk (more or less). I used this instead some other instant message service because Google Talk doesn't eat up the battery on an Android phone. It uses the same push notification that Gmail is already using. There is some lag when playing the game through instant messages, but the script isn't meant to be used to play the game for a long period of time. It's just for notifications and quickly checking things out. I use ConnectBot (Android SSH client) and a ridiculously simple terminal frontend if I need to do anything substantial in game while I'm away from my computer. The advantage of this script is that I can pull out my phone, send a command to the game, read the result, and put it away in about four seconds. On the other hand, it takes me about twenty seconds to start up ConnectBot, enter my password, wait for it to connect, and start the frontend.
To use the script, you'll need two XMPP accounts. Presumably you already have one, the Google account for your Android phone. If not, this script isn't for you. The other account is the one the script will log into. This can be another Google account or almost any random XMPP service. The great thing about XMPP is that the user names look like e-mail addresses with @somedomain.com on the end. This lets different XMPP servers communicate with each other and send instant messages across different services.
XMPP only lets you send instant messages to people that approve you. Log onto the XMPP account that will be used by the script with a normal instant messager like Pidgin and add the other account to your buddy list. Make sure to accept on the other account. Then log off and do something like this to tell the script about these accounts:
;xmpp4me local-account <xmpp username>
;xmpp4me local-password <xmpp password>
;xmpp4me remote-account <phone xmpp username>
You may have to add
require 'rubygems'
before
require 'xmpp4r'
in the script, since I just had to take that out of Lich.
This will never work.
For starters, the script will send you an instant message when you die, get a rank 2 or 3 injury, get an empty mind, when there's an obvious in-game announcement, or you get a private chat. There are a few Thread.new's towards the end of the script that are fairly independent from the rest of the script. You can comment them out or add new ones for other random things you want a notification for. These threads are for things that don't need to check game lines. At the end of the script there's a loop that checks each game line for something to notify you about. It should be pretty easy to add an elsif to that loop, but keep in mind the loop is looking at the xml stream.
Next, you can send instant messages back to the script. The command I use most often is:
,xp
The comma tells the script to take whatever comes after it and pretend you typed it into the front end. This includes starting scripts or using aliases. In this case, xp is an alias to ;xp, so it starts that script and sends back all the game lines it sees for the next second. If the default one second of game lines doesn't work in some situation, just put a the number of seconds in front of the comma. Or if you want to specify the number of lines instead of the number of seconds, use two commas.
To send a private chat, just use:
@<name> <message>
There are a few other random commands you can send to the script.
tune <channel>
This doesn't actually make LNet tune to the given channel, but instead sends you an IM when it sees an LNet chat from that channel. This means you can't abbreviate the channel name, and you may have to also do ,;tune <channel>
untune <channel>
Untunes the channel...
channels
Lists the channels you're tuned to.
.<chat message>
Sends the message to the channel you're tuned to, if you're only tuned to one channel.
<channel>.<chat message>
Sends the message to the given channel
goals
Gives you the link to train your character. I wasn't able to scroll down to see all the skills on my phone's browser.
XMPP is the instant message protocol used by Google Talk (more or less). I used this instead some other instant message service because Google Talk doesn't eat up the battery on an Android phone. It uses the same push notification that Gmail is already using. There is some lag when playing the game through instant messages, but the script isn't meant to be used to play the game for a long period of time. It's just for notifications and quickly checking things out. I use ConnectBot (Android SSH client) and a ridiculously simple terminal frontend if I need to do anything substantial in game while I'm away from my computer. The advantage of this script is that I can pull out my phone, send a command to the game, read the result, and put it away in about four seconds. On the other hand, it takes me about twenty seconds to start up ConnectBot, enter my password, wait for it to connect, and start the frontend.
To use the script, you'll need two XMPP accounts. Presumably you already have one, the Google account for your Android phone. If not, this script isn't for you. The other account is the one the script will log into. This can be another Google account or almost any random XMPP service. The great thing about XMPP is that the user names look like e-mail addresses with @somedomain.com on the end. This lets different XMPP servers communicate with each other and send instant messages across different services.
XMPP only lets you send instant messages to people that approve you. Log onto the XMPP account that will be used by the script with a normal instant messager like Pidgin and add the other account to your buddy list. Make sure to accept on the other account. Then log off and do something like this to tell the script about these accounts:
;xmpp4me local-account <xmpp username>
;xmpp4me local-password <xmpp password>
;xmpp4me remote-account <phone xmpp username>
You may have to add
require 'rubygems'
before
require 'xmpp4r'
in the script, since I just had to take that out of Lich.
This will never work.