mIRC Home    About    Download    Register    News    Help

Print Thread
$read #44449 27/08/03 07:39 PM
Joined: Feb 2003
Posts: 3,432
S
sparta Offline OP
Hoopy frood
OP Offline
Hoopy frood
S
Joined: Feb 2003
Posts: 3,432
if i using this line:

set %backupcheck $read($mircdirgxfiles\r1.gx , 3)

shouldent that return line 3 in that file? it does that now..
but it set that line as the %backupcheck 2 times. so if i have a 1 in that line, then i want it to be:

%backupcheck 1

but now it set it like:

%backupcheck 1 1

line 3 in that file are a %var .. but why do it read that %var two times. any one have a naswer on that? :tongue:

i tested to use $read on another file, it works just great.. but how come it set the %var two times if the value i looking for is a %var? any way you can make $read read just the seccond word in line 3 ? cos then it dont need to read the %var.. somone that have any ides? confused

and if i add a word in Variables in mirc.. what happens if that value arent a %var ? for example if i add the word "ok" in that section, do mirc try to use that ok or do it just skip it? cos if i can add a word there without the %var first, then i can read the value just fine, never tryed it and cant see anything in the help file, but i dont dare to try it cos if it making somthing and f*k upp the %var's in that file, then i have to set them all again..


if ($me != tired) { return } | else { echo -a Get a pot of coffee now $+($me,.) }
Re: $read #44450 27/08/03 11:23 PM
Joined: Feb 2003
Posts: 79
A
Ancyker Offline
Babel fish
Offline
Babel fish
A
Joined: Feb 2003
Posts: 79
Please post an example of your current, your kinda confusing.

Re: $read #44451 28/08/03 02:36 AM
Joined: Feb 2003
Posts: 3,432
S
sparta Offline OP
Hoopy frood
OP Offline
Hoopy frood
S
Joined: Feb 2003
Posts: 3,432
Code:
alias verifygxf {
  set %backupcheck $read($mircdirgxfiles\r1.gx , 3)
  if (%backupcheck == gx) { match | goto end }
  .elseif (%backupcheck != gx) { nomatch | goto end }
  :end
}


This is how the code look like, and the file r1.gx have all the %variables in it.. so its from that file i doing all the settings, the line 3 is %ad1 gx ..
and the thing i trying to do is to read line 3 from the file, then verify so line 3 is the line with gx , but now it set the %backupcheck like gx gx , and thats wrong, i only have 1 gx in that line.. so it counts the %var in that line for one gx , then the gx behind that as one and give me the reply
%backupcheck gx gx , and i cant figure out how to make it only see the first one.. confused


if ($me != tired) { return } | else { echo -a Get a pot of coffee now $+($me,.) }
Re: $read #44452 28/08/03 03:20 AM
Joined: Feb 2003
Posts: 13
A
Arrow Offline
Pikka bird
Offline
Pikka bird
A
Joined: Feb 2003
Posts: 13
I think you meant to post this first of all:

Code:
alias verifygxf {
  set %backupcheck $read($mircdir\gxfiles\r1.gx , 3)
  if (%backupcheck == gx) { match | goto end }
  .elseif (%backupcheck != gx) { nomatch | goto end }
  :end}


Because there's no such identifier as $mircdirgxfiles. :P

If I had to guess, it's because those slashes sitting in between the variable $mircdir and the directory names. $mirc actually thinks you're hunting for a identifier named "$mircdir\gxfiles\r1.gx" instead of one identifier and two directories the way that code is, I think. Try seperating it with $+.

Code:
alias verifygxf {
  set %backupcheck $read($mircdir $+ \ $+ gxfiles $+ \ $+ r1.gx , 3)
  if (%backupcheck == gx) { match | goto end }
  .elseif (%backupcheck != gx) { nomatch | goto end }
  :end}


Also, the whole (%backupcheck == gx) thing. Are those supposd to be asterisks for wildcards you used around the gx? My Internet Explorer font is wonky, so I can't tell. If they are, you'll wanna use (*gx* iswm %backupcheck) and (*gx* !iswm %backupcheck) instead.

Re: $read #44453 28/08/03 03:29 AM
Joined: Dec 2002
Posts: 3,138
C
Collective Offline
Hoopy frood
Offline
Hoopy frood
C
Joined: Dec 2002
Posts: 3,138
Have you tried //echo -a $mircdirgxfiles?

Re: $read #44454 28/08/03 04:02 AM
Joined: Mar 2003
Posts: 1,271
L
LocutusofBorg Offline
Hoopy frood
Offline
Hoopy frood
L
Joined: Mar 2003
Posts: 1,271
$mircdir, $getdir, $scriptdir all accept that you append the next subdir/file without any fuss.

$mircdirversions.txt would return C:\Program files\mIRC\versions.txt

So that part of the original code will work just fine.

As for the rest -- the line you are reading, is that a variable (eg: %var), are a number. I get the impression it is a variable. You might wanna use the n flag in your $read, so mIRC will not try to evaluate the line it is reading as code, but consider it to be text.

Also -- things may become erratic if there are spaces in your path.

Code:
alias verifygxf {  
  [color:green]; no complicated $+ constructions here -- add the n[/color]
  set %backupcheck $read($mircdirgxfiles\r1.gx,n,3)
  [color:green]; mIRC doesn't use quotes to match a textstring in if statements[/color]
  [color:green]; like perl and php do, delete them[/color]
  if (%backupcheck == gx) { match } 
  [color:green]; since your elseif is the exact opposite as your if, a simple else will do[/color]
  [color:green]; also, if the condition is true, the script will never see the command 'nomatch',[/color]
  [color:green]; and since in boh cases you jump there, the goto construction is obsolete, even when[/color]
  [color:green]; there is more code after the :end that you had[/color]
  else { nomatch }
  [color:blue]You can insert more code here[/color]
}


DALnet #Helpdesk
I hear and I forget. I see and I remember. I do and I understand. -Confucius
Re: $read #44455 28/08/03 05:43 AM
Joined: Feb 2003
Posts: 3,432
S
sparta Offline OP
Hoopy frood
OP Offline
Hoopy frood
S
Joined: Feb 2003
Posts: 3,432
$mircdirgxfiles is the same as $mircdir/gxfiles .. and thats not the problem. the gx is the logo for the script.. and its set as a %var, but when i do a read in the file, then it returns gx gx .. thats whats wrong cos the %var only have one gx, so i dont know why it returns the %var as gx gx .. it must som how read the %var as a gx .. then it read what the %var return, thats also a gx .. so it gives me dubble of the logo, not just 1 as i want it to.. confused


if ($me != tired) { return } | else { echo -a Get a pot of coffee now $+($me,.) }
Re: $read #44456 28/08/03 05:48 AM
Joined: Feb 2003
Posts: 3,432
S
sparta Offline OP
Hoopy frood
OP Offline
Hoopy frood
S
Joined: Feb 2003
Posts: 3,432
its a %var yes, but no its no spaces in the path to that file.. and i try your code.. thnx.. smile

hmm, didnt work as i wanted it to do.. now it returns the value "%ad1 gx" , so it also return the %var, and i only want it to return the value of that %var, thats the logo "gx" .. grr, this wasnt as easy as i belived it should be grin

Last edited by sparta; 28/08/03 05:53 AM.

if ($me != tired) { return } | else { echo -a Get a pot of coffee now $+($me,.) }
Re: $read #44457 28/08/03 07:25 PM
Joined: May 2003
Posts: 215
lammkott Offline
Fjord artisan
Offline
Fjord artisan
Joined: May 2003
Posts: 215
Quote:
$mircdirgxfiles is the same as $mircdir/gxfiles


Not exactly, one will return C:\Program Files\mIRC\gxfiles the other will return C:\Program Files\mIRC\\gxfiles, which can cause errors.


- Jason
Re: $read #44458 29/08/03 01:02 AM
Joined: Jan 2003
Posts: 2,523
Q
qwerty Offline
Hoopy frood
Offline
Hoopy frood
Q
Joined: Jan 2003
Posts: 2,523
All mirc commands/identifiers accept paths like that:
//write -c $replace($mircdirblah.txt,\,///) bleh
works fine, for example.


/.timerQ 1 0 echo /.timerQ 1 0 $timer(Q).com