BCDC's formatting.lua and sounds...
 

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

BCDC's formatting.lua and sounds...

Started by Endless, 01 August, 2004, 08:33:07

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

Endless

In BCDC, using the formatting.lua, you can specify some names that will display in a different color.  Like if someone says your nick in the main chat, that line can be a specified color.  I was wondering, if it would be possible to also have it play a sound.  Like, for ex, you have a hub member who you just can never catch, you keep missing him when he comes in, but you're always near the computer, you just keep missing him.  If BCDC and formatting.lua could play a sound when that person shows, you could finally catch him (or her :-))  I always have joins/parts on so the user wouldnt actually have to say anything, the ***Joins: would trigger it.

Is this possible?  I've included the code from my current formatting.lua in case no-one knows what I'm talking about.

Thanks,
E

--edit: 8/5/2004 - Cut out formatting.lua text since it wasn't needed and rather long.

MrZ

Hia

Dont know what client ur using but fullDC has that option, my DCPlusPlus.xml file contains this


hope it could give ya (anyone) a clue

Z ya
Always remember that you are unique... just like everyone else :-D

BottledHate

no need to mess with the formatting.lua for that... this 'annoys' you with a pop up including the text of the nick you are looking for if they nick chats or comes online.... i'm sure u can make it do whatever to get your attention.

--//[BCDC .403b]
--//annoy when findNick chats or comes online....
dcpp:setListener( "chat", "listenfornick",
	function( hub, user, text )
		local findNick = "NickNameHere" --//case sensitive...
		if user:getNick() == findNick then
         local executor = "net send 192.168.2.100 "..findNick.." just said:  "..text.."        In:  "..hub:getHubName()
         os.execute(executor);      
		end
	end																			
)

dcpp:setListener( "userMyInfo", "nickonline",
	function( hub, user, msg )
		local findNick = "NickNameHere" --//case sensitive...
		if user:getNick() == findNick then
         local executor = "net send 192.168.2.100 "..findNick.." just came online in:  "..hub:getHubName()
         os.execute(executor);      
		end
	end																			
)
DC():PrintDebug("*** Annoy Me!!! loaded. ***")


hope this helps...

-BH
Homepage: www.bottledhate.webhop.org

Compiling  Lua scripts is LAME!!!!!

Endless

I tried it as you posted, and two command prompt windows came up and then went away, nothing else seemed to happen.  I'm not anywhere near good at scripting, I usually just wing it and see if it works.  I finally got it to play a sound by changing this:
         local executor = "net send 192.168.2.100 "..findNick.." just said:  "..text.."        In:  "..hub:getHubName()

to this:
         local executor = "\start.wav"

I stuck that wave file in the BCDC dir.  It wouldnt work for some reason when I used a full path to \windows\media\

But, my problem, the wave plays in winamp (my default program for waves), and it plays over, and over, and over, it wont stop.

Otherwise it works,  thanks for a starter :-)

Oh, and also, what if I want to have it match several nicks?  Do I add a new line with the other nick? or put it on the first line separated by a comma or something?

Feel free to tell me I did it wrong, I don't doubt it one bit, hehe.

E

BottledHate

if you just plugged in what i gave u, then yes.. you probably just got a couple wndows that open and close....
you needed to change the ip in that feild.. as that was my internal ip.. not yours..... anyways...


for multiple nicks you want to ue a table...

here's an example:

--//[BCDC .403b]
--//annoy when findNicktable[] chats or comes online....
findNicktable = {["nickName1"] =1, ["nick2"] = 1, ["NiCk3"] = 1 }

dcpp:setListener( "chat", "listenfornick",
	function( hub, user, text )
		if findNicktable[user:getNick()] then
         local executor = "net send 192.168.2.100 "..findNick.." just said:  "..text.."        In:  "..hub:getHubName()
         os.execute(executor);      
		end
	end																			
)

dcpp:setListener( "userMyInfo", "nickonline",
	function( hub, user, msg )
		if findNicktable[user:getNick()] then
         local executor = "net send 192.168.2.100 "..findNick.." just came online in:  "..hub:getHubName()
         os.execute(executor);      
		end
	end																			
)
DC():PrintDebug("*** Annoy Me!!! loaded. ***")

plop has a GREAT site that explains tables and everything...
if you are just starting in lua as i am.. it is a MUST read and a great reference.... plop's website

-?H
Homepage: www.bottledhate.webhop.org

Compiling  Lua scripts is LAME!!!!!

BottledHate

also.. if you are trying to play a wav.... this will play it once then close the app after playing it. if you use xp..
the file should be there.. u'll just need to change the path a bit.

local executor = "C:\\WINNT\\system32\\sndrec32.exe /play /close C:\\WINNT\\media\\chimes.wav"


note the "\\" instead of just "\"  .... the backslash is escape charactor for other special/reserved things..
to make it put one in the string you have to do it twice...  
for example if i wanted to use a path with spaces... i'd need to add quotes into the string....
the quotation mark is a reserved char.. so in order to put it in the string u use the escape char \.    
local executor = "C:\\WINNT\\system32\\sndrec32.exe /play /close \"C:\\My Suff\\any name here.wav\""
os.execute(executor);
this is the same as typing:
    c:\winnt\system32\sndrec32.exe /play /close "c:\my spaces path\filename.wav"
into any dos prompt, or from the run line.


for more info on reserved chars and escape sequenses check out the Lua Reference Manual.

hope this helps...

-?H
Homepage: www.bottledhate.webhop.org

Compiling  Lua scripts is LAME!!!!!

Endless

QuoteOriginally posted by BottledHate
if you just plugged in what i gave u, then yes.. you probably just got a couple wndows that open and close....
you needed to change the ip in that feild.. as that was my internal ip.. not yours..... anyways...

I actually did set it to my internal ip at first.  That's when I got two cmd windows that closed.  Doesn't matter though, I don't wanna do a netsend.

Below is the exact text I'm using now and it does work.  I'm pretty much happy, it notifys me and that's what I wanted.  But why does the sound play twice when the person enters the hub?  I turned off joins/parts and that didnt help.

Also,  why are there the two "dcpp:setListener" sections?  I was playin around and tried one setlistener but not the other and vise versa, but the same thing happened on both.  I got the sound two times upon the person entering, and once upon them speaking.  What do the two sections do?

Thanks for the help so far.
E

Quote
--//[BCDC .403b]

--//annoy when findNicktable[] chats or comes online....

findNicktable = {["E2"] = 1, ["Ghost"] = 1, ["NiCk3"] = 1 }

dcpp:setListener( "chat", "listenfornick",

   function( hub, user, text )

      if findNicktable[user:getNick()] then

         local executor = "C:\\WINDOWS\\system32\\sndrec32.exe /play /close D:\\_StandAlone\\DC++who-EndlessHub\\listener.wav"

         os.execute(executor);      

      end

   end                                                

         
)

dcpp:setListener( "userMyInfo", "nickonline",

   function( hub, user, msg )

      if findNicktable[user:getNick()] then

         local executor = "C:\\WINDOWS\\system32\\sndrec32.exe /play /close D:\\_StandAlone\\DC++who-EndlessHub\\listener.wav"

         os.execute(executor);      

      end

   end                                                

         

)

DC():PrintDebug("*** Annoy Me!!! loaded. ***")

BottledHate

two listeners because it is listening for two different things..... one is a chat message... the other is the $myinfo the user sends when they join the hub...

as far as it playing twice... i dunno... maybe add a couple lines to figure out where it's coming from....

maybe they use a client that spams $MyInfo... (or jsut sends it twice)... note: if the users share changes, description changes, anything like that.. it send $MyInfo again..

--//[BCDC .403b] 

--//annoy when findNicktable[] chats or comes online.... 

findNicktable = {["E2"] = 1, ["Ghost"] = 1, ["NiCk3"] = 1 } 

dcpp:setListener( "chat", "listenfornick", 

function( hub, user, text ) 

if findNicktable[user:getNick()] then 

local executor = "C:\\WINDOWS\\system32\\sndrec32.exe /play /close D:\\_StandAlone\\DC++who-EndlessHub\\listener.wav" 

os.execute(executor); 
Hub:injectChat(user:getNick().." Found In Chat!")

end 

end 


) 

dcpp:setListener( "userMyInfo", "nickonline", 

function( hub, user, msg ) 

if findNicktable[user:getNick()] then 

local executor = "C:\\WINDOWS\\system32\\sndrec32.exe /play /close D:\\_StandAlone\\DC++who-EndlessHub\\listener.wav" 

os.execute(executor); 

Hub:injectChat(user:getNick().." ONLINE! ..got myinfo")

end 

end 



) 

DC():PrintDebug("*** Annoy Me!!! loaded. ***")
Homepage: www.bottledhate.webhop.org

Compiling  Lua scripts is LAME!!!!!

BottledHate

you also said you were playing around trying to make them 1.. in doing so you may have an extra listener in there(loaded) that keeps giving extra responses... in which case you'll need to restart your client to get that one out.


-?H
Homepage: www.bottledhate.webhop.org

Compiling  Lua scripts is LAME!!!!!

Endless

I tried restarting and retrying the code I last posted, same thing happened, two sounds on enter, one on speak.

I then tried the new code you posted and the same, and nothing new.  Am I right to assume that "Hub:injectChat(user:getNick().." Found In Chat!")" would post " Found In Chat!" in my chat window?  If so, it didn't work on enter, or on speak.

I'm not really worried about having a sound when the user speaks, only when they enter.  And I always have joins/parts on, could the script only look for "***Joins:  " ?  Or even just look for the specific nick I'm interested in being notified of.  That would also allow the script to be adapted later for notification on keywords.   Hmm, that sounds like something that would have already been done by someone else, I'll have a look around and see what I can find.

Thanks for your help this far, you've been great :-)

E

BottledHate

i've run the script.. it play sounds 1 time.

the mod was supposed to tell you where each ofthe sounds was coming from..... so u can troubleshoot.  so if both messages ib the main were "ONLINE! ..got myinfo"... then you know you are receving the myinfo twice from the user.

are you in two hubs that that user is in too? you'll get a myinfo with their nick form each.
Hub:injectChat(user:getNick().." ONLINE! ..got myinfo    Hub received from: "..hub:getHubName())
that will tell u what hub it comes from.. so if it is a multiple hub thing.. u get the message from both.

as far as client side scripts.. not much has been made(public).  good luck.

-?H
Homepage: www.bottledhate.webhop.org

Compiling  Lua scripts is LAME!!!!!

BottledHate

#11
ok.. i suppose i could make this into a useable script...


type "/annoy help" in any hub window once loaded.

--//[BCDC .403b]
--//annoy when findNick chats or comes online....
--//this plays a sound file..be sure to change the appropriate info bellow.
--//u can edit this to annoy you in other ways.. ;)  -?H

-----Info need to change:
annoyingSoundPathUsers = "c:\\winnt\\media\\The Microsoft Sound.wav"  --// you must use \\ for backslash
annoyingSoundPathTrigs = "c:\\winnt\\media\\tada.wav"  --// you must use \\ for backslash
-----



findTable = {["Users"]={},["Trigs"]={}}
Serialize = function(tTable, sTableName, sTab)
   sTab = sTab or "";
   sTmp = ""
   sTmp = sTmp..sTab..sTableName.."={"
   local tStart = 0
	for key, value in tTable do
      if tStart == 1 then
         sTmp = sTmp..",\r\n"
      else
         sTmp = sTmp.."\r\n"
         tStart = 1
      end
      local sKey = (type(key) == "string") and string.format("[%q]",key) or string.format("[%d]",key);
      if(type(value) == "table") then
         sTmp = sTmp..Serialize(value, sKey, sTab.."\t");
      else
         local sValue = (type(value) == "string") and string.format("%q",value) or tostring(value);
         sTmp = sTmp..sTab.."\t"..sKey.." = "..sValue
      end
   end
   sTmp = sTmp.."\r\n"..sTab.."}"
   return sTmp
end

local okenize = function( str )
	local ret = {}
	string.gsub( str, "([%S+_%+_.+_%w+]+)", function( s ) table.insert( ret, s ) end ) --// % = alt0160, look for false space in names..
	return ret
end
function saveFindData()
   local savestring = ""
   savestring = Serialize(findTable, "findTable", "")
   local f,e = io.open( "_AnnoyMe.txt", "w+")
   if f then
      f:write(savestring)
      f:close()
   end
end
local printSting = function(list)
   local pString = ""
   for k,v in findTable[list] do
      pString = pString.."            "..k.."\r\n"
   end
return pString
end
local f,e = io.open( "_AnnoyMe.txt", "a+" )
if f then
   f:write( "" )
   f:close()
end
dofile("_AnnoyMe.txt")

dcpp:setListener( "chat", "trigggy",
	function( hub, user, text )
      for k,v in findTable["Trigs"] do
         if string.find(text, k ) == 1 then
            local executor = "sndrec32.exe /play /close \""..annoyingSoundPathTrigs.."\""
            os.execute(executor);     
         end
      end
   end
)

dcpp:setListener( "userMyInfo", "nickonline",
	function( hub, user, msg )
		if findTable["Users"][user:getNick()] then
         local executor = "sndrec32.exe /play /close \""..annoyingSoundPathUsers.."\""
         os.execute(executor);      
		end
	end																			
)

dcpp:setListener( "ownChatOut", "anonyme",
	function( hub, text )
   if string.sub( text, 1, 1 ) ~= "/" then return end
      local parms = okenize( string.sub(  text, 2 ) )
      if parms[1] == "annoy" then
         if parms[2] == nil then
            hub:injectChat( "\r\n ????/?  Current AnnoyMe List  ?\\?`??\r\n    Users:\r\n"..printSting("Users").."    Trigs:\r\n"..printSting("Trigs").."\r\n ('/annoy help' for commands.)")               
         elseif parms[2] =="help"  then
            hub:injectChat("\r\n ????/?  Help For AnnoyMe script  ?\?`??\r\n"..
                                           "        /annoy\t\t\tlists the current AnonyMe list.\r\n"..
                                           "        /annoy addU [nick]\t\tadd a nick name to be annoyed by when the user comes online.\r\n"..
                                           "        /annoy addT [trig]\t\tadds a single word to Annoy you when said in chat.\r\n"..                                              
                                           "        /annoy removeU [nick]\tremove the user from the AnnoyMe list.\r\n"..                                              
                                           "        /annoy removeT [trig]\tremove the trig from the AnnoyMe list.\r\n"..
                                           "        /annoy removeall\t\tremove all values.\r\n"..                                              
                                           "        /annoy help\t\t\t(this)")
         elseif parms[2] == "list" then
            hub:injectChat( "\r\n ????/?  Current AnnoyMe List  ?\\?`??\r\n    Users:\r\n"..printSting("Users").."    Trigs:\r\n"..printSting("Trigs") )
         elseif parms[2] == "addU" then
               if parms[3] ~= nil then
               findTable["Users"][parms[3]] = 1
               hub:injectChat( "\r\n ????/?  User Added..... *New* Current AnnoyMe list.  ?\\?`??\r\n    Users:\r\n"..printSting("Users").."    Trigs:\r\n"..printSting("Trigs"))
               saveFindData()
            else
               hub:injectChat( "\r\n ????/?  Format: /annoy addU NickName123  ?\\?`??")
            end
         elseif parms[2] == "addT" then
            if parms[3] ~= nil then
               findTable["Trigs"][parms[3]] = 1
               hub:injectChat( "\r\n ????/?  Trig Added..... *New* Current AnnoyMe list.  ?\\?`??\r\n    Users:\r\n"..printSting("Users").."    Trigs:\r\n"..printSting("Trigs") )
               saveFindData()
            else
               hub:injectChat( "\r\n ????/?  Format: /annoy addT WoRd  ?\\?`??")
            end                          
         elseif parms[2] == "removeall" then
            findTable = nil
            findTable = {["Users"] = {}, ["Trigs"] = {}}
            hub:injectChat( "\r\n ????/?  *Deleted all values* No Current Nicks or Trigs to Annoy you.  ?\\?`??\r\n")
            saveFindData()
         elseif parms[2] == "removeU" then
            if findTable["Users"][parms[3]] then
                  findTable["Users"][parms[3]] = nil
                  hub:injectChat( "\r\n ????/?  User Removed..... *New* Current AnnoyMe list.  ?\\?`??\r\n    Users:\r\n"..printSting("Users").."    Trigs:\r\n"..printSting("Trigs") )
                  saveFindData()
            else
               hub:injectChat( "\r\n ????/?  User not found. (case sensitive)  ?\\?`??")
            end
         elseif parms[2] == "removeT" then
            if findTable["Trigs"][parms[3]] then
                  findTable["Trigs"][parms[3]] = nil
                  hub:injectChat( "\r\n ????/?  Trig Removed..... *New* Current AnnoyMe list.  ?\\?`??\r\n    Users:\r\n"..printSting("Users").."    Trigs:\r\n"..printSting("Trigs") )
                  saveFindData()
               else
                  hub:injectChat( "\r\n ????/?  Trig not found. (case sensitive)  ?\\?`??")
               end
         else
            hub:injectChat( "\r\n ????/?  Unknown Command ('/annoy help' for commands.)  ?\\?`??")
         end
         return 1
      end
  
end
)

DC():PrintDebug("*** Annoy Me!!! loaded. ***")

--//[BCDC .403b]

Enjoy!

-BH
Homepage: www.bottledhate.webhop.org

Compiling  Lua scripts is LAME!!!!!

BottledHate

i was really tired last night when i made that... had to edit something small.... it wouldn't have caused a crash. but it is just beter now.

edited on post above....

-?H
Homepage: www.bottledhate.webhop.org

Compiling  Lua scripts is LAME!!!!!

Endless

QuoteOriginally posted by BottledHate
i've run the script.. it play sounds 1 time.

the mod was supposed to tell you where each ofthe sounds was coming from..... so u can troubleshoot.  so if both messages ib the main were "ONLINE! ..got myinfo"... then you know you are receving the myinfo twice from the user.

Hmm, I got nothing in either client.  I dunno.  I'd guess it has something to do with one of the clients, or ptokax.  It's no biggie.

Quoteare you in two hubs that that user is in too? you'll get a myinfo with their nick form each.

I am in the hub with my normal nick, and BCDC.  "E2", one of the watch nicks in the script, is set up on a different client (PossumMod v0.0.12a)  I connect with the E2 client and get the two sounds from BCDC.  Both clients are on this computer, but they are different clients and run on different ports etc.  The hub is mine btw, but it's not on this computer, and it's Ptokax 0.3.2.6 test drive 3.

The two sounds isn't really a big deal to me,  the script makes a sound and that's what I was aiming for.

You can give up if you want to, ya done good thus far :)

E

Endless

QuoteOriginally posted by BottledHate
ok.. i suppose i could make this into a useable script...


type "/annoy help" in any hub window once loaded.

hehe, I loaded it up and nothing happened.  No error for loading, it said Annoy Me loaded in the status bar.

Nothing happens for "/annoy help" or "/annoy addT hmm" (nothing happened when I or someone else said "hmm"  

I do, however, have a 0 byte "_AnnoyMe.txt"  in my BCDC dir.

Can a script use "/" in commands?  I figured maybe those were pretty much reserved for DC alone.

But this is otherwise pretty cool.  Seems easy to add and remove nick trigs or keyword trigs.  And a dif sound for each.

E

BottledHate

#15
ok.. so now that i'm messing with this... i've added more...  you'll need to delete the _AnnoyMe.txt and start fresh as the table structure has changed.

v1.3
fixed: hopefully.. for the most part... playing the sound twice for users in multiple hubs.
added: /annoy seen [nick]  -where [nick] = someone on the annoyme list... displays last logout info.. or current online hub.
fixed: /annoy help
future: change sound files from bcdc.. (instead of editing the lua file)
future: [your reasonable suggestion here]  ;)

--//[AnnoyMe 1.3][BCDC .403b] by BottledHate
--//annoy when findNick chats or comes online....
--//this plays a sound file... also keeps a log of the last time the user was seen.
--//be sure to change the appropriate info bellow.

-----Info need to change:
annoyingSoundPathUsers = "c:\\winnt\\media\\The Microsoft Sound.wav"  --//   you must use \\ for backslash .... wav files only.   network files unc:  "\\\\pcname\\path\\to\\sound.wav"
annoyingSoundPathTrigs = "c:\\winnt\\media\\tada.wav"  --//   you must use \\ for backslash  ... wav fiels only.                 local files... "c:\\path to\\the\\sound.wav"
-----///

Serialize = function(tTable, sTableName, sTab)
   sTab = sTab or "";
   sTmp = ""
   sTmp = sTmp..sTab..sTableName.."={"
   local tStart = 0
	for key, value in tTable do
      if tStart == 1 then
         sTmp = sTmp..",\r\n"
      else
         sTmp = sTmp.."\r\n"
         tStart = 1
      end
      local sKey = (type(key) == "string") and string.format("[%q]",key) or string.format("[%d]",key);
      if(type(value) == "table") then
         sTmp = sTmp..Serialize(value, sKey, sTab.."\t");
      else
         local sValue = (type(value) == "string") and string.format("%q",value) or tostring(value);
         sTmp = sTmp..sTab.."\t"..sKey.." = "..sValue
      end
   end
   sTmp = sTmp.."\r\n"..sTab.."}"
   return sTmp
end

local okenize = function( str )
	local ret = {}
	string.gsub( str, "([%S+_%+_.+_%w+]+)", function( s ) table.insert( ret, s ) end ) --// % = alt0160, look for false space in names..
	return ret
end

function saveFindData()
   local savestring = ""
   savestring = Serialize(findTable, "findTable", "")
   local f,e = io.open( "_AnnoyMe.txt", "w+")
   if f then
      f:write(savestring)
      f:close()
   end
end

local seenString = function(n)
   local sestring = ""
   if findTable["Users"][n]["LastSeen"] then
    sestring  = "????/?  "..n.." was last seen leaving "..findTable["Users"][n]["LastSeen"].." ?\\?`??"
   else
   sestring = "????/?  There is no data yet for: "..n.."  ?\\?`??"
   end
   return sestring
end

local printSting = function(list)
   local pString = ""
   for k,v in findTable[list] do
      pString = pString.."            "..k.."\r\n"
   end
return pString
end

function GetTime()
   a = os.date("%a")
   I = os.date("%I")
   M = os.date("%M")
	S = os.date("%S")
	b = os.date("%b")
	d = os.date("%d")
	z = os.date("%z")
	y = os.date("%y")
	Date = a..", "..I..":"..M..":"..S..", "..b.."/"..d.."/"..y.." "..z
	return Date
end


local f,e = io.open( "_AnnoyMe.txt", "a+" )
if f then
   f:write( "" )
   f:close()
end

userOnline = {}
findTable = {["Users"]={},["Trigs"]={},["SoundFiles"] ={}}
dofile("_AnnoyMe.txt")

dcpp:setListener( "userQuit", "seeen",
	function( hub, nick )
      local s,e,nameTrim =  string.find(hub:getHubName(), "([%S+_%s+_.+_%w+]+) %(%d+.%d+.")
   --DC():PrintDebug("userquit data: "..hub:getHubName()..nick)
      if findTable["Users"][nick] then
         findTable["Users"][nick]["LastSeen"] = nameTrim.." "..GetTime()
         if userOnline[nick] then
         userOnline[nick] = nil
         end
         saveFindData()
      end
      return
	end																			
)
dcpp:setListener( "chat", "trigggy",
	function( hub, user, text )
      for k,v in findTable["Trigs"] do
         if string.find(text, k ) == 1 then
            --if findTable["SoundFiles"]["Trigs"] then
            --local executor = "sndrec32.exe /play /close \""..findTable["SoundFiles"]["Trig"].."\""
            local executor = "sndrec32.exe /play /close \""..annoyingSoundPathTrigs.."\""
            os.execute(executor);
            --else
            --hub:injectChat( "????/?  Error: Trigger sound file not set... edit the AnnoyMe(version).lua file line: 8 and set the sound file path. ?\\?`??")
            --end
         end
      end
   end
)

dcpp:setListener( "userMyInfo", "nickonline",
	function( hub, user, msg )
      local s,e,nameTrim =  string.find(hub:getHubName(), "([%S+_%s+_.+_%w+]+) %(%d+.%d+.")
		if findTable["Users"][user:getNick()] then
         if userOnline[user:getNick()] then
            userOnline[user:getNick()] = nameTrim
         else
            userOnline[user:getNick()] = nameTrim
            --if findTable["SoundFiles"]["Users"] then
               --local executor = "sndrec32.exe /play /close \""..findTable["SoundFiles"]["Users"].."\""
               local executor = "sndrec32.exe /play /close \""..annoyingSoundPathUsers.."\""
               os.execute(executor);
            --else
               --hub:injectChat( "????/?  Error: User sound file not set... edit the AnnoyMe(version).lua file line:7 and set the sound file path. ?\\?`??")
            --end
         end
		end
	end																			
)

dcpp:setListener( "ownChatOut", "anonyme",
	function( hub, text )
   if string.sub( text, 1, 1 ) ~= "/" then return end
      local parms = okenize( string.sub(  text, 2 ) )
      if parms[1] == "annoy" then
         if parms[2] == nil then
            hub:injectChat( "????/?  Current AnnoyMe List  ?\\?`??\r\n    Users:\r\n"..printSting("Users").."    Trigs:\r\n"..printSting("Trigs").."\r\n ('/annoy help' for commands.)")               
         elseif parms[2] =="help"  then
            hub:injectChat("????/?  Help For AnnoyMe script  ?\\?`??\r\n"..
                                           "        /annoy\t\t\t-lists the current AnonyMe list.\r\n"..
                                           "        /annoy addU [nick]\t\t-adds a nick name to be annoyed by when the user comes online.\r\n"..
                                           "        /annoy addT [trig]\t\t-adds a single word to Annoy you when said in chat.\r\n"..                                              
                                           "        /annoy removeU [nick]\t-remove the user from the AnnoyMe list.\r\n"..                                              
                                           "        /annoy removeT [trig]\t-remove the trig from the AnnoyMe list.\r\n"..
                                           "        /annoy removeall\t\t-remove all values.\r\n"..
                                           "        /annoy seen [nick]\t\t-shows the last seen info for a person on your AnnoyMe list.\r\n"..                                           
                                           "        /annoy help\t\t\t(this)")
         elseif parms[2] == "list" then
            hub:injectChat( "????/?  Current AnnoyMe List  ?\\?`??\r\n    Users:\r\n"..printSting("Users").."    Trigs:\r\n"..printSting("Trigs") )
         elseif parms[2] == "seen" then
               if findTable["Users"][parms[3]] then
                  if userOnline[parms[3]] then
                     hub:injectChat("????/?  User is currently Online in: "..userOnline[parms[3]].."  ?\\?`??")
                  else
                     hub:injectChat(seenString(parms[3]))
                  end
               else
                  hub:injectChat( " ????/?  Format: /annoy seen [nick]     ..where [nick] is someone already added to the AnnoyMe list.  ?\\?`??")
               end
         elseif parms[2] == "addU" then
               if parms[3] ~= nil then
               findTable["Users"][parms[3]] = {}
               hub:injectChat( "????/?  User Added..... *New* Current AnnoyMe list.  ?\\?`??\r\n    Users:\r\n"..printSting("Users").."    Trigs:\r\n"..printSting("Trigs"))
               saveFindData()
            else
               hub:injectChat( "????/?  Format: /annoy addU NickName123  ?\\?`??")
            end
         elseif parms[2] == "addT" then
            if parms[3] ~= nil then
               findTable["Trigs"][parms[3]] = {}
               hub:injectChat( "????/?  Trig Added..... *New* Current AnnoyMe list.  ?\\?`??\r\n    Users:\r\n"..printSting("Users").."    Trigs:\r\n"..printSting("Trigs") )
               saveFindData()
            else
               hub:injectChat( "????/?  Format: /annoy addT WoRd  ?\\?`??")
            end                          
         elseif parms[2] == "removeall" then
            findTable = nil
            findTable = {["Users"] = {}, ["Trigs"] = {}}
            hub:injectChat( "????/?  *Deleted all values* No Current Nicks or Trigs to Annoy you.  ?\\?`??\r\n")
            saveFindData()
         elseif parms[2] == "removeU" then
            if findTable["Users"][parms[3]] then
                  findTable["Users"][parms[3]] = nil
                  hub:injectChat( "????/?  User Removed..... *New* Current AnnoyMe list.  ?\\?`??\r\n    Users:\r\n"..printSting("Users").."    Trigs:\r\n"..printSting("Trigs") )
                  saveFindData()
            else
               hub:injectChat( "????/?  User not found. (case sensitive)  ?\\?`??")
            end
         elseif parms[2] == "removeT" then
            if findTable["Trigs"][parms[3]] then
                  findTable["Trigs"][parms[3]] = nil
                  hub:injectChat( "????/?  Trig Removed..... *New* Current AnnoyMe list.  ?\\?`??\r\n    Users:\r\n"..printSting("Users").."    Trigs:\r\n"..printSting("Trigs") )
                  saveFindData()
               else
                  hub:injectChat( "????/?  Trig not found. (case sensitive)  ?\\?`??")
               end
         else
            hub:injectChat( "????/?  Unknown Command ('/annoy help' for commands.)  ?\\?`??")
         end
         return 1
      end
  
end
)

DC():PrintDebug("*** AnnoyMe 1.3 Loaded. ***")

--//[AnnoyMe 1.3][BCDC .403b] by BottledHate

qtion/comments/suggestions always welcome.

edit:
also hosted on plop's website ... which is a great source for learning lua.

-?H
Homepage: www.bottledhate.webhop.org

Compiling  Lua scripts is LAME!!!!!

Endless

I tried the most recent script you pasted, "/annoy help" still won't work here.  Does it work on your end?  Maybe it's something with my client or hub.  I use BCDC .401b.  I never get any errors in the status bar of BCDC, it just loads up fine and that's it.

I was peeking around in the script, and saw this bit on line 285 ":dcpp:setListener( "ownChatOut", "anonyme","   Seems to be a slip of the finger.

I also found a similar ?mistype? on line 303

A few other possible things I noticed:
Line 185 - "seeen" ?
Line 213 - "trigggy" ?
Line 291 - "okenize" ?

Even after changing those to what I would think would have been right, "/annoy help" didn't do anything.

Just wondering, will %windir% work in place of winnt?  My install is in c:windows and not winnt.  If %windir% works instead, most users could probably start using the script without any editing at all.

So far, so good :)

E

BottledHate

no, those are not typos those are variables for the listeners... which can be anything/.. "seeen". "triggy", "anonyme" all don't matter... they can be anything... if you change okenize, the script won't work. that typo was on purpose.

  yes /annoy help works for me... i use bcdc.403..... maybe u should upgrade?  the startup.lua is probably a lil different from the one in .403, causeing the error with displaying the /annoy help.

i could change the path for the defualt wavs to include %windir%, but the windir is pointless.. u are suppoesd to set files u want... the ONLY thing u have to put in are the two files you want to use for each "annoy" (wav files). if you want to do it on your own... feel free!!
-----Info need to change:
annoyingSoundPathUsers = "c:\\%windir%\\media\\The Microsoft Sound.wav"  --//   you must use \\ for backslash .... wav files only.   network files unc:  "\\\\pcname\\path\\to\\sound.wav"
annoyingSoundPathTrigs = "c:\\%windir%\\media\\tada.wav"  --//   you must use \\ for backslash  ... wav fiels only.                 local files... "c:\\path to\\the\\sound.wav"
-----///


yeah, next release will have the option to set the sounds from within bcdc.. that is the only thing that requires editing right now.  everything else is handled through /annoy... so after next version, u shouldn't need to edit anything.

maybe i'll get that done tonight???

future: the abilty to set different sound files for each user... or if you don't specify a custom one, it would play the default one.


hope u are enjoying the script.. i know i am :)

-?H
Homepage: www.bottledhate.webhop.org

Compiling  Lua scripts is LAME!!!!!

BottledHate

#18
ok.. so i just had a look at the .401 startup.lua... and it doesn't support the "ownChatOut" ... and the "onMyInfo" is different too.. so, you will be unable to use the /annoy commands till u upgrade. you will probably also keep getting two notifys as well.

i suggest upgrading to bcdc++.403b.. here's a link.  once u upgrade... things are a lil different.. all lua scripts go in [bcdc]/scripts/
so just save the AnnoyMe script in there.  in bcdc /luafile [AnnoyMeScriptName.lua]

to have it load on start... edit the new startup.lua line:~508 and add another dofile([file]) where file = the annoyme scirpt.... if you are getting erorrs on loading the script in the new bcdc.403, delete the "_AnnoyMe.txt"... as the table structure has changed. any old values in there will cause crashes.

-?H
Homepage: www.bottledhate.webhop.org

Compiling  Lua scripts is LAME!!!!!

Endless

Well, I went for .403b, and now "/annoy" does soemthing.  But none of the other commands do anything.  "/annoy help", addT, addU, seen, none of em do anything.  Only "/annoy" shows the current (empty) annoy list.  The _annoyme.txt file is still 0B and empty, even after trying to add a trig like "annoy addT hmm" or "/annoy addU E2"

Gonna try a fresh install of BCDC and see if maybe some option here is screwing me up.  Will let ya know if that fixes it.

E

Endless

I tried a fresh copy of BCDC 403b, no luck on it working so far.

But I was playing around, the onjoin.lua script that comes with bcdc, the one that sends a welcome pm to people as they come in the hub, I modified it a bit to instead play the sound.  And to my surprise, it did work, (not the first time of course :) )  It played the sound, and one time only too.  I figured maybe you would be interested in lookin at it, maybe get an idea for your's or something.

Quote
--// vim:ts=4:sw=4:noet

dcpp:setListener( "userConnected", "onjoin",
   function( hub, user )
      local findNick = "E2"

      if user:getNick() == findNick then

      local executor = "sndrec32.exe /play /close D:\\_StandAlone\\DC++who-EndlessHub\\listener.wav"

      os.execute(executor);

   end

end
)

DC():PrintDebug( "  ** Loaded onjoinmod.lua **" )

[/SIZE]

I don't know who made the original script, and I of course don't mean to take credit for it.  The only commented out sections I removed were where it said what the script did (it doesnt do that anymore since I modified it)

E

BottledHate

hmmm.. interesting. everthing works for me and another friend i had testing.. maybe try this one.

here's another:
1.4
added: sound support
fixed: lil shit here and there.

lol... seems it's getting too long for posting... here is a link... drop it in you /scritps dir and go! no editing of the file is needed in this one.

-?H
Homepage: www.bottledhate.webhop.org

Compiling  Lua scripts is LAME!!!!!

VidFamne

Is this script depending on startup.lua?
If so, why not make a stand alone script?
Sorry for my newbish question.  :))

Endless

Woohoo! Now it works.  I tried it first on my clean install of 403b and then on my daily use 403b, both worked.  Whatever you did fixed it :)

I was wondering,  do the commands have to be case sensitive? Things like "/annoy addT "

Oh, and your dc print debug still says 1.3.

So is this sucker done or do you still have more planned?

Thx...
E

BottledHate

QuoteOriginally posted by VidFamne
Is this script depending on startup.lua?
If so, why not make a stand alone script?
Sorry for my newbish question.  :))

someone correct me if i'm wrong... addtional scripts are loaded into the start-up.lua.  making it work independent of the start-up.lua's funcitons would be redundant, since you would have to re-create most of its funcitons anyways... and bcdc doesn't run without the startup.lua.

i'm a newb too.. so i'm not totally sure if my answer is right.....
Homepage: www.bottledhate.webhop.org

Compiling  Lua scripts is LAME!!!!!

SMF spam blocked by CleanTalk