dialog cal { title "calculator by Rabbi" size -1 -1 240 280 edit ,3, 55 20 120 30,right,read button "OK",1, 10 80 40 30,OK, button "/",2, 145 120 40 30 button "+",4, 145 210 40 30 button "=",5, 190 210 40 30 button "7",7, 10 120 40 30 button "Clear",8, 190 80 40 30 button "-",9, 145 180 40 30 button "*",10, 145 150 40 30 button "%",11, 190 150 40 30 button "sqrt",12, 190 120 40 30 button "Backspace",13, 55 80 130 30 button "sqr",14, 190 180 40 30 button "sin",15, 10 240 40 30 button "cos",16, 55 240 40 30 button "tan",17, 100 240 40 30 button "8",18, 55 120 40 30 button "9",19, 100 120 40 30 button "4",20, 10 150 40 30 button "5",21, 55 150 40 30 button "6",22, 100 150 40 30 button "1",23, 10 180 40 30 button "2",24, 55 180 40 30 button "3",25, 100 180 40 30 button "0",26, 10 210 40 30 button ".",27, 55 210 40 30 button "00",28, 100 210 40 30 button "help",29, 145 240 40 30 button "about",30, 190 240 40 30 } menu nicklist,status,channel,query { calculator: ..run: { dialog -m cal cal } ..unload: { unload -rs cal.txt | echo 14 -a *** calculator is unloaded! cya next time :) } } on *:dialog:cal:sclick:*: { if ($did == 6) { if (%mycal == false) { did -a cal 3 6 } if (%mycal == true) { did -o cal 3 1 6 set %mycal false } } if ($did == 18) { if (%mycal == false) { did -a cal 3 8 } if (%mycal == true) { did -o cal 3 1 8 set %mycal false } } if ($did == 19) { if (%mycal == false) { did -a cal 3 9 } if (%mycal == true) { did -o cal 3 1 9 set %mycal false } } if ($did == 20) { if (%mycal == false) { did -a cal 3 4 } if (%mycal == true) { did -o cal 3 1 4 set %mycal false } } if ($did == 21) { if (%mycal == false) { did -a cal 3 5 } if (%mycal == true) { did -o cal 3 1 5 set %mycal false } } if ($did == 22) { if (%mycal == false) { did -a cal 3 6 } if (%mycal == true) { did -o cal 3 1 6 set %mycal false } } if ($did == 23) { if (%mycal == false) { did -a cal 3 1 } if (%mycal == true) { did -o cal 3 1 1 set %mycal false } } if ($did == 24) { if (%mycal == false) { did -a cal 3 2 } if (%mycal == true) { did -o cal 3 1 2 set %mycal false } } if ($did == 25) { if (%mycal == false) { did -a cal 3 3 } if (%mycal == true) { did -o cal 3 1 3 set %mycal false } } if ($did == 26) { if (%mycal == false) { did -a cal 3 0 } if (%mycal == true) { did -o cal 3 1 0 set %mycal false } } if ($did == 27) { if (%mycal == false) { if (. !isin $did($dname,3).text) { did -a cal 3 . } } if (%mycal == true) { did -o cal 3 1 . set %mycal false } } if ($did == 28) { if (%mycal == false) { did -a cal 3 00 } if (%mycal == true) { did -o cal 3 1 00 set %mycal false } } if ($did == 7) { if (%mycal == false) { did -a cal 3 7 } if (%mycal == true) { did -o cal 3 1 7 set %mycal false } } if ($did == 4) { set %getdata $did($dname,3).text set %mycal true set %myplus true } if ($did == 5) { if (%myplus == true) { did -o $dname 3 1 $calc($did($dname,3).text + %getdata) set %myplus false } if (%mydiv == true) { did -o $dname 3 1 $calc(%getdata / $did($dname,3).text) set %mydiv false } if (%mysub == true) { did -o $dname 3 1 $calc(%getdata - $did($dname,3).text) set %mysub false } if (%mymulti == true) { did -o $dname 3 1 $calc(%getdata * $did($dname,3).text) set %mymulti false } } if ($did == 2) { set %getdata $did($dname,3).text set %mycal true set %mydiv true } if ($did == 8) { did -r $dname 3 } if ($did == 9) { set %getdata $did($dname,3).text set %mycal true set %mysub true } if ($did == 10) { set %getdata $did($dname,3).text set %mycal true set %mymulti true } if ($did == 11) { set %mycal true did -o $dname 3 1 $calc((%getdata * 100) / ($did($dname,3).text * 100)) } if ($did == 12) { did -o $dname 3 1 $sqrt($did($dname,3).text) } if ($did == 13) { if ($len($did($dname,3).text) > 0) { did -o $dname 3 1 $right($did($dname,3).text,-1) } } if ($did == 14) { did -o $dname 3 1 $calc($did($dname,3).text * $did($dname,3).text) } if ($did == 15) { did -o $dname 3 1 $sin($did($dname,3).text) } if ($did == 16) { did -o $dname 3 1 $cos($did($dname,3).text) } if ($did == 17) { did -o $dname 3 1 $calc($sin($did($dname,3).text) / $sin($did($dname,3).text)) } if ($did == 29) { run $findfile($mircdir,calhelp.txt,1) } if ($did == 30) { run $findfile($mircdir,calver.txt,1) } if ($did == 1) { unset %mycal unset %myplus unset %mydiv unset %mymulti unset %mysub unset %getdata } } alias cal { dialog -m cal cal } on *:load: { if (*cal.txt iswm $script) { echo 14 -a *** calculator is loaded! type /cal to start calculator :) set %mycal false set %myplus false set %mydiv false set %mymulti false set %mysub false } } on *:unload: { if (*cal.txt iswm $script) { echo 14 -a *** calculator is unloaded! cya next time :) unset %mycal unset %myplus unset %mydiv unset %mymulti unset %mysub unset %getdata } }