Chat Assistant

By Callison1 on Jul 02, 2007

~Chat Assistant v1.3~

This dialog is for sending and recieving messages to and from nicks.

The option is in Channel Popup and Nicklist Popup

It tells you which message is from which nick and which messages you sent to which nicks...if that makes sense.

It also has a listbox friends list with add and remove friends functions. If you click a friend's name it will appear in the "Nick editbox.

You can type a message and click "Send" and it will be sent to the nick in "Nick".

If the "Nick" editbox is empty when you recieve a message, that nick will appear in the editbox.

Auto Chat Assistant: When Switched on, this function will automatically open the Dialog when you get a PM.

Background Chat Assistant: When switched on this will block your PM's, send an optional specified Auto-Reply and log the messages you get with the Sender and Time whenever you don't have the dialog open, if you have unread logged messages, you can click a button and have them appear in the Messages box, the log file will then clear itself.

Partial credit to Bouncer, who provided part of the dialog while asking for help in the forum, so Thankyou Bouncer.

Please leave any thoughts or feedback you have. Thanks

;Thanks to Bouncer for Dialog help and part of this script

menu channel,nicklist {
  Chat Assistant
  .Open: message
  .Auto Chat Assistant
  ..$iif(%autochatassistant == on,Off,On): set %autochatassistant $iif(%autochatassistant == on,off,on) | noop $input(Auto Chat Assistant is $iif(%autochatassistant == on,now on,now off),o,Auto Chat Assistant)
  .Background Chat Assistant
  ..$iif(%backgroundchatassistant == on,Off,On): set %backgroundchatassistant $iif(%backgroundchatassistant == on,off,on) | if (( %backgroundchatassistant == on )) $dialog(bgroundmessage,bgroundmessage) | noop $input(Background Chat Assistant is $iif(%backgroundchatassistant == on,now on,now off),o,Auto Chat Assistant) 
}
alias message {
  dialog $iif($dialog(message),-v,-mdo) message message
}

dialog message {
  title "Chat Assistant v1.3"
  size -1 -1 250 173
  option dbu

  text "Enter Nickname", 1, 4 4 37 7, disable
  text "Enter Message", 2, 4 27 36 7, disable
  text "Messages", 3, 4 67 30 7, disable
  text "Add Friend", 9, 135 4 30 7, disable
  text "Remove Friend",13, 135 25 40 7, disable
  text "Friends List", 16, 135 47 40 10, disable

  edit "", 4, 4 12 117 10, autohs
  edit "", 5, 4 35 117 10, autohs
  edit "", 10, 135 12 82 10
  edit "", 14, 135 35 82 10
  list 12, 135 55 110 100, vsbar

  button "Send", 6, 4 52 58 10,
  button "Cancel", 7, 63 52 58 10, cancel
  button "Add", 11, 220 10 25 12
  button "Remove", 15, 220 33 25 12
  button "View Recorded Messages" 17, 15 155 90 10
  link "www.hawkee.com" 18, 140 157 90 10

  edit "" 8, 4 75 117 74, multi, vsbar, read
}
on *:dialog:message:*:*: {
  if (( $devent == sclick )) {
    if (( $did == 15 )) {
      if ( $did(message,14) == $null ) { halt }
      write -ds $+ $did(14) friends.txt
      var %l = 1
      did -r message 12
      while (( %l <= $lines(friends.txt) )) {
        if (( $read(friends.txt,%l) == $null )) goto increment
        did -a message 12 $iif($did(message,12) != $null,$crlf) $+ $read(friends.txt,%l)
        :increment
        inc %l
      }
      .did -r $dname 14
      did -b message 15
    }
    if (( $did == 11 )) {
      if ( $did(message,10) == $null ) { goto disable }
      if (( $read(friends.txt,w,$did(10)) == $null )) {
        write -a friends.txt $chr(32) $+ $iif($did(message,12) != $null,$($crlf,0)) $did(10)
        var %friendslist.line = $lines(friends.txt)
        did -a message 12 $iif($did(message,12) != $null,$crlf) $+ $read(friends.txt,%friendslist.line)
        :disable
        .did -r $dname 10
        did -b message 11
      }
      else { .did -r $dname 10 | did -b message 11 }
    }
    if (( $did == 6 )) {
      .msg $did(4) $did(5)
      did -a message 8 $iif($did(message,8) != $null,$crlf) $+ <To $did(4) $+ > $did(5)
      did -r message 5
      did -b message 6
    }
    if (( $did == 12 )) {
      did -o message 4 1 $did(12).seltext
      if (( $did(5) != $null )) did -e message 6 
    }
    if (( $did == 17 )) {
      var %b = 1
      while (( %b <= $lines(backgroundautomessage.txt) )) {
        if (( $read(backgroundautomessage.txt,%b) != $null )) {
          did -a message 8 $iif($did(message,8) != $null,$crlf) $+ $read(backgroundautomessage.txt,%b)
        }
        inc %b
      }
      write -c backgroundautomessage.txt
      did -b message 17
    }
    if (( $did == 18 )) run http://www.hawkee.com
  }
  if (( $devent == init )) {
    var %l = 1
    while (( %l <= $lines(friends.txt) )) {
      if (( $read(friends.txt,%l) == $null )) goto increment2
      did -a message 12 $iif($did(message,12) != $null,$crlf) $+ $read(friends.txt,%l)
      :increment2
      inc %l
    }
    did -b message 6
    did -b message 11
    did -b message 15
    var %b = 1
    while (( %b <= $lines(backgroundautomessage.txt) )) {
      if (( $read(backgroundautomessage.txt,%b) != $null )) goto logged
      inc %b
    }
    did -b message 17
    :logged
  }
  if (( $devent == edit )) {
    if (( $did = 4 )) || (( $did = 5 )) {
      did $iif($did(4) && $did(5),-e,-b) $dname 6
      if (( $left($did(4),1) == $(#,0) )) did -b message 6
    }
    if (( $did == 10 )) {
      did $iif($did($did),-e,-b) $dname 11
    }
    if (( $did == 14 )) {
      did $iif($did($did),-e,-b) $dname 15
    }
  }
}
on *:TEXT:*:?: {
  if (( %backgroundchatassistant == on )) && (( !$dialog(message) )) && (( %autochatassistant != on )) { write backgroundautomessage.txt < $+ From $nick at $time $+ > $1- | close -m $nick | if (( %bgmmessage != $null )) { .msg $nick %bgmmessage } }
  if (( $dialog(message) )) { goto messaging }
  elseif (( %autochatassistant != on )) { halt }
  else { dialog -mdo message message }
  :messaging
  did -a message 8 $iif($did(message,8) != $null,$crlf) $+ <From $nick $+ > $1-
  close -m $nick
  if (( $did(message,4) == $null )) { did -a message 4 $nick | if (( $did(message,5) != $null )) did -e message 6 }
  halt
}
dialog bgroundmessage {
  title "Auto-Reply"
  size -1 -1 250 130
  radio "Message", 1, 10 20 60 20,
  edit "Do Not Disturb", 2, 10 60 160 20, autohs
  radio "No Message", 3, 10 90 85 20
  button "Submit", 4, 187 60 45 20, ok
  text "Enter the Automatic reply message", 5, 12 43 160 13, disable
  text "Would you Like to Auto-Reply to Messages?", 6, 12 4 300 13
}
on *:DIALOG:bgroundmessage:*:*: {
  if (( $devent == init )) {
    did -c $dname 1
  }
  if (( $devent == sclick )) {
    if (( $did == 3 )) || (( $did == 1 )) {
      did $iif($did == 3,-b,-e) $dname 2
    }
    if (( $did == 4 )) {
      if (( $did(1).state == 1 )) set %bgmmessage $did(2)
      if (( $did(3).state == 1 )) unset %bgmmessage
    }
  }
}

Comments

Sign in to comment.
Callison1   -  Jul 27, 2007

I\'m fine, I really would recommend you buy a mouse.

 Respond  
Callison1   -  Jul 27, 2007

I really only made this to help me learn about dialogs. Thanks for the comments.

 Respond  
[M]ike   -  Jul 27, 2007

It\'s alright but /msg and /notice work fine for me.

 Respond  
Callison1   -  Jul 25, 2007

Small ammendment, the Chat Box now uses the \'read\' function, so it is grey with black text and can\'t be edited.

 Respond  
Callison1   -  Jul 04, 2007

Updated again, now with Logging system that blocks and records PM\'s and optionally sends a specified Auto-Reply to the sender, when you open the dialog you can click a button and any recorded messages will appear in the box, oh yea and a link to hawkee :p

 Respond  
Lindrian   -  Jul 03, 2007

Once again, your welcome :)

 Respond  
Callison1   -  Jul 03, 2007

Thanks Lindrian, Updated, I also changed where I had put -m instead of -mdo

 Respond  
Lindrian   -  Jul 03, 2007
menu channel,nicklist {
  Chat Assistant
  .Open:message
  .Auto Chat Assistant
  ..On: noop $input(Auto Chat Assistant is $iif(%autochatassistant == on,already on,now on),o,Auto Chat Assistant) | set %autochatassistant on
  ..Off: noop $input(Auto Chat Assistant is $iif(%autochatassistant == on,now off,already off),o,Auto Chat Assistant) | unset %autochatassistant 
}

Long and usless code, imo. Use:

menu channel,nicklist {
  Chat Assistant
  .Open: message
  .Auto Chat Assistant
  ..$iif(%autochatassistant == on,Off,On): set %autochatassistant $iif(%autochatassistant == on,off,on) | noop $input(Auto Chat Assistant is $iif(%autochatassistant == on,now on,now off),o,Auto Chat Assistant)
}

No offense though ;P

 Respond  
Bouncer   -  Jul 03, 2007

Nice idea. :)

 Respond  
Callison1   -  Jul 03, 2007

Thanks bouncer.

I added an option the the Channel Popup Menu to turn Auto Chat Assistant on and off, when switched on, when you get a PM it opens the dialog box. When switched off, you recieve the pm in a query window like normal.

 Respond  
Bouncer   -  Jul 03, 2007

A feature I have in mine that you may want to add, is to have it open the dialog when someone PM\'s you. Otherwise if someone PM\'s you it opens the PM window. Just an idea :)

 Respond  
Lindrian   -  Jul 03, 2007

your welcome :)

 Respond  
Bouncer   -  Jul 03, 2007

Your welcome Callison1 and the coding looks better now. I will let you knwo if I can think of any other things to help. I should be done with my PM Dialog soon. Unsure if I will paste it here yet or not, but maybe we could compare notes on it. You have some good ideas. 5/10

 Respond  
Callison1   -  Jul 03, 2007

Updated the code, it still functions exactly the same but I put all the dialog events into 1 event, and used the $iif for the check if the dialog is already open and to enable/disable controls. I plan to add extra things soon =)

Thanks for the advice guys.

 Respond  
Lindrian   -  Jul 02, 2007

Its alright hehe, a little further explenation isnt bad either ;)

 Respond  
Bouncer   -  Jul 02, 2007

Ahh sorry. I thought I only read an example for sclick, so I thought I would explain further. But now I see you did explain it for all events. My bad. :)

 Respond  
Lindrian   -  Jul 02, 2007

yes, if youd read my post(s), ive alredy mentioned that :P

 Respond  
Bouncer   -  Jul 02, 2007

Instead of on :dialog:message:sclick:: and the same for edit and init, use
on :dialog:message::*: {
if ( $devent == init ) {
commands
}
elseif ( $devent == sclick ) {
if ( $did == ) {
commands
}
elseif ( $did == ) {
commands
}
}
elseif ( $devent == edit ) {
if ( $did == ) {
commands
}
}
}

Also you can use $devent for a menu to: if ( $devent == menu ) {

 Respond  
Lindrian   -  Jul 02, 2007

Also use for the -b/-e switches:

did $iif($did(ID),-e,-b) $dname id

Sorry for the doubble post.

Otherwhize I suppose this script is good and easy to use for newbies :)

4/10

 Respond  
Lindrian   -  Jul 02, 2007

menu channel,nicklist {
Chat Assistant:message
}

alias message {
if (( %dialog.message == on )) halt
dialog -mdo message message | set %dialog.message on
}

use:

dialog $iif($dialog($dname),-v,-mdo) dname dname

 Respond  
Callison1   -  Jul 02, 2007

If you think there is anything else I could improve don\'t hesitate to post it, i\'ll get right on it tomorrow when i\'m back on, cya.

 Respond  
Callison1   -  Jul 02, 2007

I think I covered everything you said, as far as my testing showed, no buttons are enabled unless all editboxes involved in the command are filled, all text is whiped after it\'s corresponding button is clicked no matter what the outcome, and now no name that already exists in the file is added to the file or the listbox, i combinded all the sclick events into one on dialog and the option to open the dialog won\'t function if the dialog is already open. I have not come across any error messages.

 Respond  
Lindrian   -  Jul 02, 2007

Well, I added it. I didnt quite get its purpose, but, i sent a message, it popped up in the messages box. Seems fine. Then I tried adding a freind. Added him, he popped up in the list, but the edit box where ive typed his name in, was not wiped (use .did -r $dname id).
Then when I tried removing him it resulted in:

  • /write: insufficient parameters (line 64, script.ini)

(I had not typed anything into the box, i thought clicking his name and press delete would be enough...)

also, when I tried opening it when it was already open, it returned in:

  • /dialog: \'message\' name in use (line 22, script.ini)

theres no check to make sure the same buddy wasnt added twice.

Try learning how to use -b and -e switches.
And $devent == edit.

If so, you would be able to disable and enable the buttons until the person types anything into thebox, and by then avoid the Invalid information

Same with remove etc.

Simply, some errors and the dialog could be improved alot.

try using:

if ($did == id) { }
elseif ($did == id) { }

instead of
on *:dialog:message:sclick:15: {

etc..

Anyhow, 3/10.

 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.