mIRC Home    About    Download    Register    News    Help

Print Thread
Joined: May 2015
Posts: 3
B
Baldr Offline OP
Self-satisified door
OP Offline
Self-satisified door
B
Joined: May 2015
Posts: 3
I have never done any scripting with mIRC before, despite using it for years. I do have some programming background which may help.

I believe what I want will be fairly simple.

I would like a script to watch a channel (possibly more than one) for a line like this :

Revive XenaSeven0! http://www.torn.com/profiles.php?XID=181981

The name (XenaSeven) and ID (181981) will vary, but the rest will be the same.

When a line like that is seen, I would like to create a similar, but slightly different URL and auto load it into my browser. The new URL would look like this.

http://www.torn.com/revive.php?action=revive&ID=181981

So the goal is to watch for a line being posted that fits the first one, pull the ID from the end, and use that ID to create the second URL, then auto-load it into my default browser. (Or, if it's easier, we can specify a browser.)

This looks like it should be done with what mIRC calls a remote script (it's triggered by someone else).

I tried this, which should have just watched for the trigger line and posted a short msg for me to see, but it didn't work as expected. That's when I came here for help.

On *:Text:*:#:{
if ((Revive isin $1-) and (http://www.torn.com/profiles.php?XID= isin $1-)) {
echo -a So far so good!
}
}

Trying that, I got the "So far so good!" thing a lot, even when nothing seemed to be happening.

Any help would be appreciated.

Joined: Jan 2004
Posts: 1,358
L
Hoopy frood
Offline
Hoopy frood
L
Joined: Jan 2004
Posts: 1,358
Code:
on $*:text:/Revive (.+?)! http\x3A\/\/www.torn.com\/profiles\.php\?XID=(\d+)/iS:#:{
  var %name = $regml(1), %id = $regml(2)
  var %url = http://www.torn.com/revive.php?action=revive&ID= $+ %id
  url %url
}


Untested

Joined: May 2015
Posts: 3
B
Baldr Offline OP
Self-satisified door
OP Offline
Self-satisified door
B
Joined: May 2015
Posts: 3
Thanks, Loki. That did exactly what I wanted.

Unfortunately, I was trying to manipulate the URL to save a step (which is why we pulled the ID out and made a new URL.) And the system won't let me jump directly to that direct URL.

So I want to watch for the same thing, but then I want to load the link that was in the line we parsed, without modifying it. (I suspect I can figure that out, I haven't tried yet.)

BTW, I find it amusing that Loki is the one helping Baldr here. smile

Last edited by Baldr; 03/05/15 09:30 PM.
Joined: May 2015
Posts: 3
B
Baldr Offline OP
Self-satisified door
OP Offline
Self-satisified door
B
Joined: May 2015
Posts: 3
I was able to adjust the code you gave me for the results I needed. Thanks a lot!


Link Copied to Clipboard