I made this agebot just so that people who actually think it helps can just come here, rather than pestering me constantly to make/fix one...
This script lets you use menus to change the active room(s) and remember the users' ages.
The script only allows people between the ages of 18 and 50.
To use this, press alt+r to open the remotes tab, then go to File->New and paste the script there.
Also, if you're only going to comment to say that these are pointless, I already know. :)
Note: It voices users who are the correct age.
EDIT: I noticed just now that there was (Age: $3) instead of (Age: $3 $+ ) - no idea how I missed that during testing.
EDIT: Fixed some small errors which also miraculously evaded testing.
EDIT: Changed the script so it remembers nick ages globally, rather than on a per-room basis.
EDIT: Added a right-click menu for the nicklist to set someone's age. It kicks when appropriate.
EDIT: Fixed logic fail. xD
menu channel {
-
Agebot
.Echo active rooms: agebot.echrooms
.Set rooms: agebot.setup
.$iif($istok(%agebot.rooms,$chan,44),Disable,Enable) for this room: agebot.chgrooms $iif($istok(%agebot.rooms,$chan,44),-r,-a) $chan
.$iif(%agebot.rooms != $chr(35),Enable for all channels) : agebot.chgrooms -n
.$iif(#* iswm %agebot.rooms,Disable for all channels) : agebot.chgrooms -c
-
}
menu status {
-
Agebot
.Echo active rooms: agebot.echrooms
.Set rooms: agebot.setup
.$iif(%agebot.rooms != $chr(35),Enable for all channels) : agebot.chgrooms -n
.$iif(#* iswm %agebot.rooms,Disable for all channels) : agebot.chgrooms -c
-
}
menu nicklist {
-
Agebot
.Set age: {
var %x $?="Enter the age for $1 $+ :"
if (%x isnum) agebot.setage $1 %x
else echo $colour(info) -a Please enter a valid age.
}
-
}
alias -l agebot.proc {
if ($3) {
if ($3 isnum 18-70) {
msg $1 Welcome to $1 $+ , $2 $+ ! :) [Recorded Age: $3 $+ ]
mode $1 +v $2
}
else {
if ($3 < 18) ban -ku43200 $1 $2 2 Sorry, but you're too young for this room. (Recorded Age: $3 $+ )
else ban -ku43200 $1 $2 2 Lying about your age is WRONG! (Recorded Age: $3 $+ )
.notice $2 Thanks for stating you age, but I can't allow you to be in this room.
}
}
else echo $colour(info) -a * /agebot.proc: Not enough parameters
}
alias agebot.setup {
var %x $input(Please enter channels your bot should ask for age in with commas between (Example: #room1 $+ $chr(44) $+ #room2). $+ $crlf $+ You may notice that 'All channels' is $chr(35) and 'No channels' is 'none',eu,Agebot Setup,%agebot.rooms)
if (%x) {
var %r /^(?:(?:#[^,]+,?)+|#|none)$/
if ($regex(%x,%r)) set %agebot.rooms %x
else echo $colour(info) -a * /agebot.setup: You must enter rooms in the form of #room or #room1,#room2 or $chr(35) or 'none'.
}
agebot.echrooms
}
alias -l agebot.chgrooms {
if (!$1) || ($istok(-a -r,$1,32) && ($null == $2)) echo $colour(info) -a * /agebot.chgrooms: Not enough parameters
else {
var %r /^(?:#[^,]+,?)+$/
if (!$regex(%agebot.rooms,%r)) unset %agebot.rooms
if ($1 == -a) %agebot.rooms = $addtok(%agebot.rooms,$2,44)
elseif ($1 == -r) {
if (%agebot.rooms == $2) %agebot.rooms = none
else %agebot.rooms = $remtok(%agebot.rooms,$2,44)
}
elseif ($1 == -c) %agebot.rooms = none
else %agebot.rooms = $chr(35)
}
agebot.echrooms
}
alias -l agebot.echrooms {
if (%agebot.rooms == $chr(35)) var %x All channels
elseif (#* iswm %agebot.rooms) var %x $v2
else var %x No channels
echo $colour(info) -a Agebot is currently active in: %x
}
alias agebot.setage {
if ($2 isnum) {
writeini agebot.db $network $1-2
var %x 1
while ($gettok(%agebot.rooms,%x,44)) {
if ($1 ison $v1) agebot.proc $v2 $1-2
inc %x
}
}
}
on !*:JOIN:%agebot.rooms: {
if ($readini(agebot.db,np,$network,$nick)) agebot.proc $chan $nick $v1
else .notice $nick 3Hey, welcome to $chan $+ , $nick $+ . Just type your age as !age in $chan (Example: If you are 17 type !17)
}
on $*:TEXT:/^!(\d+)$/S:%agebot.rooms: {
if ($readini(agebot.db,np,$network,$nick)) return
var %age $regml(1)
agebot.proc $chan $nick %age
writeini agebot.db $network $nick %age
}
on $*:TEXT:/^!set (\S+) (\d+)$/iS:%agebot.rooms: {
}
on *:START:if (!%agebot.rooms) agebot.setup
on *:UNLOAD:unset %agebot.rooms