This is the new home of the egghelp.org community forum.
All data has been migrated (including user logins/passwords) to a new phpBB version.


For more information, see this announcement post. Click the X in the top right-corner of this box to dismiss this message.

Return url from a trigger + Text

Help for those learning Tcl or writing their own scripts.
Post Reply
j
johnpursglove
Voice
Posts: 3
Joined: Sat Sep 06, 2008 8:26 pm

Return url from a trigger + Text

Post by johnpursglove »

Hello first post. Just got started in the world of Eggdrop.

Trying to do a simple script that spits out a url from www.ipdb.org (pinball machine database) after a trigger is entered on the channelipdb followed by the name of a game. This script was originally a wiki script I tried to modify for my own needs. Ie:

!IPDB pinbot should return in the channel for all to see.

http://$::www.ipdb.org/search.pl?searchtype=quick&any=pinbot

Any help would be appreciated.
The code is below....

Code: Select all

#========================================================================
# ** IPDB Quick Link
#========================================================================
# * Description:
#
#    * Allows IRC users to link to IPDB quickly through the bot.
#    * The default format is:
#       !ipdb game name
#
#------------------------------------------------------------------------
# * Features:
#
#========================================================================

# Calls the script when people say !ipdb at the start of the line.
# Changes this to whatever you want to make the script call on other
#  keywords.
bind pub - "!ipdb" spidey:ipdb_link

# Two letter language of the wiki you want to link to.

proc spidey:ipdb_link { nick hand chan text } {

		
	# Print link
	putserv "PRIVMSG $chan http://$::www.ipdb.org/search.pl?searchtype=quick&any=$text (Requested by \002$nick\002)"
}

# Log the script as successfully loaded.
putlog "IPDB_log: Loaded"
Last edited by johnpursglove on Sat Sep 06, 2008 10:22 pm, edited 1 time in total.
j
johnpursglove
Voice
Posts: 3
Joined: Sat Sep 06, 2008 8:26 pm

Almost SOLVED - RE- Return url from a trigger + Text

Post by johnpursglove »

Well I solved my own problem for the most part. Found some stuff here in this forum. Read a few parts and came up with a good answer. Well almost. How can I parse a space in the text.

IE !ipdb Black Knight
returns
http://www.ipdb.org/search.pl?searchtyp ... &any=Black

thanks in advance for any help.
John

Code: Select all

##################################################################
#           Internet Pinball Database Game Look up Script
#     For fast searching of  Internet Pinball Database
#     through a bot.
#     
#     
#      Please Feel free to improve this script in any way
#      and use it in your bots!!!
##################################################################



bind pub - "!ipdb" pinbot:ipdbproc

proc pinbot:ipdbproc {name uhost hand chan text} {
        puthelp "PRIVMSG $chan http://www.ipdb.org/search.pl?searchtype=quick&any=$text"
   } 
User avatar
speechles
Revered One
Posts: 1398
Joined: Sat Aug 26, 2006 10:19 pm
Location: emerald triangle, california (coastal redwoods)

Post by speechles »

Code: Select all

puthelp "PRIVMSG $chan http://www.ipdb.org/search.pl?searchtype=quick&any=[string map {" " "%20" "_" "%20"} $text]" 
[string map] is your friend in this case. Any (space) or (underscore) within $text will be exchanged with %20's.
j
johnpursglove
Voice
Posts: 3
Joined: Sat Sep 06, 2008 8:26 pm

Thanks Problem solved.

Post by johnpursglove »

Thanks! Worked like a charm.

[string map] is your friend in this case. Any (space) or (underscore) within $text will be exchanged with %20's.
[/quote]
Post Reply