mIRC Home    About    Download    Register    News    Help

Print Thread
#122201 07/06/05 12:52 PM
Joined: Apr 2005
Posts: 2
A
alexm Offline OP
Bowl of petunias
OP Offline
Bowl of petunias
A
Joined: Apr 2005
Posts: 2
Hey there. I do a bunch of scripts for fun, and one thing I don't get is I can't do these:
Code:
on *:JOIN:(mychannel): {
%i = 1
while (%i <= $len($nick)) {
.timer 1 1 msg $chan $upper($mid($nick,%i,1))
inc %i
}
}

To print out, say
B
O
B
With a one second delay. What do I have to end up doing? Writing it out to a text file, and /playing it. confused confused
And if I try doing a .timer $len($nick) 1 ... it just waits one second, blurts out BOB, waits another second, etc.
Am I missing somthing?

#122202 07/06/05 01:25 PM
Joined: Mar 2005
Posts: 74
D
Babel fish
Offline
Babel fish
D
Joined: Mar 2005
Posts: 74
Code:
on *:JOIN:#CHANNEL: {
  var %i = 1
  while (%i <= $len($nick)) {
    .timer 1 %i msg $chan $mid($nick,%i,1)
    inc %i
  }
}

this works =) first letter is said after 1sec, 2nd after 2seconds.. So, your 1sec interval is there.

Also, var %i means the %i gets deleted after use, instead of keeping it (like your code had)

#122203 07/06/05 04:56 PM
Joined: Apr 2005
Posts: 2
A
alexm Offline OP
Bowl of petunias
OP Offline
Bowl of petunias
A
Joined: Apr 2005
Posts: 2
Oh, DUH!!! Can sombody smack me with a large trout please? Thank you very much.

PS. um, about the var thing, it deletes it after the script is done? I thought it just cleared it b4 using it....

#122204 07/06/05 11:04 PM
Joined: Aug 2004
Posts: 7,252
R
Hoopy frood
Offline
Hoopy frood
R
Joined: Aug 2004
Posts: 7,252
var variables are deleted when the script that sets them completes running.

#122205 07/06/05 11:35 PM
Joined: Sep 2003
Posts: 4,230
D
Hoopy frood
Offline
Hoopy frood
D
Joined: Sep 2003
Posts: 4,230
Code:
on *:JOIN:(mychannel): {
  .timer.join.msg.nick.letters.* off
  var %i = $len($nick)
  while (%i) {
    .timer.join.msg.nick.letters. $+ %i 1 %i msg $chan $!( $+ $upper($mid($nick,%i,1)) $+ ,)
    dec %i
  }
}


This well do the same, but well only do the last person to join, ignoring any it was currently doing, this well save your bacon on a netsplit, but wont really be noticed unless two people join nearly at the same time.

I also used $( X ,) to surround each letter of the nick, while its not needed here, one nick letter can cause it problems if you exapaded the script latter.


Link Copied to Clipboard