Return answer from robocop-bot
 

News:

29 December 2022 - PtokaX 0.5.3.0 (20th anniversary edition) released...
11 April 2017 - PtokaX 0.5.2.2 released...
8 April 2015 Anti child and anti pedo pr0n scripts are not allowed anymore on this board!
28 September 2015 - PtokaX 0.5.2.1 for Windows 10 IoT released...
3 September 2015 - PtokaX 0.5.2.1 released...
16 August 2015 - PtokaX 0.5.2.0 released...
1 August 2015 - Crowdfunding for ADC protocol support in PtokaX ended. Clearly nobody want ADC support...
30 June 2015 - PtokaX 0.5.1.0 released...
30 April 2015 Crowdfunding for ADC protocol support in PtokaX
26 April 2015 New support hub!
20 February 2015 - PtokaX 0.5.0.3 released...
13 April 2014 - PtokaX 0.5.0.2 released...
23 March 2014 - PtokaX testing version 0.5.0.1 build 454 is available.
04 March 2014 - PtokaX.org sites were temporary down because of DDOS attacks and issues with hosting service provider.

Main Menu

Return answer from robocop-bot

Started by Caduceus, 06 January, 2005, 15:55:59

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

Caduceus

Hi!

I'm looking for a way to notify users not to speak to the hubbot e.g. when they recieve a pop-up window from login or when they are warned.

I'm having a lot of n00b-users in my hub... and i sometimes see from the CMD screen in ptokax that they are replying/talking to the bot...  :rolleyes:

Anyone knows how?  ?(

Tnx! :)

[UK]Madman

#1
This shud work....

sBot = "Name Bot Here"

function Main()
frmHub:RegBot(sBot) -- delete this if your using same name as another bot!
end

function DataArrival(Curuser,data)
data = strsub(data,1,strlen(data)-1)

s,e,sTo= strfind(data, "$TO:%s+(%S+)")           -- find out who the pm is to
     if not GetItemByName(sTo) then           -- this checks to see if the target of the PM is actually a proper user
          Curuser:SendPM(sBot, "Are you MAD?!? Your talking to an automated bot!!")
     end
end

Caduceus

#2
Thanx for quick reply [UK]Madman,

There seems to be some problem tho:

Syntax error: bad argument #1 to `strfind' (string expected, got nil)
stack traceback:
   1:  function `strfind' [C]
   2:  function `DataArrival' at line 10 [file `..._0.330_15.25 (+RC9.0c)\scripts\talkingtobot.lua']

I'm sorry, i'm a complete n00b with lua... don't know the error...

Quote---
sBot = "[?Cerberus?]"

function Main()
-- frmHub:RegBot(sBot) -- delete this if your using same name as another bot!
end

function DataArrival(Curuser,data)
data = strsub(data,1,strlen(data)-1)

s,e,sTo= strfind(sData, "$TO:%s+(%S+)")           -- find out who the pm is to
     if not GetItemByName(sTo) then           -- this checks to see if the target of the PM is actually a proper user
          Curuser:SendPM(sBot, "Are you MAD?!? Your talking to yourself as "..sTo.." is only a bot!!")
     end
end
---

[UK]Madman

Apologies, first post ammended, I mistakenly used sData unstead of data for the strfind function.

Caduceus

Yes... it is better, but still a problem:

Syntax error: attempt to concat global `sTo' (a nil value)
stack traceback:
   1:  function `DataArrival' at line 12 [file `..._0.330_15.25 (+RC9.0c)\scripts\talkingtobot.lua']

QuotesBot = "[?Cerberus?]"

-- function Main()
-- frmHub:RegBot(sBot) -- delete this if your using same name as another bot!
-- end

function DataArrival(Curuser,data)
data = strsub(data,1,strlen(data)-1)

s,e,sTo= strfind(data, "$TO:%s+(%S+)")           -- find out who the pm is to
     if not GetItemByName(sTo) then           -- this checks to see if the target of the PM is actually a proper user
          Curuser:SendPM(sBot, "Are you MAD?!? Your talking to yourself as "..sTo.." is only a bot!!")
     end
end

[UK]Madman

Edited again, might get it right in a min ! lol

Caduceus

Yes! thanx [UK]Madman!

it now works... however (i know i am a pain in the behind)...

I get the message too when i talk in OpChat & VipChat...

is it possible to set the script so that it only gives the reply when spoken to the sBot?

Tnx again :)

[UK]Madman

OOppsss, forgot about that, knew it seemed to easy!!  I borrowed the code from another bot im writing that warns users there getting a bots filelist .. forgot you talk to OpChat and VipChat!!

replace
if not GetItemByName(sTo) then

with
if sTo == sBot then

Caduceus

#8
hmmm... No errors, but now it gives no reply at all anymore  :( :

QuotesBot = "[?Cerberus?]"

-- function Main()
-- frmHub:RegBot(sBot) -- delete this if your using same name as another bot!
-- end

function DataArrival(Curuser,data)
data = strsub(data,1,strlen(data)-1)

s,e,sTo= strfind(data, "$TO:%s+(%S+)")           -- find out who the pm is to
     if sTo == sBot then
          Curuser:SendPM(sBot, "Are you MAD?!? Your talking to an automated bot!!")
     end
end

Caduceus

Does [UK]Madman or someone else have a solution to this?

[UK]Madman

Home from work and this is now tested and working fine :o)

sBot = "Bot Name"

-- function Main()
-- frmHub:RegBot(sBot) -- delete this if your using same name as another bot!
-- end

function DataArrival(Curuser,data)
data = strsub(data,1,strlen(data)-1)

s,e,sTo= strfind(data, "$To:%s+(%S+)") -- find out who the pm is to
if sTo == sBot then
Curuser:SendPM(sBot, "Are you MAD?!? Your trying to talk to "..sTo.." whos only a bot!!")
end
end

Was stupid mistake in the patern matching!

Caduceus

Thanx a load [UK]Madman!
Works pretty well this way!

:D

U made me very happy :) tnx again!  :D

[UK]Madman

Got there in the end . lol

Glad it works ok :o)

SMF spam blocked by CleanTalk