mIRC Homepage
Posted By: sandygws Question about a trading script - 13/04/12 04:09 AM
I'm using a trade script to transfer files between 2 FTP servers. Part of it is as follows:

Quote:
if (720p.HDTV.x264-MOMENTUM isin $2) && (provide isin $5) {
var %section = TV
var %rl = $2
var %sourcename = site1
var %sourcedir = /tv-x264/
var %curryname = site2
var %currydir = /tv-x264/



Now, the problem is that on site1 the %rl = $2 is picking up a release including the 'TV+' part as the irc string is as follows:

TV+The.First.48.S12E10.720p.HDTV.x264-MOMENTUM

So when the release name is picked up, it looks for the complete string, not just the actual release name: The.First.48.S12E10.720p.HDTV.x264-MOMENTUM

How do I tell the script to ignore the 'TV+' part in the var %rl = $2 variable?
Posted By: ProoN Re: Question about a trading script - 13/04/12 04:56 AM
$replace(%rl,TV+,$null)
Posted By: sandygws Re: Question about a trading script - 13/04/12 04:59 AM
Thanks ProoN,

Do I just replace

var %rl = $2

with

$replace(%rl,TV+,$null)?
Posted By: ProoN Re: Question about a trading script - 13/04/12 05:08 AM
Quote:

if (720p.HDTV.x264-MOMENTUM isin $2) && (provide isin $5) {
var %section = TV
var %rl = $replace($2,TV+,$null)
var %sourcename = site1
var %sourcedir = /tv-x264/
var %curryname = site2
var %currydir = /tv-x264/


Apologies. Try that.
Posted By: sandygws Re: Question about a trading script - 13/04/12 05:13 AM
Thanks!

Now to wait and see if it works smile


Grrr .. it's actually TV+/

So I guess var %rl = $replace($2,TV+/,$null) is correct?

Posted By: ProoN Re: Question about a trading script - 13/04/12 05:21 AM
You could try that, although I personally try to avoid using slashes or commas within an identifier. I've found that it sometimes makes things sketchy. I, instead, generally use the $chr equivalent, ie

Quote:

if (720p.HDTV.x264-MOMENTUM isin $2) && (provide isin $5) {
var %section = TV
var %rl = $replace($2,TV+ $+ $chr(47),$null)
var %sourcename = site1
var %sourcedir = /tv-x264/
var %curryname = site2
var %currydir = /tv-x264/


See if that works.
Posted By: sandygws Re: Question about a trading script - 13/04/12 05:42 AM
Even better, thanks.

Also, taking these releases as an example:

The.First.48.S12E10.720p.HDTV.x264-MOMENTUM
The.First.48.S12.Update.Special.05.HDTV.x264-MOMENTUM


How do I ignore the '720p' release if I'm using

Quote:
if (HDTV.x264-MOMENTUM isin $2) && (provide isin $5) {


and only trade HDTV.x264-MOMENTUM?

smile
Posted By: ProoN Re: Question about a trading script - 13/04/12 05:49 AM
Are you implying there are two results you're trying to get the script to distinguish between?

Quote:

while (*720p* !iswm %rl) { ... }

where within the brackets, { and } are where you'd execute the command, of course

Damn, constantly editing this. Trying to make it more generic rather than specific to those single titles
Posted By: sandygws Re: Question about a trading script - 13/04/12 02:02 PM
Yes, the two examples are both HDTV, but one is standard HDTV, the other 720p HDTV.

Quote:
HDTV.x264-MOMENTUM isin $2


The problem is that the above will match 720p.HDTV.x264-MOMENTUM and HDTV.x264-MOMENTUM

So how I would tell the script to ignore the 720p bit where necessary?
Posted By: Loki12583 Re: Question about a trading script - 13/04/12 03:30 PM
Code:
... && (720p !isin %text)
Posted By: sandygws Re: Question about a trading script - 13/04/12 04:50 PM
Thanks Loki

Quote:
(720p.HDTV.x264-MOMENTUM isin $2) && (720p !isin %text) {


Would trade

The.First.48.S12.Update.Special.05.HDTV.x264-MOMENTUM

but skip

The.First.48.S12E10.720p.HDTV.x264-MOMENTUM

... right?

Posted By: ProoN Re: Question about a trading script - 13/04/12 11:07 PM
Quote:
if (*The.First.48.S12*HDTV.x264-MOMENTUM* iswm $2) && (*720p* !iswm $2) && (provide isin $5) {
var %section = TV
var %rl = $replace($2,TV+ $+ $chr(47),$null)
var %sourcename = site1
var %sourcedir = /tv-x264/
var %curryname = site2
var %currydir = /tv-x264/
Posted By: sandygws Re: Question about a trading script - 13/04/12 11:17 PM
Nice and tidy ProoN, thanks

To confirm: that will NOT trade 720p, right?

ie line 3 ignores the 720p part?
Posted By: ProoN Re: Question about a trading script - 13/04/12 11:23 PM
(*720p* !iswm $2) is what ignores the 720p part. That little bit checks to see if "720p" ISN'T in the $2, and if it isn't, continues on with the code.

Line 3 replaces the TV+/ with "$null" (or .. nothing, essentially) and sets THAT result to %rl. Could have easily just used $remove, but eh, there are many ways to accomplish the same thing. Hopefully that works, though
Posted By: sandygws Re: Question about a trading script - 13/04/12 11:34 PM
Very nice indeed. Just waiting to see if it works!

One question though: which version is correct:

Quote:
if (*HDTV.x264-MOMENTUM* iswm $2) && (*720p* !iswm $2)


or

Quote:
if (*720p.HDTV.x264-MOMENTUM* iswm $2) && (*720p* !iswm $2)


smile
Posted By: ProoN Re: Question about a trading script - 13/04/12 11:47 PM
Well, if you want it to check for only the HDTV.x264-MOMENTUM part, it'd be

Quote:
if (*HDTV.x264-MOMENTUM* iswm $2) && (*720p* !iswm $2) && (provide isin $5) {
var %section = TV
var %rl = $replace($2,TV+ $+ $chr(47),$null)
var %sourcename = site1
var %sourcedir = /tv-x264/
var %curryname = site2
var %currydir = /tv-x264/


But if you wanted it to check for both HDTV.x264-MOMENTUM and the The.First.48.S12 parts, it'd be

Quote:
if (*The.First.48.S12*HDTV.x264-MOMENTUM* iswm $2) && (*720p* !iswm $2) && (provide isin $5) {
var %section = TV
var %rl = $replace($2,TV+ $+ $chr(47),$null)
var %sourcename = site1
var %sourcedir = /tv-x264/
var %curryname = site2
var %currydir = /tv-x264/


Neither of those will do anything if 720p is anywhere within the titles, which is what you're wanting.. I think. hah
Posted By: sandygws Re: Question about a trading script - 13/04/12 11:50 PM
Originally Posted By: ProoN
Well, if you want it to check for only the HDTV.x264-MOMENTUM part, it'd be


Yes, I only want it to trade HDTV.x264-MOMENTUM - and skip the 720p versions.

laugh

Quote:
Neither of those will do anything if 720p is anywhere within the titles


720p is in the titles .. that's why I want to skip it.

So the above will skip any release with 720p in the title, right?
Posted By: ProoN Re: Question about a trading script - 13/04/12 11:52 PM
First one should ultimately be what you're wanting.. I think(?). But they both ignore anything with "720p" in it, yes
Posted By: sandygws Re: Question about a trading script - 14/04/12 07:45 AM
I have a further question ProoN:

Quote:
if (*HDTV.x264-MOMENTUM* iswm $2) && (*720p* !iswm $2) && (provide isin $5) {


How do I change that to match HDTV.x264-MOMENTUM anywhere in the irc announce string .. not just in 'position' $2 ?

Posted By: Tomao Re: Question about a trading script - 14/04/12 06:30 PM
Originally Posted By: sandygws
How do I change that to match HDTV.x264-MOMENTUM anywhere in the irc announce string .. not just in 'position' $2 ?
You can indicate the token range like so:
Code:
if (*HDTV.x264-MOMENTUM* iswm $2-5)
$2-5 means $2, $3, $4, and $5, respectively.
Posted By: sandygws Re: Question about a trading script - 14/04/12 07:09 PM
Thanks!

How can I do the same to ensure this part matches anywhere from 2 - 5:

Quote:
var %rl = $4
Posted By: Tomao Re: Question about a trading script - 14/04/12 09:56 PM
var %rl = $2-5
Posted By: sandygws Re: Question about a trading script - 14/04/12 11:46 PM
Perfect, thanks!
© mIRC Discussion Forums