PtokaX forum

Archive => Archived 4.0 boards => Request for Lua 4 scripts => Topic started by: RDB on 17 April, 2004, 14:23:08

Title: Mass-Message + Banner
Post by: RDB on 17 April, 2004, 14:23:08
Is it possible to send a command to a bot rather than posting it in main chat. which then will activate the said command. This is because we sometimes get ops mistyping their commands and end up showing users what we type and it isnt very secure. The two commands im looking to use especially with this feature is a mass message and a banner script. (but the banner script being something that can be used to make it look  like the bot talks and not a full banner).

Thankyou in advance :]
Title:
Post by: Carnage on 17 April, 2004, 14:38:58
Well since normal users can't use those commands anyways ... what's not safe about it ?
Title:
Post by: RDB on 17 April, 2004, 14:52:27
If an OP wants to remain anonymous whilst posting.
Title:
Post by: nErBoS on 17 April, 2004, 14:55:23
Hi,

Just write return 1 in the end of every command and your problem is solved.

Best regards, nErBoS
Title:
Post by: RDB on 17 April, 2004, 15:13:57
i have the banner in channelbot. But is it possible to do another banner that simply posts in the main chat as a bot? (using an existing bot and not needing its own bot for this). Also, need a mass message script integrated in the same script if possible.

Thank you in advance  :]
Title:
Post by: nErBoS on 17 April, 2004, 15:32:27
Hi,

You have to excuse my english not understanding the banner thing. Can you explain ??

Best regards, nErBoS
Title:
Post by: plop on 17 April, 2004, 15:58:40
QuoteOriginally posted by nErBoS
Hi,

You have to excuse my english not understanding the banner thing. Can you explain ??

Best regards, nErBoS
he means the thing you see in my hub when i go for dinner. lol

plop
Title:
Post by: RDB on 17 April, 2004, 16:14:53
I mean a script that will let you send a message in main chat from the bot.

i.e. !botspeak Hi all how ya doing.

Then in mainchat you would see

Hi all how ya doing.

And all ops have this capability, but no user will know who said it  ;)
Title:
Post by: nErBoS on 17 April, 2004, 17:21:28
Hi,

QuoteOriginally posted by plop
QuoteOriginally posted by nErBoS
Hi,

You have to excuse my english not understanding the banner thing. Can you explain ??

Best regards, nErBoS
he means the thing you see in my hub when i go for dinner. lol

plop

LOL :)

Here is it then...

--Requested by RDB
--Made by nErBoS

sBot = "Bot-ME"

function Main()
frmHub:RegBot(sBot)
end

function DataArrival(user, data)
if (strsub(data,1,1) == "<" or strsub(data,1,5+strlen(sBot)) == "$To: "..sBot) then
data = strsub(data,1,strlen(data)-1)
s,e,cmd = strfind(data, "%b<>%s+(%S+)")
if (cmd == "!botspeak" and user.bOperator) then
local s,e,msg = strfind(data, "%b<>%s+%S+%s+(%S+)")
if (msg == nil) then
user:SendPM(sBot, "Syntax Error, !botspeak , you must write a message.")
else
SendToAll(sBot, msg)
end
return 1
elseif (cmd == "!massmess" and user.bOperator) then
local s,e,msg = strfind(data, "%b<>%s+%S+%s+(%S+)")
if (msg == nil) then
user:SendPM(sBot, "Syntax Error, !massmess , you must write a message.")
else
SendPmToAll(sBot, msg)
end
return 1
end
end
end

Best regards, nErBoS
Title:
Post by: RDB on 17 April, 2004, 18:10:01
Perfect :-)

Thank You for the quick response  :)

If i wanted to modify channelbot so that those commands were activated by typing to the bot like this one would it be easy? If so, further help required...
Title:
Post by: RDB on 17 April, 2004, 18:17:15
Also, ive noticed that certain characters end the message sent

i.e. !botspeak hey, how you all

In main chat users will see

<:HouseBot:> hey,

Is it posssible to stop this from happening?

Thank You in Advance

Added: The character that breaks the command is actually . So only oneword messages can be sent.
Title:
Post by: plop on 17 April, 2004, 18:36:14
QuoteOriginally posted by RDB
Also, ive noticed that certain characters end the message sent

i.e. !botspeak hey, how you all

In main chat users will see

<:HouseBot:> hey,

Is it posssible to stop this from happening?

Thank You in Advance
yep but if you don't mind i'm gone leave it 2 nerbos 2 fix it.

@nerbos: last part of the pattern matching is wrong, it only captures 1 word, you wanne capture everything left in the string.

plop
Title:
Post by: nErBoS on 17 April, 2004, 18:52:26
Hi,

Sorry too many copy past :P...
Try this then...

--Requested by RDB
--Made by nErBoS

sBot = "Bot-ME"

function Main()
frmHub:RegBot(sBot)
end

function DataArrival(user, data)
if (strsub(data,1,1) == "<" or strsub(data,1,5+strlen(sBot)) == "$To: "..sBot) then
data = strsub(data,1,strlen(data)-1)
s,e,cmd = strfind(data, "%b<>%s+(%S+)")
if (cmd == "!botspeak" and user.bOperator) then
local s,e,msg = strfind(data, "%b<>%s+%S+%s+(.*)")
if (msg == nil) then
user:SendPM(sBot, "Syntax Error, !botspeak , you must write a message.")
else
SendToAll(sBot, msg)
end
return 1
elseif (cmd == "!massmess" and user.bOperator) then
local s,e,msg = strfind(data, "%b<>%s+%S+%s+(.*)")
if (msg == nil) then
user:SendPM(sBot, "Syntax Error, !massmess , you must write a message.")
else
SendPmToAll(sBot, msg)
end
return 1
end
end
end

Best regards, nErBoS
Title:
Post by: RDB on 17 April, 2004, 19:15:17
Thanks, and one last thing - i put that script in without changing bot name so now i got a new bot - how do i unreg a bot.

BTW.. Thank You for the script  :)
Title:
Post by: plop on 17 April, 2004, 20:43:36
QuoteOriginally posted by RDB
Thanks, and one last thing - i put that script in without changing bot name so now i got a new bot - how do i unreg a bot.

BTW.. Thank You for the script  :)
run this script 1x with the name of the bot you wanne unregister from the userslist.
function Main()
frmHub:UnregBot("PlaceTheToBeRemovedBotNameHere")
end
plop
Title:
Post by: RDB on 17 April, 2004, 21:40:03
Thanks, works perfectly  :)