PtokaX forum

Development Section => Your Developing Problems => Topic started by: Myth on 15 January, 2004, 15:07:07

Title: Bot's FileList
Post by: Myth on 15 January, 2004, 15:07:07
i'm trying to make a script that would pm a user if he tries to get the filelist from a bot...  :)
i was pretty sure it was easy.. but somethig went wrong... it just won't work..
here's the script (part of it...)

function DataArrival(user,data)

   if strfind(data, "$RevConnectToMe")) then
      user:SendPM(bot, "I'm just a bot...")
   end

end

can anyone tell me what i'm doing wrong?
 i've did some tests.. replacing $RevConnectToMe with $Search, for example, and it worked... with anythig else worked.. but not with $RevConnectToMe... ?(  X(
Title:
Post by: raz on 15 January, 2004, 15:37:35
r u sure u don't need the bot name.
Title:
Post by: Myth on 15 January, 2004, 16:20:18
?(
of course i need the name of the bot.. but i'm reading it from an ini file at the begining of the script... that's not the prob,  the $RevConn.... line seems to be
Title:
Post by: raz on 15 January, 2004, 16:58:23
can u post all of the script on here.  den it will be easier 2 help u.lol  :D
Title:
Post by: Myth on 17 January, 2004, 04:41:18
ok.. i've finished it... and i've found what was wrong..
i was trying to make it a part of a bigger script... and the mistake was somewhere else... in the big script..
here's the lua part

function Main()

   frmHub:EnableFullData(1)
   assert(dofile("1.ini"))
   frmHub:RegBot(bot)

end

function NewUserConnected(curUser)

   SendToAll("$MyINFO $ALL "..bot.." "..botdesc.." "..botinfo.."$ $"..botconn.."$"..botmail.."$"..botshare.."$")

end


function DataArrival(user,data)

   if (strsub(data, 1, 15) == "$RevConnectToMe") then
      local _,_,botname = strfind(data, "$RevConnectToMe%s+%S+%s+(%S+)|")
      if (botname  == "[bot]Console#") then
         user:SendPM(botname, "Man... R u an IDIOT or what?!?! Can't U see I'm just a damn bot?")
      end
   elseif (strsub(data, 1, 12) == "$ConnectToMe") then
   local _,_,botname = strfind(data, "$ConnectToMe%s+(%S+)%s+.*|")
      if (botname  == "[bot]Console#") then
         user:SendPM(botname, "Man... R u an IDIOT or what?!?! Can't U see I'm just a damn bot?")
      end
   end

end


and 1.ini file:


bot = "[bot]Share"
botmail = "NoShare@Dont.Bother"
botshare = "1099511627776"
botinfo = "<++ V:0.01,M:A,H:1/1/1,S:0>"
botdesc = "just a fuckin bot"
botconn = "UnknowN ExtraTerrestriaL SatelitE"


anyway thx for trying to help me
Title:
Post by: Myth on 17 January, 2004, 17:36:11
oops... it seems that something was wrong there...
here's the correct code:


function Main()

   frmHub:EnableFullData(1)
   assert(dofile("settings.ini"))
   frmHub:RegBot(name)
end


function OpConnected(user)

   SendToAll("$MyINFO $ALL "..name.." "..botdesc.." "..botinfo.."$ $"..botconn.."$"..botmail.."$"..botshare.."$")

end


function DataArrival(user,data)

   if (strsub(data, 1, 15) == "$RevConnectToMe") then
      local _,_,botname = strfind(data, "$RevConnectToMe%s+%S+%s+(%S+)|")
      if (botname  == name) then
         user:SendPM(botname, "Man... R u an IDIOT or what?!?! Can't U see I'm just a damn bot?")
      end
   elseif (strsub(data, 1, 12) == "$ConnectToMe") then
   local _,_,botname = strfind(data, "$ConnectToMe%s+(%S+)%s+.*|")
      if (botname  == name) then
         user:SendPM(botname, "Man... R u an IDIOT or what?!?! Can't U see I'm just a damn bot?")
      end
   end

end


Settings.ini file:

name = "[bot]Share"

botmail = "NoShare@Dont.Bother"
botshare = "1099511627776" --the share in bytes
botinfo = "<++ V:1.0,M:A,H:1/1/1,S:0>"
botdesc = "just a fuckin bot"
botconn = "UnknowN ExtraTerrestriaL SatelitE"