~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
}
}
}
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
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 ) {
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.
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:
(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:
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.