mIRC Home    About    Download    Register    News    Help

Print Thread
#20379 22/04/03 04:53 AM
Joined: Dec 2002
Posts: 1,237
T
Hoopy frood
OP Offline
Hoopy frood
T
Joined: Dec 2002
Posts: 1,237
A while back, someone had helped me with a simple away script. Here's the trouble I keep running into:

*When I set myself away, about every half hour a simple message displays in the channel. When I set myself back the timer doesn't shut off for some reason and I get this message as well

Quote:

* The_Game is now known as The_Game[afk]
* The_Game[afk] is now known as The_Game
* The_Game is now known as The_Game


I waited about 30 seconds before setting myself back from away.

Although for some reason, Something doesn't look quite right about this code, either that or i'm just blind. I will post it so someone can take a look at it and see if theres anything wrong with it. It does basically do what I initially wanted it to. If you feel the need to change something around feel free to do so. I am just wanting to know if this is ok or not. Here it is:

Code:
menu * {
  -
  Away System
  .$iif($away == $true,Off,On):{
    if ($away == $true) {
      .away | .nick The_Game | .timerAway off | .ame has returned! | .disable #AwayNotices
      if ($line(@AwayNotices,0) == 2) { echo $color(notify) -at You have no messages waiting }
      if ($line(@AwayNotices,0) >= 2) { echo $color(notify) -at You have $calc($line(@AwayNotices,0) - 2) message(s) waiting }
    }
    if ($away == $false) {
      .away stepped away from keyboard! | .nick The_Game[afk]
      .timerAway 0 1800 ame is away from the keyboard! If you must speak with me leave me a notice and I will get back to you!
      .window -kn @AwayNotices | .enable #AwayNotices
    }
  }
}
#AwayNotices on
on *:NOTICE:*:*:{
  if ($window(@AwayNotices) == $null) { .window -kn @AwayNotices }
  .aline -p @AwayNotices $timestamp << $nick >> $1-
  .notice $nick Thanks for your message, I will respond on my return
}
on *:TEXT:*:?:{
  .msg $nick I am AFK. Please use /notice $me <message> if it is urgent and I will respond on my return
  if ($line($nick,0) == 1) { /close -m $nick }
}
#AwayNotices End


Thanks in advance...

#20380 22/04/03 05:07 AM
Joined: Dec 2002
Posts: 699
N
Fjord artisan
Offline
Fjord artisan
N
Joined: Dec 2002
Posts: 699
When you are away, "if ($away == $true) {" triggers, sets you back, then the next line is also $true, because you are now NOT away.
Code:
    [color:red]else[/color]if ($away == $false) {

#20381 22/04/03 05:10 AM
Joined: Dec 2002
Posts: 1,527
_
Hoopy frood
Offline
Hoopy frood
_
Joined: Dec 2002
Posts: 1,527
thats also not the only code change hed have to make .....


D3m0nnet.com
#20382 22/04/03 10:55 PM
Joined: Dec 2002
Posts: 1,237
T
Hoopy frood
OP Offline
Hoopy frood
T
Joined: Dec 2002
Posts: 1,237
Could you point out what changes? Thanks.

#20383 22/04/03 10:58 PM
Joined: Dec 2002
Posts: 1,527
_
Hoopy frood
Offline
Hoopy frood
_
Joined: Dec 2002
Posts: 1,527
well id set a variable upon going away ..... then run for that in ur If statement like if $away == $true && %varname == away { setself back }

something along those lines would be what i would do along with unsetting that variable when u come back ...... but thats probably just one solution im sure there are several others


D3m0nnet.com
#20384 22/04/03 11:22 PM
Joined: Dec 2002
Posts: 699
N
Fjord artisan
Offline
Fjord artisan
N
Joined: Dec 2002
Posts: 699
You only need to change the one line, did you try it?
Code:
change
 
    if ($away == $false) {
 
to
 
    elseif ($away == $false) {
 
or (better)
 
    else {

#20385 22/04/03 11:27 PM
Joined: Dec 2002
Posts: 1,237
T
Hoopy frood
OP Offline
Hoopy frood
T
Joined: Dec 2002
Posts: 1,237
Thanks I will see what I can do with it...I knew I was right about something not looking right...


Link Copied to Clipboard