mIRC Home    About    Download    Register    News    Help

Print Thread
Joined: Sep 2007
Posts: 202
F
firefox Offline OP
Fjord artisan
OP Offline
Fjord artisan
F
Joined: Sep 2007
Posts: 202
atm I have :

while ($somefunction) && (%a < %b) {
inc %a
.msg $chan  output of function
if (%a > %b) { halt }
}

so if %b = 10 it will output a message on 10 lines

how can I get it to delay all the outputs and just put them on one line as a single /msg ?

thanks

Joined: Sep 2008
Posts: 62
_
Babel fish
Offline
Babel fish
_
Joined: Sep 2008
Posts: 62
What is $somefunction, and what is output of said function?


DEC

Code:
var %a = 5
while (%a) {
<code>
dec %a
}


INC
Code:
var %a = 0, %b = 5
while (%a < %b) {
<code>
inc %a
}


Either method works, but as for what $somefunction is, you might be approaching this in an over redundant way.



Joined: Nov 2006
Posts: 1,559
H
Hoopy frood
Offline
Hoopy frood
H
Joined: Nov 2006
Posts: 1,559
If the "outputs" (returns) of your $somefunction fit on a single line, you can add all the data to a variable and msg the value of the variable after the loop has finished.
And you don't need %a > %b, (as long as you don't modify %a and %b in the somefunction itself), because the while loop will end if %a is no longer less than %b.
Try:
Code:
var %output
while ((%a < %b) && ($somefunction)) {
  inc %a
  var %output = %output $v1
}
msg $chan %output

Joined: Jan 2007
Posts: 1,156
D
Hoopy frood
Offline
Hoopy frood
D
Joined: Jan 2007
Posts: 1,156
Use $addtok with $chr(32).

Joined: Jul 2007
Posts: 1,129
T
Hoopy frood
Offline
Hoopy frood
T
Joined: Jul 2007
Posts: 1,129
Based on DJ_Sol's suggestion, this may be it:

Code:
alias test {
  var %x = 1, %m = output of function
  while $gettok(%m,%x,32) { 
    inc %x
    .timer 1 $calc(%x * 2) msg # $v1
  }
}


Also it will put a delay every 2 seconds.

Joined: Jan 2007
Posts: 1,156
D
Hoopy frood
Offline
Hoopy frood
D
Joined: Jan 2007
Posts: 1,156
Well Horstl has a cool way of doing it.

This is the old way Id do it.

Code:
while ($somefunction) && (%a < %b) {
set %variable $addtok(%variable,output text,32)
inc %a
}
msg #channel %variable



btw, if ya really want help try and use actual code instead of "$somefunction" or "output text".

Makes it easier for scripters to see what you need.

Joined: Jul 2006
Posts: 4,149
W
Hoopy frood
Offline
Hoopy frood
W
Joined: Jul 2006
Posts: 4,149
There is a difference between your code and Horstl's one, your is using $addtok, so the same token won't be added to the variable two time, could not be the desired effect here.

Last edited by Wims; 18/11/08 10:20 AM.

#mircscripting @ irc.swiftirc.net == the best mIRC help channel
Joined: Sep 2007
Posts: 202
F
firefox Offline OP
Fjord artisan
OP Offline
Fjord artisan
F
Joined: Sep 2007
Posts: 202
well by some function i wanted to make it apply to more than one thing

i.e. it could be reading data from a text file or getting data from a hashtable or some other source using a dll

I tried Horstl's suggestion and it is working fine for what I want

Thanks everyone


Joined: Jan 2007
Posts: 1,156
D
Hoopy frood
Offline
Hoopy frood
D
Joined: Jan 2007
Posts: 1,156
Good point wims, which also stresses my point of giving us more information when asking for scripting help.


Link Copied to Clipboard