Away System with Dialog

By Bouncer on Jun 04, 2007

Right click in your nicklist and choose Away System. Set your away message, and your original/away nicknames. Choose from the Idle Away, Advertise, and Return on Text options, and click Leave. Fairly simple. Tested and found no errors. Hope you all enjoy it.

Also thanks to xDaeMoN and RusselB for pointing me in the right direction.

menu nicklist { 
  Away System:awaysystem 
} 
alias awaysystem { 
  dialog -mdo awaysystem awaysystem 
} 
dialog awaysystem { 
  title "Away System" 
  size -1 -1 150 150 
  option dbu 

  button "Set Away Message", 1, 4 17 71 10 
  button "Clear Away Message", 2, 75 17 71 10 
  button "Set Original Nickname", 3, 4 47 70 10 
  button "Set Away Nickname", 4, 76 47 70 10 
  button "Leave", 5, 96 112 50 35 
  button "Return", 6, 96 112 50 35 

  radio "20 Minutes", 7, 25 75 34 10, group 
  radio "30 Minutes", 8, 25 85 34 10 
  radio "60 Minutes", 9, 25 95 34 10 
  radio "20 Minutes", 10, 97 75 34 10, group 
  radio "30 Minutes", 11, 97 85 34 10 
  radio "60 Minutes", 12, 97 95 34 10 

  check "Idle Away", 13, 10 65 32 10 
  check "Advertise", 14, 82 65 31 10 
  check "Return on Text", 15, 10 122 45 10 

  edit "", 16, 4 6 142 10, autohs 
  edit "", 17, 4 36 70 10, autohs 
  edit "", 18, 76 36 70 10, autohs 
} 
on *:dialog:awaysystem:*:*: { 
  if ( $devent == init ) { 
    did -hb $dname 6 
    did -a awaysystem 16 %away.reason 
    did -a awaysystem 17 %original.nick 
    did -a awaysystem 18 %away.nick 
    did -c $dname %idle.away.ID 
    did -c $dname %advertise.ID 
    if %idle.away == on { did -c awaysystem 13 } 
    if %advertise == on { did -c awaysystem 14 } 
    if %text.return == on { did -c awaysystem 15 } 
  } 
  elseif ( $devent == sclick ) { 
    if ( $did == 1 ) { 
      set %away.reason $didtok(16).text 
    } 
    elseif ( $did == 2 ) {
      unset %away.reason
      did -r awaysystem 16 
    } 
    elseif ( $did == 3 ) { 
      set %original.nick $didtok(17).text 
    } 
    elseif ( $did == 4 ) { 
      set %away.nick $didtok(18).text 
    } 
    elseif ( $did == 5 ) { 
      gone
      did -ve $dname 6 
      did -hb $dname 5 
    } 
    elseif ( $did == 6 ) { 
      back 
      did -ve $dname 5 
      did -hb $dname 6 
    } 
    elseif ( $did == 7 ) { 
      set %idle.away.ID 7 
      set %idle.time 1200 
    } 
    elseif ( $did == 8 ) { 
      set %idle.away.ID 8 
      set %idle.time 1800 
    } 
    elseif ( $did == 9 ) { 
      set %idle.away.ID 9 
      set %idle.time 3600 
    } 
    elseif ( $did == 10 ) { 
      set %advertise.ID 10 
      set %advertise.time 1200 
    } 
    elseif ( $did == 11 ) { 
      set %advertise.ID 11 
      set %advertise.time 1800 
    } 
    elseif ( $did == 12 ) { 
      set %advertise.ID 12 
      set %advertise.time 3600 
    } 
    elseif ( $did == 13 ) { 
      if $did(awaysystem,13).state == 1 { 
        set %idle.away on 
        .timeridle 0 %idle.time idling 
      } 
      elseif $did(awaysystem,13).state == 0 { 
        set %idle.away off 
        unset %idle.time 
        did -u $dname 7-9 
      } 
    } 
    elseif ( $did == 14 ) { 
      if $did(awaysystem,14).state == 1 { 
        set %advertise on 
      } 
      elseif $did(awaysystem,14).state == 0 { 
        set %advertise off 
        unset %advertise.time 
        did -u $dname 10-12 
      } 
    } 
    elseif ( $did == 15 ) { 
      if $did(awaysystem,15).state == 1 { 
        set %text.return on 
      } 
      elseif $did(awaysystem,15).state == 0 { 
        set %text.return off 
      } 
    } 
  } 
} 

alias gone { 
  set %gone yes 
  set %time.left $time(hh:nntt) 
  amsg 14,1[0,1 I am now 3,1Away 14,1][0,1 Reason:3,1 %away.reason 14,1]
  away %away.reason
  .timer 1 2 nick %away.nick 
  if (%advertise == on) { .timeradvertise 0 %advertise.time amsg 14,1[0,1 I am still 3,1Away 14,1][0,1 Reason:3,1 %away.reason 14,1] } 
  if (%idle.away == on) { .timeridle off } 
} 

alias back { 
  unset %gone 
  amsg 14,1[0,1 I am now 3,1Back 0,1from:3,1 %away.reason 14,1][0,1 I left at:3,1 %time.left 14,1]
  away
  .timer 1 2 nick %original.nick 
  if (%advertise == on) { .timeradvertise off }
  if (%idle.away == on) { .timeridle 0 %idle.time idling } 
} 

alias idling { 
  set %gone yes 
  set %away.reason Auto away on Idle
  set %time.left $time(hh:nntt)
  amsg 14,1[0,1 I am now 3,1Away 14,1][0,1 Reason:3,1 Auto away on Idle 14,1]
  away Auto away on Idle
  .timer 1 2 nick %away.nick 
  if (%advertise == on) { .timeradvertise 0 %advertise.time amsg 14,1[0,1 I am still 3,1Away 14,1][0,1 Reason:3,1 Auto away on Idle 14,1] } 
  if (%idle.away == on) { .timeridle off } 
} 

on *:INPUT:#: { 
  if (%idle.away == on) { .timeridle 0 %idle.time idling } 
  if (%text.return == on) && (%gone == yes) { back } 
}

Comments

Sign in to comment.
Bouncer   -  Jul 01, 2007

You place it all into your remotes. And thank you Lindrian for explaining that. :)

 Respond  
stargazer989   -  Jul 01, 2007

Where exactly do i place this? is it my remotes or my alias?

-stargazer989

 Respond  
Lindrian   -  Jun 11, 2007

Let me explain $iif for you,

We have variable %var

But we are not sure if its set or not, and wants to run a check.

in a $iif statement, it would look like:
$iif(%var,do this, else this)

To put it out in normal if\'s;

if %var { do this }
else { do this }

 Respond  
Bouncer   -  Jun 10, 2007

13 and 14 are already shown using if %idle.away == on { did -c awaysystem 13 } and if %advertise == on { did -c awaysystem 14 }

Those show if the cheboxes for Idle Away and Advertise are checked or not.

The did -c $dname %idle.away.ID and did -c $dname %advertise.ID are there to show which corresponding radio is selected.

 Respond  
Scakk   -  Jun 10, 2007

Using the below it works for me with no errors at all.

did -c $dname 13
did -c $dname 14

 Respond  
Bouncer   -  Jun 10, 2007

I cannot use a specific number or it will not work correctly. There is a reason for the %idle.away.ID and the %advertise.ID

 Respond  
Scakk   -  Jun 10, 2007

Change them to the below instead.

did -c $dname 13
did -c $dname 14 
 Respond  
Scakk   -  Jun 10, 2007

One these two lines

did -c $dname %idle.away.ID 
did -c $dname %advertise.ID 

Change them to

did -c $dname %idle.away 
did -c $dname %advertise

I did that and no longer got the errors.

 Respond  
Bouncer   -  Jun 10, 2007

I know, but once both options are selected, and a time limit for each, then you will not get that error. As of now I do not know how to correct the current one you have pointed out, but I will work on it.

 Respond  
Scakk   -  Jun 10, 2007

Bouncer: I think you misunderstood me. The errors occur as soon as I click the PopUp choice that opens the dialog. I do not click anything inside the dialog. The order of events are as shown below.

Click NickList PopUp --> Erros show in Status Window --> Dialog opens

 Respond  
Bouncer   -  Jun 10, 2007

Also to Scakk if you have neither option selected, then yes you might recieve that error. It does not stop the away system from working though.

 Respond  
Bouncer   -  Jun 10, 2007

Scakk you are getting those errors because you must select one of the three minute options beneath Idle Away, and the Advertise checkboxes. That is the whole reason they are there. As to Lindrian, I have no idea what you are getting at with those suggestions. I haven\'t used $iif yet, or anything like $v1. I tend to avoid using variables, because I have not learned how to accurately use them.

 Respond  
Lindrian   -  Jun 10, 2007

I suggest using $iif.

on the load,

$iif(!$dialog(dname),Away sys,$style(2) Away sys): dialog -m dname dname

and

$iif(%variable,$v1,something else)

 Respond  
Scakk   -  Jun 10, 2007

I tried it out and got two errors msg\'s

These happen when I open the dialog from the nicklist menu.

  • /did: insufficient parameters (line 40, remote.ini)
  • /did: insufficient parameters (line 41, remote.ini)

The lines in question are

did -c $dname %idle.away.ID
did -c $dname %advertise.ID 
 Respond  
Bouncer   -  Jun 09, 2007

Three scores with no comments/suggestions/criticism. Any type of feedback would be welcome. Any ideas what I should chage and/or add? Three people scoring it with no comments left, makes me think they found nothing wrong. If that is the case, then why the low scores. Lol.

 Respond  
Are you sure you want to unfollow this person?
Are you sure you want to delete this?
Click "Unsubscribe" to stop receiving notices pertaining to this post.
Click "Subscribe" to resume notices pertaining to this post.