mIRC Home    About    Download    Register    News    Help

Print Thread
set many variables #72641 24/02/04 11:42 AM
Joined: Feb 2004
Posts: 14
H
hatten Offline OP
Pikka bird
OP Offline
Pikka bird
H
Joined: Feb 2004
Posts: 14
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 ?

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


New username: hixxy
Re: set many variables #72643 24/02/04 12:55 PM
Joined: Sep 2003
Posts: 4,230
D
DaveC Offline
Hoopy frood
Offline
Hoopy frood
D
Joined: Sep 2003
Posts: 4,230
you should have started at 9 and added one, then u could just test while %i

Re: set many variables #72644 24/02/04 01:14 PM
Joined: Dec 2003
Posts: 33
M
Man Offline
Ameglian cow
Offline
Ameglian cow
M
Joined: Dec 2003
Posts: 33
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?

Re: set many variables #72645 24/02/04 01:15 PM
Joined: Feb 2004
Posts: 14
H
hatten Offline OP
Pikka bird
OP Offline
Pikka bird
H
Joined: Feb 2004
Posts: 14
not sure if i get that (dave c) smile

Last edited by hatten; 24/02/04 01:17 PM.
Re: set many variables #72646 24/02/04 09:11 PM
Joined: Aug 2003
Posts: 1,831
I
Iori Offline
Hoopy frood
Offline
Hoopy frood
I
Joined: Aug 2003
Posts: 1,831
Code:
alias set.vars {
  var %i = 9
  while %i {
    set %variable $+ $calc(%i +1)  $($+(%,variable,%i),2)
    dec %i
  }
}

Re: set many variables #72647 24/02/04 10:23 PM
Joined: Sep 2003
Posts: 4,230
D
DaveC Offline
Hoopy frood
Offline
Hoopy frood
D
Joined: Sep 2003
Posts: 4,230
hidden windows wont last through a mirc shutdown/crash varaibles well

Re: set many variables #72648 25/02/04 07:02 AM
Joined: Dec 2003
Posts: 33
M
Man Offline
Ameglian cow
Offline
Ameglian cow
M
Joined: Dec 2003
Posts: 33
But for most ques that doesnt matter. Thats why I asked what the variables were being used for.