this is my first attempt at a dialog so i decided to go simple and made a autogreet...this is very easy to use it gives you the the obvious choices of adding and removing users also it allows you to edit the greet msg from the dialog and decide wether to send the greet by notice, msg or describe(channel).. it also has an enable/disable option...CREDIT TO: yoinx gain for helping me , also to scriptx as i used his GreetManager v1.1. as a general to get to grips with dialogs and /dids, also to pasmal for his tutorial ..although old helped me a great deal http://www.mishscript.de/tutorials/dialogs.htm ... now ill shh before this sounds like an oscars acceptance
menu menubar {
-
Auto Greet:{ dialog -dm auto_greet auto_greet }
}
dialog Auto_Greet {
title "Auto Greet"
size -1 -1 150 149
option dbu
button "Add User", 1, 95 5 46 12
button "Remove User", 2, 95 24 46 12
edit "", 3, 6 94 81 16, multi autovs
button "OK", 4, 54 132 46 12, ok
text "Send By:", 6, 95 43 46 8
radio "Notice", 7, 95 78 46 12, group left
radio "Message", 8, 95 66 46 12, left
radio "Describe", 9, 95 54 46 12, left
list 10, 6 6 81 85, size hsbar vsbar
radio "Enable Auto Greet", 11, 7 117 55 12, group left
radio "Disable Auto Greet", 12, 86 117 55 12, left
button "Save Changes", 13, 91 94 50 15
box "", 14, 89 37 58 54
box "", 15, 1 -1 148 148
box "", 16, 3 113 144 17
}
on *:dialog:auto_greet:sclick:*: {
if ($did == 1) {
set %user $$?="Select User"
set %msg $$?="Greet Message"
write $+(",$scriptdir,autogreet.txt,") %user %msg | did -r auto_greet 10 | loadbuf -ot auto_greet 10 $+(",$scriptdir,autogreet.txt,")
unset %user
unset %msg
}
if ($did == 2) {
var %ruser = $?="Select User"
if (%ruser) write $+(-ds,%ruser) $+(",$scriptdir,autogreet.txt,"if) | did -r auto_greet 10 | loadbuf -ot auto_greet 10 $+(",$scriptdir,autogreet.txt,")
unset %ruser
}
if ($did == 7) {
set %send NOTICE | echo -a 4A14uto 4G14reet set send by: %send
}
if ($did == 8) {
set %send MSG | echo -a 4A14uto 4G14reet set send by: %send
}
if ($did == 9) {
set %send DESCRIBE | echo -a 4A14uto 4G14reet set send by: %send
}
if ($did == 11) {
set %agreet ENABLED | echo -a 4A14uto 4G14reet Is %agreet
}
if ($did == 12) {
set %agreet DISABLED | echo -a 4A14uto 4G14reet Is %agreet
}
if ($did == 4) {
dialog -x auto_greet auto_greet
}
if ($did == 13) {
did -a auto_greet 10 $did(auto_greet,3).text | did -r auto_greet 3 | savebuf -o 0 auto_greet 3 $+(",$scriptdir,autogreet.txt,")
}
}
on *:DIALOG:auto_greet:init:0: {
if (%send == NOTICE) { did -c auto_greet 7 }
if (%send == MSG) { did -c auto_greet 8 }
if (%send == DESCRIBE) { did -c auto_greet 9 }
if (%agreet == ENABLED) { did -c auto_greet 11 }
if (%agreet == DISABLED) { did -c auto_greet 12 }
loadbuf -ot auto_greet 10 $+(",$scriptdir,autogreet.txt,")
}
on *:dialog:auto_greet:dclick:10: {
did -ra auto_greet 3 $did(auto_greet,10).seltext | did -d auto_greet 10 $did(auto_greet,10).sel
}
on *:join:#: {
if (%agreet == ENABLED) && ($nick isin $read(autogreet.txt)) && (%send != DESCRIBE) {
. %send $nick $gettok($read(autogreet.txt,w, $($+(*,$nick,*),2)),2-,32)
}
elseif (%agreet == ENABLED) && ($nick isin $read(autogreet.txt)) && (%send == DESCRIBE) {
. %send # $gettok($read(autogreet.txt,w, $($+(*,$nick,*),2)),2-,32)
}
else { halt }
}
on *:start: {
write -iL1 $+(",$scriptdir,autogreet.txt,") DOUBLECLICK USER TO EDIT
write -iL2 $+(",$scriptdir,autogreet.txt,") -------------------------------------
set %send msg
set %agreet enabled
echo -a 4A14uto 4G14reet Created By 4Jeuz
echo -a 14Goto Menubar>Auto Greet and everything should be self explanatory
echo -a 14Any Problems Contact Me At:12 Pete@Jeuz.org
}
I have a couple problems.
1)
if ($exists(file)) do stuff with the file.
what way you wont get the loadbuf errors if the file doesnt exists. (i get some loadbuf errors on init)
2)
There isnt any need to use the $mircdir identifier to write things into the mirc directory. - write $+($mircdir,autogreet.txt) %user %msg - will actaully cause problems if you have mirc installed somewhere with spaces in the path (program files for instance).
write $+(\",$mircdir,autogreet.txt,\") %user %msg
or
write autogreet.txt %user %msg
either of those methods would work fine.
Sorry Im not trying ot rip it apart, just pointing out how to improve. Since thats really the idea behind these snippets.