Author Topic: Basic Caps Lock scanner  (Read 2606 times)

Morio

  • Global Moderator
  • Sr. Member
  • *****
  • Posts: 256
Basic Caps Lock scanner
« on: October 22, 2008, 06:04:26 AM »
Today (November 22nd) is the international Caps Lock day, so I decided to write a script that checks if a person is writing with caps lock on
Code: [Select]
Dim Tolerance, MinLength
Tolerance = 0.5 'maximum tolerated ratio between uppercase and lowercase letters
MinLength = 10 'minimum length of message to be scanned

Sub ONTEXT(Message,Channel,Nickname,Host,ServerNumber)
If Len(Message) >= MinLength then 'check that the message is long enough
UC = 0
for i = 1 to Len(Message) 'loop through the entire message
if Mid(Message,i,1) = UCase(Mid(Message,i,1)) then UC = UC + 1
Next
If UC / Len(Message) > Tolerance then 'the person appears to be writing in uppercase
SendCommand "/echo -a " & Nickname & " on " & Channel & " appears to be writing in uppercase"
End If
End If
End Sub

Right now the script does nothing else than alert you with an echo that someone is writing in uppercase, but you can change it to anything you want
"I don't know what World War 3 will be fought with, but I know World War 4 with be fought with sticks and stones." - Albert Einstein

Snerf

  • Administrator
  • Hero Member
  • *****
  • Posts: 1968
    • IceChat IRC Client
Re: Basic Caps Lock scanner
« Reply #1 on: October 22, 2008, 08:33:33 AM »
Wow, they must be a month ahead in Finland :)

Nice job on the script though, cool.
The IceChat God