Word Replacement
 

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

Word Replacement

Started by Woody, 09 January, 2004, 12:45:13

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

Woody

Just recently i found a program called BCDC++ - within the folder was a startup.lua. From what i can see it is a word replacement script, whether it will work or not is another question??

When being used in BCDC++ it replaces the word "slots" or words within "slots" with "dont ask..."

I thought id give it to you guys to play with :) :)


if dcpp == nill then dcpp = { } end
if clients == nil then clients = { } end

function OnCommandEnter(mess)
   -- macros and such can be used here, but not practically until I remove next comment :p
   -- returning true here will at some point prevent DC++ from further processing it.
end

function OnTimer()
   -- Set this up by calling Timer():SetTimer(seconds), Timer():StartTimer(),
   -- and Timer():StopTimer()
end

function OnDownloadComplete(targetname, targetsize)
   frmClient():PrintDebug("Download complete: \"" .. targetname .. "\" is " ..
      targetsize .. " bytes")
end

dcpp.search = function(aClient, search_string)
   -- frmClient():PrintDebug("Search received: " .. search_string)
   return false;
end

dcpp.myinfo = function(aClient, myinfo_nick)
   AddUser(aClient, myinfo_nick)

   return false;
end

dcpp.quit = function(aClient, nick)
   frmClient():PrintDebug("User removed: \"" .. nick .. "\"")
   clients[aClient].ops[nick] = nil
   clients[aClient].users[nick] = nil

   return false;
end

dcpp.hubName = function(aClient, hub_name)
   clients[aClient].name = hub_name
   frmClient():PrintDebug("Received hubname: " .. clients[aClient].name)
end

dcpp.hello = function(aClient, hello_nick)
   -- find out own nick
   if clients[aClient].my_nick == nil then
      -- the first hello send by the server is the nick it accepts from us.
      clients[aClient].my_nick = hello_nick
      frmClient():PrintDebug("Own nick on " .. clients[aClient].name .. " is " .. hello_nick)
   end

   AddUser(aClient, hello_nick)

   return false;
end

dcpp.privateMessage = function(aClient, sender, message)
   frmClient():PrintDebug("PM received from " .. sender .. ": \"" .. message .. "\"")
   if string.find(message, "slot") ~= nil then
      frmClient():SendClientMessage(aClient, "$To: " .. sender .. " From: " ..
         clients[aClient].my_nick .. " $<" .. clients[aClient].my_nick ..
         "> don't ask...|")
   end

   return false;
end

function DataArrival(client, mess)
   -- returning true here will at some point prevent DC++ from further processing it.

   if string.find(mess, "$Search ") == 1 then
      return dcpp.search(client, mess)
   elseif string.find(mess, "$MyINFO $ALL ") == 1 then
      return dcpp.myinfo(client, string.sub(mess, 14, string.find(mess, " ", 14) - 1))
   elseif string.find(mess, "$Quit ") == 1 then
      return dcpp.quit(client, string.sub(mess, 7, -1))
   elseif string.find(mess, "$HubName ") then
      return dcpp.hubName(client, string.sub(mess, 10, -1))
   elseif string.find(mess, "$Hello ") == 1 then
      return dcpp.hello(client, string.sub(mess, 8, -1))
   elseif string.find(mess, "$OpList ") == 1 then
      for op in string.gfind(string.sub(mess, 9, -1), "[^$]+") do AddOp(client, op) end
   elseif string.find(mess, "$To: ") == 1 then
      local fromNick = string.sub(mess, string.find(mess, "From: ") + 6, -1)
      local sepPos = string.find(fromNick, " %$")
      local message = string.sub(fromNick, sepPos + 2, -1)
      fromNick = string.sub(fromNick, 1, sepPos - 1)
      return dcpp.privateMessage(client, fromNick, message)
   end
end

function SendActiveSearchResult(aClient, IP_port, search_nick, filename, filesize, open_slots, total_slots)
   frmClient():SendUDP(IP_port, "$SR " .. search_nick .. " " .. filename ..
      "\005" .. filesize .. " " .. open_slots .. "/" .. total_slots ..
      "\005" .. clients[aClient].name .. " (" .. clients[aClient].ipPort .. ")|")
end

function AddUser(aClient, nick)
   -- this function exists because I want to be able to add disjunct users & ops if desired.
   clients[aClient].users[nick] = 1
   frmClient():PrintDebug("User added: " .. nick)
end

function AddOp(aClient, nick)
   -- this function exists because I want to be able to add disjunct users & ops if desired.
   clients[aClient].ops[nick] = 1
   frmClient():PrintDebug("Operator added: " .. nick)
end

function OnClientAdded(aClient, clientIpPort)
   clients[aClient] = {}
   clients[aClient].ipPort = clientIpPort
   clients[aClient].ops = {}
   clients[aClient].users = {}
   frmClient():PrintDebug("Client added on " .. clientIpPort)
end

function OnClientRemoved(aClient)
   frmClient():PrintDebug("Client removed: " .. clients[aClient].name)
   clients[aClient] = nil
end

Have Fun

c h i l l a

also playing around withit.. but i don't know if you als have this problem..  i don't know how to send a message to myself..

i use

frmClient():PrintDebug("string")

but I just can't get it to work any ideas, what I must do?

Woody

Same problem, when using it, it only shows the Other person what you said, you are unable to see what was written???

sorry still not worked it out

tezlo

view >> debug messages

plop

QuoteOriginally posted by Woody
Same problem, when using it, it only shows the Other person what you said, you are unable to see what was written???

sorry still not worked it out
that piece of script you mean is not replacing text it's a trigger bot.
frmClient():SendClientMessage
if you wanne see it yourself you gotta alter "message".
becarefull with what you do with that thing btw.
some of the op's from the vikings hub changed it in a bad way.
they had the word "slot" in there response, ended up in a flood in the opchat. lol
i know added a filter 2 a.i. 2 change the word "slot" 2 "Slot" in the op/vipchat so bcdc++ doesn't respond anymore.

plop
http://www.plop.nl lua scripts/howto\'s.
http://www.thegoldenangel.net
http://www.vikingshub.com
http://www.lua.org

>>----> he who fights hatred with hatred, drives the spreading of hatred <----<<


RobinHood

1. Is there a possibility to start the script after changing it without closing bcdc?

something like   !restart    :D

2. Is there a possibility to see the "slot"-message in the PM from the user who asked for it?

I've made a pm from my own nick with the nick of the user and the message, but this is a 2nd pm.

Can someone help?

thx Robin

SMF spam blocked by CleanTalk