PtokaX forum

Archive => Archived 4.0 boards => Request for Lua 4 scripts => Topic started by: NemeziS on 24 September, 2004, 18:48:19

Title: CAPS LOCK messages...
Post by: NemeziS on 24 September, 2004, 18:48:19
Hi!
I'm searching for a script that will give a message from bot if the text in main was written with CAPS LOCK.

Example:
I send to main: CAPS LOCK TEXT LA LA LA

and in main appears:

[20:00] CAPS LOCK TEXT LA LA LA
[20:00] turn caps lock off please!!!


JokeR - it's my bot name.

Who can write this script for me? :)
Title:
Post by: Seiya on 24 September, 2004, 19:18:12
In your DataArrival :

one idea :

QuotesBot1 = "Your Bot"

function DataArrival(user,data)
if (strsub(data, 1, 1) == "<" ) then
data=strsub(data,1,strlen(data)-1)
chaine=strupper(strsub(data,strlen(user.sName)+4,strlen(data)))
if (data=="<"..user.sName.."> "..chaine) then
if (chaine~=strlower(chaine)) then
user:SendData(sBot1, "Turn off your Caps Lock Please")
end
end
end
end



RespectfullyCORRECTION DONE
Title:
Post by: NemeziS on 24 September, 2004, 22:56:47
not works :(((
Title:
Post by: Seiya on 24 September, 2004, 23:22:49
it works because like this on my hub

another way (i ve just tested it) - (just change sBot1 to your bot variable)

QuotesBot1 = "Your Bot"

function DataArrival(user,data)
if (strsub(data, 1, 1) == "<" ) then
data=strsub(data,1,strlen(data)-1)
chaine=strupper(strsub(data,strlen(user.sName)+4,strlen(data)))
if (data=="<"..user.sName.."> "..chaine) then
if (chaine~=strlower(chaine)) then
user:SendData(sBot1, "Turn off your Caps Lock Please")
end
end
end
end

CORRECTION DONE
Title:
Post by: NemeziS on 24 September, 2004, 23:31:11
Not works :(( It sends to me "Trun off your caps lock please" every time I send a message (even when Caps Lock off)
Title:
Post by: Seiya on 25 September, 2004, 03:46:38
I've done the correction...and edited it
Title:
Post by: BottledHate on 25 September, 2004, 05:37:15
my 2? cents...


string={find = strfind, sub = strsub, len=strlen, upper=strupper}--//remove this line if using new pto with lua5
function DataArrival(user,data)
   if (strsub(data, 1, 1) == "<" ) then
      data=string.sub(data,1,string.len(data)-1)
      local _,_,text = string.find(data, "%b<> (.*)")
      if text == string.upper(text) then
         user:SendData("*** "..user.sName.." Turn off your damn Caps Lock off now! ...please... ***")
         return 1 --//this line make the message not show up if caps.. remove if you want.
      end
   end
end


-BH
Title:
Post by: Herodes on 25 September, 2004, 15:11:43
btw there is anti-shout by bastya_elvtar (http://board.univ-angers.fr/thread.php?threadid=2684&boardid=12)