PtokaX forum

Archive => Archived 5.0 boards => Request for scripts => Topic started by: VAZ on 25 March, 2005, 12:56:00

Title: +me to !me
Post by: VAZ on 25 March, 2005, 12:56:00
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.
Title: Plop Lua 4 to Lua 5 me-script
Post by: TTB on 25 March, 2005, 17:27:37
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
Title:
Post by: plop on 25 March, 2005, 19:48:56
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
Title:
Post by: TTB on 25 March, 2005, 20:10:15
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)
Title:
Post by: plop on 25 March, 2005, 21:33:07
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
Title:
Post by: TTB on 25 March, 2005, 22:45:15
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*
Title:
Post by: Casanova82 on 13 April, 2005, 03:49:19
Syntax D:\DC\0.3.3.0.b16.09.nt.rls\scripts\me.lua:11: attempt to concatenate local `msg' (a nil value)
Title:
Post by: Madman on 13 April, 2005, 06:57:23
-- 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
Title:
Post by: plop on 13 April, 2005, 22:14:19
-- 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
Title:
Post by: TTB on 13 April, 2005, 22:47:53
LoLz... the %p  :D
Title:
Post by: bastya_elvtars on 13 April, 2005, 22:53:25
There was no example anywhere what %p exactly means. :D
Title:
Post by: TTB on 13 April, 2005, 23:15:00
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...
Title:
Post by: plop on 14 April, 2005, 17:41:19
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