mIRC Home    About    Download    Register    News    Help

Print Thread
message all results to one line #206569 17/11/08 09:13 PM
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

Re: message all results to one line [Re: firefox] #206571 17/11/08 09:31 PM
Joined: Sep 2008
Posts: 62
_
_Memo Offline
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.



Re: message all results to one line [Re: firefox] #206572 17/11/08 09:35 PM
Joined: Nov 2006
Posts: 1,559
H
Horstl Offline
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

Re: message all results to one line [Re: firefox] #206579 18/11/08 12:35 AM
Joined: Jan 2007
Posts: 1,156
D
DJ_Sol Offline
Hoopy frood
Offline
Hoopy frood
D
Joined: Jan 2007
Posts: 1,156
Use $addtok with $chr(32).

Re: message all results to one line [Re: firefox] #206587 18/11/08 02:22 AM
Joined: Jul 2007
Posts: 1,129
T
Tomao Offline
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.

Re: message all results to one line [Re: Tomao] #206594 18/11/08 06:45 AM
Joined: Jan 2007
Posts: 1,156
D
DJ_Sol Offline
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.

Re: message all results to one line [Re: DJ_Sol] #206602 18/11/08 10:20 AM
Joined: Jul 2006
Posts: 3,568
W
Wims Offline
Hoopy frood
Offline
Hoopy frood
W
Joined: Jul 2006
Posts: 3,568
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.

Looking for a good help channel about mIRC? Check #mircscripting @ irc.swiftirc.net
Re: message all results to one line [Re: Wims] #206616 18/11/08 08:21 PM
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


Re: message all results to one line [Re: Wims] #206628 19/11/08 12:54 AM
Joined: Jan 2007
Posts: 1,156
D
DJ_Sol Offline
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.