mIRC Home    About    Download    Register    News    Help

Print Thread
Joined: Jan 2004
Posts: 509
L
Fjord artisan
OP Offline
Fjord artisan
L
Joined: Jan 2004
Posts: 509
Currently, I'm trying to while loop $calc($3- -2), but you get the idea.

Trying to get:

$3
$4
$5

etc. until it reaches $0.

Except, I'm using a variable.

Something like.

var %v = 3

Then $ $+ %v | inc %v

To get:

$ $+ %v = $ $+ 3 = $3 | inc %v
$ $+ %v = $ $+ 4 = $4 | inc %v

Etc.

Problem is, I can't concatenate.

$ = $chr(36)

Code.

Code:
  var %v = 3
  while (%v <= $0) {
    %v = $left($eval($ $+ %v,2),1)
    ;I've tried $left($eval($chr(36) $+ %v,2),1)    
    inc %v
  }


The above code was trying to while loop the 1st letter of each word in $3-: $3, $4, $5, etc.

Trying to get:

$left($3,1) | inc etc.
$left($4,1) | inc etc.

No luck.

And I would find it useful to while loop each and every word in $1- on an on text event. smirk

Thanks.

-Neal.

Joined: Mar 2005
Posts: 420
X
Fjord artisan
Offline
Fjord artisan
X
Joined: Mar 2005
Posts: 420
Why not use $gettok

Code:
  var %v = 3, %a
  while (%v <= $0) {
    %a = $left($gettok($1-,%v,32),1)
    inc %v
  }


/help $gettok

Your code is almost correct, except when you are setting the %v variable inside the /while loop then tries to increment it. Use another variable.

Last edited by xDaeMoN; 22/08/07 06:21 AM.

If you have a plastic floor runner over your tiles, then you're one Hella Pinoy!
Joined: Jul 2006
Posts: 4,164
W
Hoopy frood
Offline
Hoopy frood
W
Joined: Jul 2006
Posts: 4,164
In this case, you can avoid the while and use $* :
Code:
tokenize 32 $3-
scon -r var $(%v,0) = $(%v,0) $!left( $* ,1)


I give you this code because $* is more faster than a while but $* should not be used.


#mircscripting @ irc.swiftirc.net == the best mIRC help channel
Joined: Feb 2006
Posts: 546
J
Fjord artisan
Offline
Fjord artisan
J
Joined: Feb 2006
Posts: 546
Originally Posted By: Wims
but $* should not be used.


then why use it? >:D hah but ye, a lot has been said about the dangers of /scon etc, people should be warned about using that sorta stuff

theres an even simpler regex involved method of course

Code:
$regsubex($3-,/(?<=\S)\S+/g,)




"The only excuse for making a useless script is that one admires it intensely" - Oscar Wilde
Joined: Jan 2004
Posts: 509
L
Fjord artisan
OP Offline
Fjord artisan
L
Joined: Jan 2004
Posts: 509
Originally Posted By: xDaeMoN
Why not use $gettok

Code:
  var %v = 3, %a
  while (%v <= $0) {
    %a = $left($gettok($1-,%v,32),1)
    inc %v
  }


Sorry, that only returns $left($3,1).

Joined: Jan 2004
Posts: 509
L
Fjord artisan
OP Offline
Fjord artisan
L
Joined: Jan 2004
Posts: 509
Originally Posted By: Wims
In this case, you can avoid the while and use $* :
Code:
tokenize 32 $3-
scon -r var $(%v,0) = $(%v,0) $!left( $* ,1)


Okay, now I got something like:

# @ @ @ @ @ @ + + N N
Neal is in a minimum of 10 channels total.
Neal is in #bulbagarden @#mandy @#omgpwned @#Hell @#SocietyofLight @#Shadow_realm @#mIRC %wishmaker +#SSJ4RP +#teamgogo

The above returned the 1st letter of each char.

Although, if someone had a % (+h) in a channel, the script ignores, and I can guess obviously why..

Apparently, on 1 IRCd, there was a channel mode prefix that could also be in the channel name, and I didn't want that colored.

But now I see using $left() is useless because of the fact someone can have @+#channel, so no point using $left().

Well I guess I can $gettok() the left of the # sign.

I had:

%c = $replace(%c,!,6!,~,6~,&,6&,@,12@,%,4%,+,3+,-,11-)
/echo -s %c

But of course, it affects the channel name right of the # sound. Hence why I wanted to while loop $3-.


Link Copied to Clipboard