Format: /rps
Lets say that we have vars:
%server1 192.168.1.64:27015
%server2 192.168.1.64:27016
%server3 192.168.1.64:27017
and we type the command: /rps 2 server
we will have
%server1 192.168.1.64:27015
%server2 192.168.1.64:27017
It works with all variables,
%asd1 1
%asd2 2
%asd3 3
/rps 3 asd
%asd1 1
%asd2 2
/rps 1 asd
%asd1 2
%asd2 3
etc...
WARNING. If you have
%server1 asd1
%server2 asd2
%server3 asd3
%Server.1 dfa
%server.2 dfaf
%serverafaf 342d
Mirc will be crash...!!!
alias RPS {
var %i = $1
while (%i <= $var($+($chr(37),$2,*),0) ) {
if ($var($+($chr(37),$2,*),$calc( %i + 1 )) != $null) { set % [ $+ [ $2 ] ] [ $+ [ %i ] ] % [ $+ [ $2 ] ] [ $+ [ $calc( %i + 1 ) ] ] }
else { unset % [ $+ [ $2 ] ] [ $+ [ %i ] ] }
inc %i
}
}
i mean that the one variable take the others.. if you want, it is an extra snippet. there is not for everyone.. who ever wants... Lets Say tha you have 3 servers and you want to unset the 2 server, and you have a loop to read all the servers, you can use /rps 2 server so the server 3 will take the position of server 2 and server3 will be removed, and the loop will work fine:
Vars:
%server1 asd
%server2 asd2
%server3 asd3
```
var %i = 1
while (%i <= $var(%server*,0) ) {
echo -a %server [ $+ [ %i ] ] ;Returns Servers's values
inc %i
}
}
```
Now if you unset %server2
the loop will not echo %server3 ... because it has 2 servers so it will be read %server1 and %server2 , but %server2 does not exists so it will return only %server1
with this alias when you type:
/rps 2 server
will unset %server2 and %server3 took its place so the alias will be continued normaly
```
%server1 asd
%server2 asd3
```
so now the loop will return:
asd
asd3