mIRC Home    About    Download    Register    News    Help

Print Thread
#72641 24/02/04 11:42 AM
H
hatten
hatten
H
ok i have asked quite a few question the last few days smile but hopefully someone else also can make use of the top notch replies ive been getting. i have a part in a script which looks like this ;

set %variable10 %variable9
set %variable9 %variable8
set %variable8 %variable7
set %variable7 %variable6
set %variable6 %variable5
set %variable5 %variable4
set %variable4 %variable3
set %variable3 %variable2
set %variable2 %variable1

i wonder if this is the most efficient and fastest way to set these 10 variables ?

#72642 24/02/04 11:49 AM
Joined: Nov 2003
Posts: 2,321
T
Hoopy frood
Offline
Hoopy frood
T
Joined: Nov 2003
Posts: 2,321
alias setvars {
var %i 10
while $calc(%i - 1) {
set %variable [ $+ [ %i ] ] %variable [ $+ [ $calc(%i -1) ] ]
dec %i
}
}

#72643 24/02/04 12:55 PM
D
DaveC
DaveC
D
you should have started at 9 and added one, then u could just test while %i

#72644 24/02/04 01:14 PM
M
Man
Man
M
What are you trying to do, I have a small idea of why you might be setting all those variables (you have some que or something). If this is the case a hidden list window will do the job alot better, and if you need to its easy to visualise the que.

If not, why else are you setting all these variables like this?

#72645 24/02/04 01:15 PM
H
hatten
hatten
H
not sure if i get that (dave c) smile

Last edited by hatten; 24/02/04 01:17 PM.
#72646 24/02/04 09:11 PM
I
Iori
Iori
I
Code:
alias set.vars {
  var %i = 9
  while %i {
    set %variable $+ $calc(%i +1)  $($+(%,variable,%i),2)
    dec %i
  }
}

#72647 24/02/04 10:23 PM
D
DaveC
DaveC
D
hidden windows wont last through a mirc shutdown/crash varaibles well

#72648 25/02/04 07:02 AM
M
Man
Man
M
But for most ques that doesnt matter. Thats why I asked what the variables were being used for.


Link Copied to Clipboard