mIRC Home    About    Download    Register    News    Help

Print Thread
Joined: Jan 2003
Posts: 19
O
Pikka bird
OP Offline
Pikka bird
O
Joined: Jan 2003
Posts: 19
Here's my script

#Follow off
raw 319:*: { set %massjoin.string $sorttok($3-,32,c) | halt }
#Follow end
alias follow {
enable #Follow
whois $1
disable #Follow
set %massjoin.current 1
while (%massjoin.current <= $numtok(%massjoin.string,32)) {
set %massjoin.chan $gettok(%massjoin.string,%massjoin.current,32)
while ($left(%massjoin.chan,1) != $chr(35)) {
set %massjoin.chan $right(%massjoin.chan,$calc($len(%massjoin.chan) - 1))
}
join %massjoin.chan
inc %massjoin.current
}
unset %massjoin*
unset %massjoin.string
}

I have 2 problems with this script.

problem 1. Is there a way for mirc to make the script sleep for a minute after it does the whois, then resume. To allow it to set the variable?

problem 2. Is there any way of pausing the script for a second or 2 after it does the join %massjoin.chan so that i dont get flooded off and then resume.

Joined: Dec 2002
Posts: 417
O
Fjord artisan
Offline
Fjord artisan
O
Joined: Dec 2002
Posts: 417
set your msg on a timer that will give you the delay you are looking for. For more info type /help timers in mirc or use
this in your script
/timer 10 20 /msg $chan YOUR MESSAGE
or
/timer 10 20 /notice $nick YOUR MESSAGE




Intelligence: It's better to ask a stupid question, then to prove it by not asking....
Joined: Mar 2003
Posts: 9
D
dak Offline
Nutrimatic drinks dispenser
Offline
Nutrimatic drinks dispenser
D
Joined: Mar 2003
Posts: 9
just a note: timers do not pause a script, any commands in the script after them will be executed


______________________________

123go
Joined: Feb 2003
Posts: 47
G
Ameglian cow
Offline
Ameglian cow
G
Joined: Feb 2003
Posts: 47
why not let alias follow simply do the whois $1 and then set a var like %following to 1. Once you catch the raw command of the whois simply check %following. If it's 1 then run the code which is currently below the whois command and halt the default text of the whois. If it's not 1 then u can just let the whois perform it's normal action by not doing anything at all.

if u don't like that solution u can ofcourse use your own script with another while loop which loops untill the %massjoin string is set. This is risky cause u might get caught in an infinite loop (or however u write infinite :] )

hope this helps, grtz

Joined: Jan 2003
Posts: 19
O
Pikka bird
OP Offline
Pikka bird
O
Joined: Jan 2003
Posts: 19
Thank you, it skipped my mind of making the rest of the commands work after the RAW catch.

Now, the only problem i have is that it sends the join command too fast. Any ways to fix this? ie pause the script or pause one of the joinings. If it was unix it would be so easy.
sleep 2

And TIMERS DONT WORK. the timer would just be set within miliseccons of each other and all would join in the amount of the delay.

Last edited by OverDrive; 11/03/03 03:14 PM.
Joined: Dec 2002
Posts: 77
B
Babel fish
Offline
Babel fish
B
Joined: Dec 2002
Posts: 77
Timers don't work? that's news to me... I use them all the time.

If you want to delay joining a channel use something like...

.timer 1 5 join #chan

Which will attempt to join #chan in 5 seconds.

Joined: Jan 2003
Posts: 1,063
D
Hoopy frood
Offline
Hoopy frood
D
Joined: Jan 2003
Posts: 1,063
you are right in that... but if you have this:

alias jointest {
/timer 1 5 /join #chan1
/timer 1 4 /join #chan2
}

it will join #chan2 and a seconds later join #chan1... it won't 'pause' the script...


If it ain't broken, don't fix it!
Joined: Dec 2002
Posts: 143
A
Vogon poet
Offline
Vogon poet
A
Joined: Dec 2002
Posts: 143
Try this... I know it's quite big, but I'm sure someone can refine it!!! (if it works!!):

I presume /jointest is called without any parameters on first connect...

Code:
alias jointest {
  if ($1 === ^HalT^) { halt }
  if ($1 !== $null) {
    timer 1 5 join $1
    set %JoinTestChans $remtok(%JoinTestChans,$1,32)
    halt
  }
  [color:green];Replace #Chan1,2,3,4...etc with your channels (or use a variable)[/color]
  set %JoinTestChans #Chan2 #Chan3 #Chan4
  timer 1 5 join #Chan1
}

on *:JOIN:#:{
  if ($nick == $me) {
    if ($numtok(%JoinTestChans,32) == 0) { jointest ^halt^ }
    if ($numtok(%JoinTestChans,32) !== 0) { jointest $gettok(%JoinTestChans,1,32) }
  }
}


What it does is:
10 you type: /jointest when you connect.
20 you then join a server and the on JOIN event triggers.
30 on JOIN event starts the alias jointest <next chan>
40 timer is set to join the next channel
50 goto 20

something like that!!!

Hope it helps


Aubs.
cool

Joined: Dec 2002
Posts: 580
N
Fjord artisan
Offline
Fjord artisan
N
Joined: Dec 2002
Posts: 580
http://www.mircscripts.org/showdoc.php?type=code&id=1729

It's a function call /sleep

example usage:
Code:
on ^*:text:*:*:{
  ; Let's do this on a timer so we don't hold up the rest of the text event.
  .timer 1 0 testsleep
  echo $target $1-
  haltdef
}
alias testsleep {
  var %Count 1
  while (%Count &lt; 5) {
    if ($exists(%TestFile)) return $true
    sleep 3600 | inc %Count
  }
  return $false
}


NaquadaBomb
www.mirc-dll.com
Joined: Jan 2003
Posts: 19
O
Pikka bird
OP Offline
Pikka bird
O
Joined: Jan 2003
Posts: 19
You do know that's a bunch of crap. There is no sleep function in mirc. do a search for it and you wont find it in mirc's help file. and if u still dont believe me

# --ERROR-- Unknown command: SLEEP

that would be for a unix system, not mirc :P

Joined: Dec 2002
Posts: 3,138
C
Hoopy frood
Offline
Hoopy frood
C
Joined: Dec 2002
Posts: 3,138
Read his post again. You will find a magical thing called a "link". Click it and it will take you to a place with an equally magical piece of code to put in your remotes that will ADD a /sleep command to mIRC. Perhaps next time you would like to read what people say before you call it crap?

Joined: Feb 2003
Posts: 47
G
Ameglian cow
Offline
Ameglian cow
G
Joined: Feb 2003
Posts: 47
k, to elaborate on my previous post here's the complete script which should give u a start (not at home so can't test it).

Code:
raw 319:*:{
  ; check if follow toggle is on
  if (%following == 1) {

    ; create tokenized string of channels (space seperated)
    set %massjoin.string $sorttok($3-,32,c)

    ; toggle following to off so your next normal whois will be treated as a normal whois
    set %following 0

    ; set a timer (massjoin) to run for X times every 2 secs, where X = number of channels in tokenized string. Perform alias /massjoin.next
    .timermassjoin $numtok(%massjoin.string, 32) 2 /massjoin.next
    haltdef

    ; you should use this if check  with the haltdef in all whois replies if u want the entire whois hidden when doing a follow
    ; now the haltdef will only hide the channel reply
  }
}

alias massjoin.next {
  ; join first channel in tokenized string of channels (space seperated)
  join $gettok(%massjoin.string, 1, 32)

  ; remove first channel in tokenized string of channels (space seperated)
  %massjoin.string = $deltok(%massjoin.string, 1, 32)

  ; unset the now useless var %massjoin.string (i usually do this to keep my existing var list small, it's not really necessary)
  if ($numtok(%massjoin.string, 32) == 0) { unset %massjoin.string }
}

alias follow {
  ; toggle following to on
  set %following 1

  ; perform whois on target
  whois $1
}

; the comments make it long but i might have made a syntax mistake somewhere,
;   so i thought it was better to tell what each line should do so you can rectify any mistakes made
;
; I'm not sure what will happen if you perform a second /follow &lt;target&gt; while the first is still in action,
;   it will probably fail due to wrong variable values

Joined: Jan 2003
Posts: 19
O
Pikka bird
OP Offline
Pikka bird
O
Joined: Jan 2003
Posts: 19
Sorry collective, however i did go and their DB gave errors. So at the time, I couldnt tell, Now i see it. So im sorry.

I try it out, and it doesnt work, so now i can say its crap.


Joined: Jan 2003
Posts: 19
O
Pikka bird
OP Offline
Pikka bird
O
Joined: Jan 2003
Posts: 19
guesseyder.

I see that will work just like mine now, but it wont join more than 1 chan.

If you put a loop on it, it will join them quickly. I need a method to make the join pause for 2 seconds and then join the next one. It has the same problem.

Joined: Feb 2003
Posts: 47
G
Ameglian cow
Offline
Ameglian cow
G
Joined: Feb 2003
Posts: 47
ehm, still haven't tested my code at home since i haven't got around to it but it should join all channels. If the string that you receive from the 319 reply holds 7 channels for example, then the timer will run for 7 times with a break of 2 seconds in between. So for 7 times with a break of 2 seconds the alias massjoin.next {} will be called. In this call it will join the first channel and remove that item from the string (which in the first place was filled with the 7 channels in the 319 reply). So after the first call the string will be back to 6 items (or channels). After 7 calls the string will be empty and the timer will be stopped. So basically from my point of view the code should join all channels. Have you run the code to be sure? or did you read it and think it wouldn't work smile

I'll try it when i get around to it but i think my "theorie" is ok, so try to work on this if it really doesn't work now.


Link Copied to Clipboard