client side chatlink script
 

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

client side chatlink script

Started by H?lmgren, 24 February, 2005, 04:43:13

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

H?lmgren

I'm trying to make a script that links mainchats together, kinda like hublink but without all the other stuff, but I'm stuck on the part where the script shuld send the massages to the hubs but the hub it was written in, this is what I got so far
dcpp:setListener( "chat", "chatlink",
	function( hub, user, text )
		local h = hub:getHubName()
		if string.find( h, "hub1" ) or string.find( h, "hub2" ) then
			if string.find( h, "hub1" ) then
				huben = "(hub1)>???<"
			end
			if string.find( h, "hub2" ) then
				huben = "(hub2)>???<"
			end
			if not h then
				--to hub1--( "!say "..huben..user:getNick().." "..text )
			end
			if not h then
				--to hub2--( "!say "..huben..user:getNick().." "..text )
			end
		end
	end
)

plop

store the hubname.
loop thru all the hub's the client is in, this is a table bcdc has.
now compair the hubname with every current hub being procesed.
if they match you don't send a hub msg, else you do.
for more hints, i allready posted a script like this a while back.

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 <----<<

H?lmgren

#2
I'm a n00b to LUA, so what your'e saying doesn't make much sense to me :rolleyes:
and I don't really know what to look for to find your script, so a direct link would be nice and maybe I can figure something out from that.

H?lmgren

After some more searching I found the script you were talking about, hard to find my way around forums I haven't been to before  ;)  and that resulted in this script, manly to be used to link YnHub mainchats together. (thanks for the help Plop)
--// vim:ts=4:sw=4:noet
--// chatlink.lua -- link mainchats togheter

BOTS = { ["-Herr?K.?Hedvall-(Lidk?ping)"]=1, ["[BOT]RoBOT"]=2, ["-SWEnet?-"]=3, ["-Master-"]=4, ["MOTD"]=5, ["-Akademikern-"]=6, ["-Current UserCount-"]=7, ["-Current shareSize-"]=8, ["-Current UpTime-"]=9, ["-MOTD-"]=10, ["-CORE-"]=11 } 

dcpp:setListener( "chat", "chatlink",
	function( hub, user, text )
		local s = string.lower( text )
		if not string.find( s, "^\+" ) and not string.find( s, "redirected" ) and not string.find( s, "disconnected" ) and not string.find( s, "banned" ) and not string.find( s, "incorrect" ) and not
		string.find( s, "is kicking" ) and not string.find( s, "^!" ) and not string.find( s, "^ !" ) and not string.find( s, "date:" ) then
			local othernick = user:getNick()
			local fromhub = hub:getHubName()
			if BOTS[othernick] == nil then
				if string.find( fromhub, "Lidk" ) then
					huben = "(Lidk?ping)>???<"
				end
				if string.find( fromhub, "Norrk" ) then
					huben = "(Norrk?ping)>???<"
				end
				if string.find( fromhub, "Bor?s" ) then
					huben = "(Bor?s)>???<"
				end
				if string.find( fromhub, "Kungs" ) then
					huben = "(Kungsbacka)>???<"
				end
				if string.find( fromhub, "?rebro" ) then
					huben = "(?rebro)>???<"
				end
				if string.find( fromhub, "Mj?lby" ) then
					huben = "(Mj?lby)>???<"
				end
				if string.find( fromhub, "Uppsala" ) then
					huben = "(Uppsala)>???<"
				end
				for k,v in dcpp._hubs do
					if v:getId() ~= hub:getId() then
					v:sendChat( "!say "..huben..othernick.." "..text )
					end
				end
			end
		end
	end
)

SMF spam blocked by CleanTalk