i need a script that will work like this: when somone uses +me command the + will automaticly be transefered to ! so it will be like he did !me
thanks in advance.
Hi,
Changed it for u... Plop made the script, here it is in LUA 5:
-- adds +me and /me support.
-- plop
-- Changed into LUA 5 by TTB
function ChatArrival(user, data)
data=string.sub(data,1,string.len(data)-1)
if( string.sub(data, 1, 1) == "<" ) then
local s,e,cmd = string.find(data,"%b<>%s+(%S+)")
if cmd == "+me" or cmd == "/me" or cmd == "#me" then
local s,e,msg = string.find(data,"%b<>%s+%S+%s+(.*)")
SendToAll("* "..user.sName.." "..msg)
return 1
end
end
end
check out this (http://lua.uknnet.com/attachment.php?attachmentid=88&sid=) word replacer, it includes !me in main and pm.
make sure you make a folder called error, forgot 2 add this 2 the zip.
plop
folder "error" added... still got an error >>
No syntax errors in script file zzword_replacer_1.2.lua_5.0_public.lua
Syntax cannot read wordreplace/tLadys.lua: No such file or directory
*edit*
also got this message:
Syntax ...\LUA5\scripts\zzword_replacer_1.2.lua_5.0_public.lua:158: attempt to index global `tBadWords' (a nil value)
QuoteOriginally posted by TTB
folder "error" added... still got an error >>
No syntax errors in script file zzword_replacer_1.2.lua_5.0_public.lua
Syntax cannot read wordreplace/tLadys.lua: No such file or directory
*edit*
also got this message:
Syntax ...\LUA5\scripts\zzword_replacer_1.2.lua_5.0_public.lua:158: attempt to index global `tBadWords' (a nil value)
remove line 142 ( dofile("wordreplace/tLadys.lua") )
the other 1 might disapear after that, if not you are missing the data files.
plop
Hi,
I'm checking it atm... It seems to work well now. Just refering to the question of this threat starter, your LUA4 script (coverted to lua5) will do also the job.
This code is also nice to use, I will use it. Thanx for your support :D
Dank je wel Plop :]
*edited*
Syntax D:\DC\0.3.3.0.b16.09.nt.rls\scripts\me.lua:11: attempt to concatenate local `msg' (a nil value)
-- adds +me and /me support.
-- plop
-- Changed into LUA 5 by TTB
-- Madman messed with it
function ChatArrival(user, data)
data=string.sub(data,1,string.len(data)-1)
local s,e,cmd = string.find(data,"%b<>%s+(%S+)")
if cmd == "+me" or cmd == "/me" or cmd == "#me" then
local s,e,msg = string.find(data,"%b<>%s+%S+%s+(.*)")
if msg == nil then
SendToAll("* "..user.sName)
else
SendToAll("* "..user.sName.." "..msg)
end
return 1
end
end
-- adds +me and /me support.
-- plop
----
-- Changed into LUA 5.
-- TTB
----
-- Madman messed with it
----
-- msg can't be nil anymore.
-- takes all kind of prefixes.
--plop.
----
function ChatArrival(user, data)
local data=string.sub(data,1,string.len(data)-1)
local s,e,cmd = string.find(data,"%b<>%s+%p(%S+)")
if cmd == "me" then
local s,e,msg = string.find(data,"%b<>%s+%S+%s*(.*)")
SendToAll("* "..user.sName.." "..msg)
return 1
end
end
plop
LoLz... the %p :D
There was no example anywhere what %p exactly means. :D
Well.. there is:
. all characters
%a letters
%c control characters
%d digits
%l lower case letters
%p punctuation characters
%s space characters
%u upper case letters
%w alphanumeric characters
%x hexadecimal digits
%z the character with representation 0
%b<> matches anything between the < >, they can be replaced by anything you want
Link: *CLICK* (http://www.plop.nl/howto/pattern_matching.php)
But I also didn't know what punctuation characters were...
QuoteOriginally posted by bastya_elvtars
There was no example anywhere what %p exactly means. :D
i believe it's explained more clearly in the lua book.
if not i must have found it on some website. lol
you can also use %S(%S+), hereby skipping the 1st char.
but this is using a bit more resouces.
ame, bme, cme, would also work there.
plop