mIRC Home    About    Download    Register    News    Help

Print Thread
#162326 16/10/06 10:14 PM
B
bwuser
bwuser
B
DaveC gave me this great script. problem is after minor changes it stopped working. please someone tell me where i went wrong

Code:
alias isin.match.txt {
  if ($isfile($+($scriptdir,match.txt))) {
    if (($file($+($scriptdir,match.txt)).mtime != %match.txt.file.mtime) || (!$hget(match.txt))) {
      set -se %match.txt.file.mtime $file($+($scriptdir,match.txt)).mtime
      hfree -w match.txt
      hmake    match.txt
      hload -n match.txt match.txt
    }
    var %c = 1 | while (%c <= $numtok($1,46)) {
      if ($hfind(match.txt,$gettok($1,$+(1-,%c),46)).data) { return $v1 }
      inc %c
    }
  }
}
 


this one Doesn't work

Code:
alias sports.match {
  if ($isfile($+($mircdir,TVCheck\sports.txt))) {
    if (($file($+($mircdir,TVCheck\sports.txt)).mtime != %sports.txt.file.mtime) || (!$hget(sports.txt))) {
      set -se %sports.txt.file.mtime $file($+($mircdir,TVCheck\sports.txt)).mtime
      hfree -w sports.txt
      hmake    sports.txt
      hload -n sports.txt sports.txt
    }
    var %c = 1 | while (%c <= $numtok($1,46)) {
      if ($hfind(sports.txt,$gettok($1,$+(1-,%c),46)).data) { return $v1 }
      inc %c
    }
  }
}


offcourse the txt's exist in the places specified
i dont know whats wrong frown

#162327 16/10/06 10:49 PM
Joined: Aug 2005
Posts: 1,052
L
Hoopy frood
Offline
Hoopy frood
L
Joined: Aug 2005
Posts: 1,052
Quote:
DaveC gave me this great script. problem is after minor changes it stopped working. please someone tell me where i went wrong

Code:
alias isin.match.txt {
  if ($isfile($+($scriptdir,match.txt))) {
    if (($file($+($scriptdir,match.txt)).mtime != %match.txt.file.mtime) || (!$hget(match.txt))) {
      set -se %match.txt.file.mtime $file($+($scriptdir,match.txt)).mtime
      hfree -w match.txt
      hmake    match.txt
      hload -n match.txt match.txt
    }
    var %c = 1 | while (%c <= $numtok($1,46)) {
      if ($hfind(match.txt,$gettok($1,$+(1-,%c),46)).data) { return $v1 }
      inc %c
    }
  }
}
 


this one Doesn't work

Code:
alias sports.match {
  if ($isfile($+($mircdir,TVCheck\sports.txt))) {
    if ($file($+($mircdir,TVCheck\sports.txt)).mtime != %sports.txt.file.mtime) || (!$hget(sports.txt)) {
      set -se %sports.txt.file.mtime $file($+($mircdir,TVCheck\sports.txt)).mtime
      hfree -w sports.txt
      hmake    sports.txt
      hload -n sports.txt [color:red]$qt($mircdirTVCheck\sports.txt)[/color]
    }
    var %c = 1 | while (%c <= $numtok($1,46)) {
      if ($hfind(sports.txt,$gettok($1,$+(1-,%c),46)).data) { return $v1 }
      inc %c
    }
  }
}


offcourse the txt's exist in the places specified
i dont know whats wrong frown


Edited in red

I saw something wrong too is that the HLOAD was not assigned to target location sports.txt didnt exist in the mircdir so you have to assign its path youll see what I meat i also put $qt(command) incase of spaces if it still doesnt work use $+(",command,")

Last edited by Lpfix5; 16/10/06 11:09 PM.
#162328 16/10/06 11:18 PM
B
bwuser
bwuser
B
still not working frown
when trying to use it with this:
Code:
ON 1: TEXT:*:# {
  if ($nick isin %test) {
    set %testnick $nick
    set %testitem $strip($1-)

    ;[New TV]
    if (classification isin %testitem) { 
      set %tv $strip($dotdash($right(%rls,-15)))
      if ($read($shortfn($mircdirTVCheck\check.txt),w,$allcut(%tv))) { echo testcheck works }
      elseif ($read($shortfn($mircdirTVCheck\check2.txt),w,$allcut(%tv))) { echo testcheck2 works }
      elseif ($isin.sports.match(%tv)) { testcheck3 works }      
   }

    unset %testnick
    unset %testitem
  }
  else {
    halt
  }
}



testcheck 1 and 2 work fine (for those i use regex)
but i was using it to show that it wasnt the detection script
it must be in the code i need fixing frown

Last edited by bwuser; 16/10/06 11:22 PM.
#162329 16/10/06 11:21 PM
D
DaveC
DaveC
D
good catch, i never noticed it becuase i ran it from the mirc folder anyway, so scriptdir matched to just using match.txt on its own. oppps!

#162330 16/10/06 11:32 PM
B
bwuser
bwuser
B
it's still not working though DaveC
any suggestions?
it works great from $scriptdir

#162331 16/10/06 11:32 PM
Joined: Aug 2005
Posts: 1,052
L
Hoopy frood
Offline
Hoopy frood
L
Joined: Aug 2005
Posts: 1,052
Quote:
good catch, i never noticed it becuase i ran it from the mirc folder anyway, so scriptdir matched to just using match.txt on its own. oppps!


Yup, the problem I have with $scriptdir is its called from the well exactly how the eval is called scriptdir it detects the dir where your script is so for example if TXT file isin C:\program files\mirc\txt\hi.txt and your script you saved it in C:\program files\mIRC\system\scripts\myscript.mrc your path $scriptdir wont work for him unless script isin root

but then the next problem is if you use $mIRCdir for example you might often have space issues in your path. Nothing $qt or $+(",command,") can't fix but you can be spending hours trying to figure out when your new to scripting why its not working when everything is perfect by the book,.

So just a note to new users wrap your path in quotes using either $+(",PATH,") or $qt(path)

#162332 16/10/06 11:34 PM
Joined: Aug 2005
Posts: 1,052
L
Hoopy frood
Offline
Hoopy frood
L
Joined: Aug 2005
Posts: 1,052
Quote:
it's still not working though DaveC
any suggestions?
it works great from $scriptdir


Are you sure? because your code is correct syntax just a small little issue in the target location like i mentioned if its not working remove $qt($mircdirTVCheck\sports.txt) and use $+(",$mircdirTVCheck\sports.txt,")

#162333 16/10/06 11:36 PM
B
bwuser
bwuser
B
my mircdir is c:\mIRC-X\
can you please paste the code which i should use now?
im a bit lost and still dont have it working in my \TVCheck\ dir

#162334 16/10/06 11:36 PM
B
bwuser
bwuser
B
nope not working

Last edited by bwuser; 16/10/06 11:37 PM.
#162335 16/10/06 11:44 PM
Joined: Aug 2005
Posts: 1,052
L
Hoopy frood
Offline
Hoopy frood
L
Joined: Aug 2005
Posts: 1,052
Quote:
nope not working


Code:
alias sports.match {
  if ($isfile($mircdirTVCheck\sports.txt)) {
    if ($file($mircdirTVCheck\sports.txt).mtime != %match.txt.file.mtime) || (!$hget(sports.txt)) {
      set -se %match.txt.file.mtime $file($mircdirTVCheck\sports.txt).mtime
      hfree -w sports.txt
      hmake    sports.txt
      hload -n sports.txt $qt($mircdirTVCheck\sports.txt)
    }
    var %c = 1 | while (%c <= $numtok($1,46)) {
      if ($hfind(sports.txt,$gettok($1,$+(1-,%c),46)).data) { return $v1 }
      inc %c
    }
  }
}


try that code was somethings i edited when i started with the script which didnt need too but they are there... in exact working condition.. so ... therefore it should work if the original one was working for you..

make sure your .txt file in tvcheck is sports.txt not sport.txt

and to make sure your path is correct type //echo -a $exists($mircdirTVCheck\sports.txt)

if that returns $true it means it exists otherwise its false.

#162336 16/10/06 11:54 PM
B
bwuser
bwuser
B
it replies $true
but still not working frown

#162337 17/10/06 12:11 AM
D
DaveC
DaveC
D
go back to the original script (the one that didnt work right you posted)

and replace this line
hload -n sports.txt sports.txt
with this line
hload -n sports.txt $qt($+($mircdir,TVCheck\sports.txt))

And then make sure the same sports.txt that was in he mirc folder is now in the TVCHECK folder

beyond that i cant see what it can be


PS: to anyone who cares, yes i know $mircdir can live with text appened to the end, its just i find the idea that SOME identifiers allow it and others dont, distrubing, so i dont ever attach to them at all!

#162338 17/10/06 12:14 AM
B
bwuser
bwuser
B
nope frown
guess i will have to run it from mirc dir

#162339 17/10/06 12:24 AM
B
bwuser
bwuser
B
did you guys get it working on your own mirc?

Last edited by bwuser; 17/10/06 12:27 AM.
#162340 17/10/06 03:02 AM
Joined: Aug 2005
Posts: 1,052
L
Hoopy frood
Offline
Hoopy frood
L
Joined: Aug 2005
Posts: 1,052
Quote:
did you guys get it working on your own mirc?


Yes I have DaveC p.s why are you using $+($mircdir,TVCheck\sports.txt) ? lol jk :P

#162341 17/10/06 03:08 AM
D
DaveC
DaveC
D
Code:
alias sports.match {
  if ($isfile($+($mircdir,TVCheck\sports.txt))) {
    if (($file($+($mircdir,TVCheck\sports.txt)).mtime != %sports.txt.file.mtime) || (!$hget(sports.txt))) {
      set -e %sports.txt.file.mtime $file($+($mircdir,TVCheck\sports.txt)).mtime
      hfree -w sports.txt
      hmake    sports.txt
      hload -n sports.txt $qt($+($mircdir,TVCheck\sports.txt))
    }
    var %c = 1 | while (%c <= $numtok($1,46)) {
      if ($hfind(sports.txt,$gettok($1,$+(1-,%c),46)).data) { return $v1 }
      inc %c
    }
  }
}


Now the only thing i changed (which didnt effect it anyway) was the 4th line i removed the -s switch which displayed the value being set (this i accidently left in from when i was testing the script)

The only reason your might not be working is you might still be using the old one, Its now $sports.match($1-) returning $null for no match or N for matched line number.

I have tested this and it functions as expected.


Link Copied to Clipboard