; Word Definer 2.1 (By Alcar) ; ; This is a word definer. It allows words to be given definitions in a ; !addword (word or words) format and gives definitions to : words types in brackets in a channel. So !addword (life sucks) So do you! ; would result in the script replying So do you! Whenever anyone types ; (life sucks) in the channel or in msg whenever anyone except you types it. ; ; IMPORTANT: As this file makes a .txt for EVERY word defined, placing it in ; its own folder and loading it from their is advisable. ; ; Contact me (Alcar) at #Game1 on dal.net if you have problems or ideas to ; improve it. Have fun :) on *:LOAD:{ echo -a $nick Thank you for loading the Word Definer Version 2.1 echo -a $nick Words are added by typing !addword (word or words) Definition. Then in a channel or msg you type (word or words) and the definition is shown echo -a $nick For example !addword (Sparkie) A good bot would result in the bot replying whenever with the text: a good bot when anyone types (Sparkie). The definer holds multiple defintions for words and reads them randomly. echo -a $nick IMPORTANT: Since the script creates a txt file for each word defined, putting this script in a folder of its own is advisable. } ; Make the user level (right now 500) into whatever you want. This command ; shuts the script down entirely via remotes and can be done by anyone you ; /auser $nick/address 500 to add them to the users section. on 500:TEXT:!worddef off:#:{ .disable #worddef | msg $nick The word definer is now OFF } on 500:TEXT:!worddef off:?:{ .disable #worddef | msg $nick The word definer is now OFF } on 500:TEXT:!worddef on:#:{ .enable #worddef | msg $nick The word definer is now ON } on 500:TEXT:!worddef on:?:{ .enable #worddef | msg $nick The word definer is now ON } ; This allows you to enable and disable the script yourself if not runing ; it as a bot. menu status,menubar,channel { Word Definer .worddef On: .enable #worddef | echo -a Notice: Word Definer was enabled. .worddef Off: .disable #worddef | echo -a Notice: Word Definer was disabled. } #worddef on ; This provides basic help to those who only type !addword. on *:TEXT:!addword:*:{ msg $nick Add word using !addword (word or words to add) Definition. Multiple definitions of one worrd are allowed. To get a word, type (word or words) and the definer will give out the answer if it has one. } ; This stuff adds the word in a channel and tells the user it was added. on *:TEXT:!addword (*) *:#:{ set %word.total $2- set %word.length $len(%word.total) set %word.pos $pos(%word.total,$chr(41),1) set %word.num $calc(%word.length - %word.pos) set %word.add $left(%word.total,%word.pos) set %word.left $right(%word.total,%word.num) set %word.add.1 $remove(%word.add,$chr(40),$chr(41)) set %word.add.2 $replace(%word.add.1,$chr(32),$chr(95)) ; The if statement below is to prevent people from adding scripts to the ; the bot. You could change it to If (mode isin $2- ) if you wished. if (/ isin $2- ) { notice $nick I don't add definitions with / in them. | unset %word.* } else { write $scriptdir $+ %word.add.2 $+ .txt %word.left .notice $nick * $+ %word.add.1 $+ * was added. Thank you unset %word.* } } ; Showing the word in channel. on *:TEXT:(*):#:{ set %word.remove $Remove($1-,$chr(40),$chr(41)) set %word.long $replace(%word.remove,$chr(32),$chr(95)) set %word.full %word.long $+ .txt set %word.check $scriptdir $+ %word.full set %word.checking $exists(%word.check) if (%word.checking == $true) { msg $chan $read $scriptdir [ $+ [ %word.full ] ] unset %word.* } else { unset %word.* } } ; This stuff adds the word in msg and tells the user it was added. on *:TEXT:!addword (*) *:?:{ set %word.total $2- set %word.length $len(%word.total) set %word.pos $pos(%word.total,$chr(41),1) set %word.num $calc(%word.length - %word.pos) set %word.add $left(%word.total,%word.pos) set %word.left $right(%word.total,%word.num) set %word.add.1 $remove(%word.add,$chr(40),$chr(41)) set %word.add.2 $replace(%word.add.1,$chr(32),$chr(95)) if (/ isin $2- ) { notice $nick I don't add definitions with / in them. | unset %word.* } else { write $scriptdir $+ %word.add.2 $+ .txt %word.left .notice $nick * $+ %word.add.1 $+ * was added. Thank you unset %word.* } } ; Showing the word in msg on *:TEXT:(*):?:{ set %word.remove $Remove($1-,$chr(40),$chr(41)) set %word.long $replace(%word.remove,$chr(32),$chr(95)) set %word.full %word.long $+ .txt set %word.check $scriptdir $+ %word.full set %word.checking $exists(%word.check) if (%word.checking == $true) { msg $nick $read $scriptdir [ $+ [ %word.full ] ] unset %word.* } else { unset %word.* } } ; If you decide to limit the definer to one word, you can do it the easy way ; by changing the following lines: ; ; In the on *:TEXT:!addword (*) *:#:{ ; set %word.add $left(%word.total,%word.pos) ; is there. add the next 3 lines under it. ; ; set %word.get $numtok(%word.add,32) ; if (%word.get == 1) { goto continue } else { unset %word.* | .notice $nick Sorry, only 1 word definitions are added. | halt } ; :continue ; ; then change ; on *:TEXT:(*):#:{ ; set %word.remove $Remove($1-,$chr(40),$chr(41)) ; ; to: ; on *:TEXT:(*):#:{ ; set %word.remove $Remove($1,$chr(40),$chr(41)) ; ; Do this to the msg ones also and you will be set. #worddef off