egghelp.org community Forum Index
[ egghelp.org home | forum home ]
egghelp.org community
Discussion of eggdrop bots, shell accounts and tcl scripts.
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

building a search feature... (part way there..)

 
Post new topic   Reply to topic    egghelp.org community Forum Index -> Scripting Help
View previous topic :: View next topic  
Author Message
dj-zath
Op


Joined: 15 Nov 2008
Posts: 134

PostPosted: Wed Mar 25, 2009 9:52 am    Post subject: building a search feature... (part way there..) Reply with quote

I know I'm probably biting off more than I can chew here, but here goes:

I'm basically trying to extract a line of text after a bind/call.. the text then is forewarded to an external application where its sorted and applied to a search..

for those who have been following my last posts.. I'm now trying to send a string to the RAC..

I have broken it down to the raw commands needed by the RAC that it looks for and can "parse" or insert the string in..

ROUGH code is as follows: mind you- its nowhere near complete or functioning but is included for the following discussion.

Code:


bind pub - !find SrcPlay


proc    SrcPlay {args} {
          global RacIP RacPort Src input
          set Src [catch {[exec fetch -q -A -m -T 1 -o - "http://$RacIP:$RacPort/x/play.cgi?id=$input]}]
}



$input: an integer from the chat i.e. !find 25
Src playlist listing (not needed for this function but another one that goes with this (I haven't got that far yet!)

at the time of this posting, I'm sorta "swirled" on how I'm going to do the functions:

the feature will do 2 things:

1.. voiced chatters enter "!search line of text" and then will get a private window displaying the found results.. with numbers assigned to them (the RAC assigns numbers to the database entries based as an html sytle sheet.. parsing that will be a nightmare all in itself!) then they enter "!play number" to have their tune added to the playlist queue.. (of course I'll have to check the queue to make sure multiple entries are ignored)

again, this is a VERY rough layout.. open to discussion and changes!

-DjZ-
Smile Smile


Last edited by dj-zath on Fri Apr 10, 2009 3:34 pm; edited 1 time in total
Back to top
View user's profile Send private message Visit poster's website
dj-zath
Op


Joined: 15 Nov 2008
Posts: 134

PostPosted: Fri Apr 10, 2009 1:46 pm    Post subject: Reply with quote

I sorta got this thing to work...

but I ran into a snag,

when I used a "!play" function in a pub bind, all worked properly..

when I changed it to a "bind msg" it bawked and dropped an error..

Tcl error [PlyReq]: wrong # args: should be "PlyReq nick uhost hand"


Code:

bind msg - !play PlyReq


simple enough, no?

Code:

proc  PlyReq {nick uhost hand chan arg} {
        global DetHI RacIP RacPort DetAP DetPY MyChan;
        putserv "PRIVMSG $nick :$arg submitted."
        #### more code here ####
}


My problem is I get flustered- then i get stupid!

I guess I'll sleep on this one perhaps and I'll then see the error of my ways!?

or maybe you can offer a suggestion or 2??

DjZ
Smile Smile


Last edited by dj-zath on Fri Apr 10, 2009 2:10 pm; edited 1 time in total
Back to top
View user's profile Send private message Visit poster's website
raider2k
Op


Joined: 01 Jan 2008
Posts: 140

PostPosted: Fri Apr 10, 2009 2:08 pm    Post subject: Reply with quote

if you changed it from bind pub to bind msg, also according to the error you are getting, then you should change it since its your only way to go as stated in tcl-commands.doc Wink

Quote:

(1) MSG
bind msg <flags> <command> <proc>
procname <nick> <user@host> <handle> <text>

Description: used for /msg commands. The first word of the user's
msg is the command, and everything else becomes the text argument.
Module: server
Back to top
View user's profile Send private message
dj-zath
Op


Joined: 15 Nov 2008
Posts: 134

PostPosted: Fri Apr 10, 2009 3:18 pm    Post subject: Reply with quote

sorry, I couldn't quite follow your instructions...

thanks for the input in any event...

I changed "arg" to "text" in the proc token list.. about to test it now.. (booted the code as I'm writing this note)

and.....

same error!


    Tcl error [PlyReq]: wrong # args: should be "PlyReq nick uhost hand chan arg"



I supose I shoud post the "problem" code... so, here goes...

Code:

proc    PlyReq {nick uhost hand chan arg} {
        global DetHI RacIP RacPort DetAP DetPY MyChan;
        if {($arg == "")} {putquick "PRIVMSG $nick :Can't process \"nothing\" - aborting!"; return 0;};
        if {([regsub -nocase -all -- {[A-Z]} $arg "" arg] >= "1")} {putquick "PRIVMSG #$MyChan :Enter only numeric song identifiers - aborting!"; return 0;};
        if {($DetHI != "onair.gif")||($arg == "")||([catch {exec fetch -q  A -m -T 1 -o - "http://$RacIP:$RacPort/x/playlist.cgi?id=$arg"};])} {

        putquick "PRIVMSG $nick : Request query not submitted - Playout System is currently offline.";
        return 0;} else {if {($DetAP == "onair.gif")&&($DetPY == "offair.gif")} {catch {exec fetch -q -A -m -T 1 -o /dev/null "http://$RacIP:$RacPort/x/playing.cgi?c=play" >& /dev/null};};
        putquick "PRIVMSG $nick :Your request query: \#$arg has been submitted!";
        };
};
Back to top
View user's profile Send private message Visit poster's website
nml375
Revered One


Joined: 04 Aug 2006
Posts: 2857

PostPosted: Fri Apr 10, 2009 3:51 pm    Post subject: Reply with quote

Read a second time, msg bindings don't trigger within a channel, and thus has no channel. Remove the chan argument. text vs arg shouldn't matter (as long as you stay away from "args").
_________________
NML_375, idling at #eggdrop@IrcNET
Back to top
View user's profile Send private message
dj-zath
Op


Joined: 15 Nov 2008
Posts: 134

PostPosted: Fri Apr 10, 2009 4:37 pm    Post subject: Reply with quote

hi NML:

yeah, I knew that much... hehe

I haven't got the error to go away (yet) for the meantime I just made the search list in a "notice" and then let them ise in-channel.. dirty, yeah.. but, unless, I can see what I'm doing WRONG here...

I actually got the first part working (to my surprise!) which was the HARDER side of this search thingy... the only thing I need to do is make it "see" the "ahead" playlist and then check that to make sure that a tune already qued isn't going to play..

okay I taken the "notice" out since it was not working too well.. back to the ssearch showing in a PM though they can't do anything in the PM itself..

DjZ
Smile Smile
Back to top
View user's profile Send private message Visit poster's website
nml375
Revered One


Joined: 04 Aug 2006
Posts: 2857

PostPosted: Fri Apr 10, 2009 4:48 pm    Post subject: Reply with quote

Right now, I'm not sure what you are asking help with..
Wasn't it the error of msg bindings not working due to improper argument list?

"Seeing ahead of playlist" - It's been quite a while since I played around with either icecast or shoutcast, but as I recall, the streaming server only knows what the sender tells it - which is what is currently playing.
_________________
NML_375, idling at #eggdrop@IrcNET
Back to top
View user's profile Send private message
dj-zath
Op


Joined: 15 Nov 2008
Posts: 134

PostPosted: Thu Apr 23, 2009 6:08 pm    Post subject: Reply with quote

I found the problem to this error..

I was calling the proc "internally" using args...

in other words, you can't call a "bind" internally (since theres nothing to bind TO!)

the solution was to duplicate the proc - one with args and one without (the one without is caled by another proc internally, while the one with args was called by a bind pub)

I was a silly dork for not catching this one!

in either case, I abondoned that part of the idea.. but I have more issues.. like how to set a hand argument.. its easy, I'm sure and I'll have it figured out by the time you read this post! Smile


-DjZ-
Smile Smile
Back to top
View user's profile Send private message Visit poster's website
Display posts from previous:   
Post new topic   Reply to topic    egghelp.org community Forum Index -> Scripting Help All times are GMT - 4 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Forum hosting provided by Reverse.net

Powered by phpBB © 2001, 2005 phpBB Group
subGreen style by ktauber