mIRC Home    About    Download    Register    News    Help

Print Thread
O
onesikgypo
onesikgypo
O
alright this script when i look at it in THEORY should work perfectly, but when used practically it doesnt, now i wont go into what is happening, but im starting to believe the script is running too fast for the dcc chat window/person, so i want to do a series of pauses between things, ill include the script below, and also include where things should be - or if their are better places feel free, but ull get the basic idea of what i want from below.

Code:
on *:chat:*: {
  :checkfiles
[color:green]; 10 sec wait here, then continue [/color]
  if ([txt] isin $1-) && ($1 !isupper) {
    write txtfiles.txt $1
[color:green]; 10 sec wait here, then continue [/color]
    goto writefolders
  }
  :writefolders
[color:green]; 10 sec wait here, then continue [/color]
  if ($1- isupper) {
   write FOLDERS.txt $1-
[color:green]; 10 sec wait here, then continue [/color]
      goto checkfolders
}
    
else {
      goto checkfolders
    }
    :checkfolders
[color:green]; 10 sec wait here, then continue [/color]
    if ( $read(FOLDERS.txt,$lines(FOLDERS.txt)) == /) {
[color:green]; 10 sec wait here, then continue [/color]
      msg =$nick cd ..
[color:green]; 10 sec wait here, then continue [/color]
      write -d FOLDERS.txt
[color:green]; 10 sec wait here, then continue [/color]
      msg =$nick dir
[color:green]; 10 sec wait here, then continue [/color]
      goto checkfiles
    }
[color:green]; 10 sec wait here, then continue [/color]
    elseif ( $read(FOLDERS.txt,$lines(FOLDERS.txt)) = $null) {
[color:green]; 10 sec wait here, then continue [/color]
      msg=$nick exit
    }
    
    else {
[color:green]; 10 sec wait here, then continue [/color]
      MSG =$nick cd $read(FOLDERS.txt,$lines(FOLDERS.txt))
[color:green]; 10 sec wait here, then continue [/color]
      write -d FOLDERS.txt
[color:green]; 10 sec wait here, then continue [/color]
      write FOLDERS.txt /
[color:green]; 10 sec wait here, then continue [/color]
      MSG =$nick dir
[color:green]; 10 sec wait here, then continue [/color]
      goto checkfiles
    }
    halt
  }
}


Note: ill probably not keep them ALL at 10 secs because it will take took long then, but just for this test im goin to do i need it to be 10

B
benjy355
benjy355
B
okok
replace ALLLLL those ;wait 10 seconds with
/timer 1 10 Commands Here

O
onesikgypo
onesikgypo
O
can i do multi-line with timers like:
Code:
checkfiles:
/timer 1 10 {
 if ([txt] isin $1-) && ($1 !isupper) {    
write txtfiles.txt $1
  }
}
/timer 1 10 { goto writefolders }
}

Joined: Aug 2004
Posts: 7,168
R
Hoopy frood
Offline
Hoopy frood
R
Joined: Aug 2004
Posts: 7,168
Not as you have it. For what you're using, you could just put it all on one line. If you had a lot of code to be run, on the timer, then you could put the code into an alias, then call the alias from the timer.

For your code, as you have it shown
Code:
 checkfiles:
/timer 1 10 { if ([txt] isin $1-) && ($1 !isupper) { write txtfiles.txt $1  } }
/timer 1 10 { goto writefolders } 


You also have an extra } in your code.

O
onesikgypo
onesikgypo
O
so this is how it should be right?

Code:
on *:chat:*: {
  :checkfiles
/timer 1 10 { if ([txt] isin $1-) && ($1 !isupper) { write txtfiles.txt $1  } }
/timer 1 10 { goto writefolders } 
  :writefolders
  /timer 1 10 { if ($1- isupper) { write FOLDERS.txt $1- } }
  /timer 1 10 { goto checkfolders }
/timer 1 10 { else { goto checkfolders } }

    :checkfolders
    /timer 1 10 { if ( $read(FOLDERS.txt,$lines(FOLDERS.txt)) == /) { msg =$nick cd .. } }
      /timer 1 10 { write -d FOLDERS.txt }
     /timer 1 10 { msg =$nick dir }
      /timer 1 10 { goto checkfiles }
  
    /timer 1 10 elseif ( $read(FOLDERS.txt,$lines(FOLDERS.txt)) = $null) { msg=$nick exit }
       
    /timer 1 10 else { MSG =$nick cd $read(FOLDERS.txt,$lines(FOLDERS.txt)) }
/timer 1 10 { write -d FOLDERS.txt }
     /timer 1 10 { write FOLDERS.txt / }
     /timer 1 10 { MSG =$nick dir }
     /timer 1 10 { goto checkfiles }
    }
    halt
  }

Joined: Feb 2005
Posts: 342
R
Fjord artisan
Offline
Fjord artisan
R
Joined: Feb 2005
Posts: 342
No.

That will trigger all the stuff in 10 seconds. You'll want to use:

/timer 1 $calc(10*1)
/timer 1 $calc(10*2)
/timer 1 $calc(10*3)

and so on.

also, this else statement is not needed:

Code:
else { goto checkfolders }
:checkfolders


Regardless of the else statement, it will drop down to the :checkfolders line.

If you want to test this, just try:
Code:
alias testing {
:start
echo -s start
:body
echo -s body
:end
echo -s end
}

O
onesikgypo
onesikgypo
O
like this, the only thing im uncertain about is like the if else and elseif statements so im not entirely sure.

Code:
on *:chat:*: {
  :checkfiles
/timer 1 $calc(10*1) { if ([txt] isin $1-) && ($1 !isupper) { write txtfiles.txt $1  } }
/timer 1 $calc(10*2) { goto writefolders } 
  :writefolders
  /timer 1 $calc(10*1) { if ($1- isupper) { write FOLDERS.txt $1- } }
  /timer 1 $calc(10*2) { goto checkfolders }
/timer 1 $calc(10*3) { else { goto checkfolders } }

    :checkfolders
    /timer 1 $calc(10*1) { if ( $read(FOLDERS.txt,$lines(FOLDERS.txt)) == /) { msg =$nick cd .. } }
      /timer 1 $calc(10*2) { write -d FOLDERS.txt }
     /timer 1 $calc(10*3) { msg =$nick dir }
      /timer 1 $calc(10*4) { goto checkfiles }
  
    /timer 1 $calc(10*5) elseif ( $read(FOLDERS.txt,$lines(FOLDERS.txt)) = $null) { msg=$nick exit }
       
    /timer 1 $calc(10*6) else { MSG =$nick cd $read(FOLDERS.txt,$lines(FOLDERS.txt)) }
/timer 1 $calc(10*7) { write -d FOLDERS.txt }
     /timer 1 $calc(10*8) { write FOLDERS.txt / }
     /timer 1 $calc(10*9) { MSG =$nick dir }
     /timer 1 $calc(10*10) { goto checkfiles }
    }
    halt
  }
}

Joined: Feb 2005
Posts: 342
R
Fjord artisan
Offline
Fjord artisan
R
Joined: Feb 2005
Posts: 342
Meh, I don't think your script is going to work too well.

Give me a few, I'll download a fserv bot or something, and see if I can find a solution for you.

Actually, better idea, drop me a private message with the network and channel you're on, and I'll run a few tests..

Last edited by Rand; 29/10/05 07:57 AM.
O
onesikgypo
onesikgypo
O
alright, but in *theory* should work at least?

i know u can do it thru tree algorithms but i got no idea how to

Joined: Apr 2003
Posts: 701
K
Hoopy frood
Offline
Hoopy frood
K
Joined: Apr 2003
Posts: 701
It's impossible to do what you want in mIRC.

A possible way to approach it: make a separate alias for each piece of code in between 2 waits, and put at the end of each alias .timer 1 10 nextalias arguments. Change the alias name and the arguments ofcourse. Note that all /var settings, and $1- and such are gone unless you pass those again as vaiables or use public variables (which can make things worse if you run the script again before it's completely ended). Ofcourse it's also impossinbe to spread a while loop out over 2 or more aliases, so you can't use those either. You can use if-elseif-else but they all need to be in the same alias ofcourse.

To get you started:
Code:
on *:chat:*:{ .timer 1 10 chat1 $1- }
alias chat1 {
  if ([txt] isin $1-) && ($1 !isupper) {
    write txtfiles.txt $1
    .timer 1 10 chat2 $nick $1-
  }
  else {
    chat2 $nick $1-
  }
}
alias chat2 {
  if ($2- isupper) {
    write FOLDERS.txt $2-
    .timer 1 10 chat3 $1-
  }
  elseif (somethingelse) {
    msg $1 hey you said $2-
    .timer 1 10 chat4 $1-
  }
}
...


Yes it's bad, I don't like it either, but the other alternative is even worse:
Code:
alias wait { var %t = $ctime + $iif($1 isnum 1-,$1,5) | while (%t > $ctime) ! }

This will wait for about the given number of seconds, or 5 seconds if no parameter. It will also hang your mIRC during that waiting time. Simply put, if you wait 20 seconds mIRC will look like it's crashed for 20 seconds, no screen updates, no new messages, no typing possible, 100% CPU usage. If you wait for a few minutes you will disconnect from the irc server. Don't know about dcc sends or chats, but my guess is they will timeout too.

D
Dr_Brom_sung_
Dr_Brom_sung_
D
I wouldn't preffer having an alias for each set of commmands I have to do in each time.

I think that one idea is to have 1 alias and few if + else statements:


alias test {
unset %tvar
test2
}

alias test 2{
if (%tvar == 1) {
Do this
and this
and this
bla
bla
bla
inc %tvar
.timer 1 10 test 2
}
if (%tvar == 2) {
Do this
and this
and this
bla
bla
bla
inc %tvar
.timer 1 10 test 2
}
if (%tvar == 3) {
Do this
and this
and this
bla
bla
bla
inc %tvar
.timer 1 10 test 2
}
}


etc, etc

O
onesikgypo
onesikgypo
O
alright well ill test both out when i can

Last edited by onesikgypo; 29/10/05 10:31 PM.

Link Copied to Clipboard