mIRC Home    About    Download    Register    News    Help

Print Thread
Page 1 of 3 1 2 3
Joined: Dec 2002
Posts: 483
Deep3D Offline OP
Pan-dimensional mouse
OP Offline
Pan-dimensional mouse
Joined: Dec 2002
Posts: 483
Im allways connected to more than 1 network, this script it not that good if you connect to more than 1 network. Cause then you wold be away on one network, and not away on the other one since you would have more idle time on the none than on the other.

So, how to check idle on all connected networks, and if ALL is higher than the %away.system.auto.check then set away on all networks. If one network has under this limit, and all other over then unset away on all networks.

Code:
away.system.auto {
  echo Check
  if (!$away) && ($idle >= %away.system.auto.check) && %away.system.auto == on {
    away Auto away after $duration(%away.system.auto.check,2) of idle
    echo -a Set
  }
  if ($away) && ($idle <= %away.system.auto.check) && %away.system.auto == on {
    away
    echo -a Unset
  }
}

Joined: Jan 2007
Posts: 1,156
D
Hoopy frood
Offline
Hoopy frood
D
Joined: Jan 2007
Posts: 1,156
Code:
alias idle_chk {
var %idl_ = $scon(0)
while (%idl) {
echo -s . $scon(%idl_).network idle time is $scon(%idl_).idle
echo -s . You are $iif(!$scon(%idl_).away,not) away on $scon(%idl_).network .
dec %idl_
}
}


Here is an example checking your idle and away status on every network.

Joined: Dec 2002
Posts: 483
Deep3D Offline OP
Pan-dimensional mouse
OP Offline
Pan-dimensional mouse
Joined: Dec 2002
Posts: 483
Cheers!

Joined: Jan 2007
Posts: 1,156
D
Hoopy frood
Offline
Hoopy frood
D
Joined: Jan 2007
Posts: 1,156
Np. I forgot. In your while loop you can check each channel in that scon.
Code:
while ($scon(%idl_)) {

;make scon id active to check its channels
scon %idl_

;set vars for total channels
var %ch_ = $chan(0), %ch
while (%ch_) {
;set var to save channel name instead of using $chan(%ch_) every time.
%ch = $chan(%ch_)

echo -a . %ch idle: $chan(%ch_).idle
echo -a . %ch away: $chan(%ch_).away

dec %ch_
}


dec %idl_
}

Joined: Dec 2002
Posts: 483
Deep3D Offline OP
Pan-dimensional mouse
OP Offline
Pan-dimensional mouse
Joined: Dec 2002
Posts: 483
it all went into a spinning loop and crached my client.

Joined: Aug 2004
Posts: 7,252
R
Hoopy frood
Offline
Hoopy frood
R
Joined: Aug 2004
Posts: 7,252

Joined: Jan 2007
Posts: 1,156
D
Hoopy frood
Offline
Hoopy frood
D
Joined: Jan 2007
Posts: 1,156
It was an example. You would want to put it in the alias.

Code:
alias idle_chk {
var %idl_ = $scon(0)
while (%idl) {
echo -s . $scon(%idl_).network idle time is $scon(%idl_).idle
echo -s . You are $iif(!$scon(%idl_).away,not) away on $scon(%idl_).network .

;make scon id active to check its channels
scon %idl_

;set vars for total channels
var %ch_ = $chan(0), %ch
while (%ch_) {
;set var to save channel name instead of using $chan(%ch_) every time.
%ch = $chan(%ch_)

echo -a . %ch idle: $chan(%ch_).idle
echo -a . %ch away: $chan(%ch_).away

dec %ch_
}

dec %idl_
}
}

Joined: Jan 2007
Posts: 1,156
D
Hoopy frood
Offline
Hoopy frood
D
Joined: Jan 2007
Posts: 1,156
Code:
alias idle_chk {
var %idl_ = $scon(0)
while (%idl_) {
echo -s . $scon(%idl_).network idle time is $scon(%idl_).idle
echo -s . You are $iif(!$scon(%idl_).away,not) away on $scon(%idl_).network .

;make scon id active to check its channels
scon %idl_

;set vars for total channels
var %ch_ = $chan(0), %ch
while (%ch_) {
;set var to save channel name instead of using $chan(%ch_) every time.
%ch = $chan(%ch_)

echo -a . %ch idle: $chan(%ch_).idle
echo -a . %ch away: $chan(%ch_).away

dec %ch_
}

dec %idl_
}
}


It wouldn't let me edit this and I found I named the variable wrong in the while statement. When writign loops there is the chance that you mess up and it start an infinite loop. If this happens press ctrl + Pause/Break.

Joined: Dec 2002
Posts: 483
Deep3D Offline OP
Pan-dimensional mouse
OP Offline
Pan-dimensional mouse
Joined: Dec 2002
Posts: 483
How would you add scon into this? I've got confused of the other.

Code:
away.system.auto {
  if %away.system == off && %away.system.auto == on {
    echo Check
    if (!$away) && ($idle >= %away.system.auto.check) {
      away Auto away after $duration(%away.system.auto.check,2) of idle
      echo -a Set
    }
    if ($away) && ($idle <= %away.system.auto.check) {
      away
      echo -a Unset
    }
  }
}

Joined: Jul 2006
Posts: 4,186
W
Hoopy frood
Offline
Hoopy frood
W
Joined: Jul 2006
Posts: 4,186
just use /scon -at1 away.system.auto


#mircscripting @ irc.swiftirc.net == the best mIRC help channel
Joined: Dec 2002
Posts: 483
Deep3D Offline OP
Pan-dimensional mouse
OP Offline
Pan-dimensional mouse
Joined: Dec 2002
Posts: 483
But then the script dont work how I want it to work.

This set me away on the network Ive been idle on, and not away on the network im active on..

If im active on one network, I dont want to be set away on another network. I have to been idle on all networks before been set away.

If over 30 sec set idle set away.

Ex:
Network1 : Idle 100 sec
Network2 : Idle 2 sec
Network3 : Idle 200 sec

Then dont set away on any network...

but if Network2 is over 30 sec of idle then set away on all networks..

Joined: Jul 2006
Posts: 4,186
W
Hoopy frood
Offline
Hoopy frood
W
Joined: Jul 2006
Posts: 4,186
Code:
alias away_sys set -u %autoaw 1 | scon -at1 isautoaw | if (%autoaw) && (!away) scon -at1 away
alias isautoaw if ($idle < 60) set -k %isautoaw 0
This basically put you away on all network if each of your idle time are >= 60 secs, type /away_sys

Last edited by Wims; 04/04/10 02:50 AM.

#mircscripting @ irc.swiftirc.net == the best mIRC help channel
Joined: Dec 2002
Posts: 483
Deep3D Offline OP
Pan-dimensional mouse
OP Offline
Pan-dimensional mouse
Joined: Dec 2002
Posts: 483
Still if one of the network is under 60 sec it sets the other networks away.

It one network is idle under 60 sec then unset away on all networks.

If all networks is over 60 sec of idlem then set away on all networks.

There is no point of being active on one network, and away on another one.

I really appreciate your help.

Joined: Jul 2006
Posts: 4,186
W
Hoopy frood
Offline
Hoopy frood
W
Joined: Jul 2006
Posts: 4,186
Code:
alias away_sys set -u %autoaw 1 | set -u %aw | scon -at1 aw |  if (%autoaw) && (!%aw) scon -at1 away param
alias aw if ($idle < 60) set -k %autoaw 0 | if ($away) set -k %aw 1
This one is tested smile


#mircscripting @ irc.swiftirc.net == the best mIRC help channel
Joined: Dec 2002
Posts: 483
Deep3D Offline OP
Pan-dimensional mouse
OP Offline
Pan-dimensional mouse
Joined: Dec 2002
Posts: 483
sweet! Works.

Now, when one network is under 60 seconds, unset away on all networks.

Joined: Jul 2006
Posts: 4,186
W
Hoopy frood
Offline
Hoopy frood
W
Joined: Jul 2006
Posts: 4,186
Code:
alias away_sys set -u %autoaw 1 | set -u %aw | set -u %naw | scon -at1 aw |  if (%autoaw) && (!%aw) scon -at1 away param | elseif (!%aw) scon -at1 away
alias aw if ($idle < 60) set -k %autoaw 0 | if ($away) set -k %aw 1 | else set -k %naw 1
Not tested but should do it.


#mircscripting @ irc.swiftirc.net == the best mIRC help channel
Joined: Dec 2002
Posts: 483
Deep3D Offline OP
Pan-dimensional mouse
OP Offline
Pan-dimensional mouse
Joined: Dec 2002
Posts: 483
Sorry, it dont work. The script sets away, but don't turn off if not idle.

Joined: Jul 2006
Posts: 4,186
W
Hoopy frood
Offline
Hoopy frood
W
Joined: Jul 2006
Posts: 4,186
a typo sorry :

Code:
alias away_sys set -u %autoaw 1 | set -u %aw | set -u %naw | scon -at1 aw |  if (%autoaw) && (!%aw) scon -at1 away param | elseif (%naw) scon -at1 away
alias aw if ($idle < 60) set -k %autoaw 0 | if ($away) set -k %aw 1 | else set -k %naw 1


#mircscripting @ irc.swiftirc.net == the best mIRC help channel
Joined: Dec 2002
Posts: 483
Deep3D Offline OP
Pan-dimensional mouse
OP Offline
Pan-dimensional mouse
Joined: Dec 2002
Posts: 483
Still don't work.

Code:
alias away_sys set -u %autoaw 1 | set -u %aw | set -u %naw | scon -at1 aw | if (%autoaw) && (!%aw) scon -at1 away.system.auto | elseif (%naw) scon -at1 away.system.auto
alias aw if ($idle < %away.system.auto.check) set -k %autoaw 0 | if ($away) set -k %aw 1 | else set -k %naw 1


Code:
away.system.auto {
  if %away.system == off && %away.system.auto == on {
    echo Check
    if (!$away) && ($idle >= %away.system.auto.check) {
      away Auto away after $duration(%away.system.auto.check,2) of idle
      echo -a Set $server
    }
    if ($away) && ($idle <= %away.system.auto.check) {
      away
      echo -a Unset $server
    }
  }
}

Joined: Jul 2006
Posts: 4,186
W
Hoopy frood
Offline
Hoopy frood
W
Joined: Jul 2006
Posts: 4,186
Why are you using the second alias ? You don't need it :

Code:
alias away_sys set -u %autoaw 1 | set -u %aw | set -u %naw | scon -at1 aw | if (%autoaw) && (!%aw) scon -at1 away Auto away after $duration(%away.system.auto.check,2) of idle | elseif (%naw) && (%aw) scon -at1 away
alias aw if ($idle < %away.system.auto.check) set -k %autoaw 0 | if ($away) set -k %aw 1 | else set -k %naw 1
This is tested


#mircscripting @ irc.swiftirc.net == the best mIRC help channel
Page 1 of 3 1 2 3

Link Copied to Clipboard