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.

Latest Urban Dictionary tcl

Support & discussion of released scripts, and announcements of new releases.
User avatar
spithash
Master
Posts: 248
Joined: Thu Jul 12, 2007 9:21 am
Location: Libera
Contact:

Post by spithash »

I'm still getting a:

Code: Select all

Tcl error [::urbandict::pub]: can't read "define": no such variable
Libera ##rtlsdr & ##re - Nick: spithash
Click here for troll.tcl
n
neocharles
Voice
Posts: 34
Joined: Tue Apr 23, 2013 4:29 pm

Post by neocharles »

Trixar_za wrote:neocharles: Try my urban.tcl @ http://www.trixarian.net/Projects/
I get the following error when I try to set the mode...

Code: Select all

[12:45pm] <neocharles> .chanset #channame +urban
[12:45pm] <Oracle> Error trying to set +urban for #channame, invalid mode.

It does show that the script was loaded, however.
<EDIT>

I saw you have it as

Code: Select all

setudef flag bcmds
User avatar
spithash
Master
Posts: 248
Joined: Thu Jul 12, 2007 9:21 am
Location: Libera
Contact:

Post by spithash »

Trixar_za: did you update the script and forgot to update the .zip? I'm still getting that "define" error :?

also, sputnik's version does work but doesn't show examples.
Libera ##rtlsdr & ##re - Nick: spithash
Click here for troll.tcl
User avatar
Trixar_za
Op
Posts: 143
Joined: Wed Nov 18, 2009 1:44 pm
Location: South Africa
Contact:

Post by Trixar_za »

spithash wrote:I'm still getting a:

Code: Select all

Tcl error [::urbandict::pub]: can't read "define": no such variable
I restarted the bot after copying the files from the redownloaded zip file and I still couldn't reproduce this bug.

Make sure you're copying the files to the right place and that it has the permission to overwrite them. Sometimes I copy the files into the root eggdrop directory rather than the scripts directory myself.

neocharles: Oops, my bad. The flag is now correctly set to urban now.
EDIT: I updated urban.tcl to make it look a little bit more like this version.
User avatar
spithash
Master
Posts: 248
Joined: Thu Jul 12, 2007 9:21 am
Location: Libera
Contact:

Post by spithash »

Trixar_za wrote:
spithash wrote:I'm still getting a:

Code: Select all

Tcl error [::urbandict::pub]: can't read "define": no such variable
I restarted the bot after copying the files from the redownloaded zip file and I still couldn't reproduce this bug.

Make sure you're copying the files to the right place and that it has the permission to overwrite them. Sometimes I copy the files into the root eggdrop directory rather than the scripts directory myself.
Well I tried disabling all my other scripts in both 1.6 and 1.8 bots and still get the same error dude :(

EDIT: yeah I tried erasing previous files and make a clean load of your zip file/scripts
Libera ##rtlsdr & ##re - Nick: spithash
Click here for troll.tcl
User avatar
Trixar_za
Op
Posts: 143
Joined: Wed Nov 18, 2009 1:44 pm
Location: South Africa
Contact:

Post by Trixar_za »

You can see it running here (as GameBot) so I really don't know what's wrong. I re-uploaded the zip file, so maybe try downloading it again to check.
User avatar
Trixar_za
Op
Posts: 143
Joined: Wed Nov 18, 2009 1:44 pm
Location: South Africa
Contact:

Post by Trixar_za »

With spithash's help I identified the bug. My regex was too broad and got caught by some definitions with links in them.

To fix it, just use the following:

Code: Select all

if {[regexp -all -inline {<td class='text' colspan='.' id='.*?'>(.*?)</td} $data] != ""} {
  set matches [regexp -all -inline {<td class='text' colspan='.' id='.*?'>(.*?)</td} $data];
} elseif {[regexp -all -inline {<div class='text' colspan='.' id='entry.*?'>(.*?)<a class} $data] != ""} {
  set matches [regexp -all -inline {<div class='text' colspan='.' id='entry.*?'>(.*?)<a class} $data];
} else {
  set matches "";
}
Also the zip file has been updated @ http://trixarian.net/downloads/urband.zip as per usual

EDIT: Just when I thought I had it fixed, a few bugs came up. It should be fully fixed now... I hope.
Last edited by Trixar_za on Wed Oct 09, 2013 4:27 pm, edited 1 time in total.
User avatar
spithash
Master
Posts: 248
Joined: Thu Jul 12, 2007 9:21 am
Location: Libera
Contact:

Post by spithash »

hehe I did nothing, it is fully working now, good job! :)
Libera ##rtlsdr & ##re - Nick: spithash
Click here for troll.tcl
User avatar
Trixar_za
Op
Posts: 143
Joined: Wed Nov 18, 2009 1:44 pm
Location: South Africa
Contact:

Post by Trixar_za »

Sneaked in another update:
* Fixed a potential bug with examples. It shouldn't break the script when the site changes the layout again...
* Commented out the messages about exceeding the max lines limit - I mean, does the bot really need to tell us that and use another line in the process?

Update at the usual spot: http://trixarian.net/downloads/urband.zip
User avatar
Trixar_za
Op
Posts: 143
Joined: Wed Nov 18, 2009 1:44 pm
Location: South Africa
Contact:

Post by Trixar_za »

Alrighty, it's update time because Urban Dictionary changed their site layout again:
* Added in another two lines so it can match the new layout:

Code: Select all

  } elseif {[regexp -all -inline {<a class=['"]add_to_list['"] data-defid=['"].*?['"] href=['"]#['"]>(.*?)<a class} $data] != ""} {
    set matches [regexp -all -inline {<a class=['"]add_to_list['"] data-defid=['"].*?['"] href=['"]#['"]>(.*?)<a class} $data];
* Made the script match either ' or " when used in a div or a tag using ['"] in the regex. This gives the script more matching flexiablity for future changes.

Grab the latest copy of the script from the usual link:
http://trixarian.net/downloads/urband.zip

Enjoy!
t
tmyoungjr
Voice
Posts: 14
Joined: Fri Aug 24, 2007 3:30 pm

Post by tmyoungjr »

Just noticed today that the UD script was spitting out n/a for every definition but still spit out appropriate examples.

Looks like they changed formats again (shocking!)

All I did was commented out

Code: Select all

#    regexp -nocase -- {<div class=['"]definition['"]>(.*?)</div>} $match -> definition 
and added

Code: Select all

regexp -nocase -- {<div class=['"]meaning['"]>(.*?)</div>} $match -> definition
If there's a cleaner way that's fine. This just made it work for the moment until someone far more versed in this repairs it properly.
User avatar
spithash
Master
Posts: 248
Joined: Thu Jul 12, 2007 9:21 am
Location: Libera
Contact:

Post by spithash »

awesome, thank you! :)
Libera ##rtlsdr & ##re - Nick: spithash
Click here for troll.tcl
d
doubleu
Voice
Posts: 11
Joined: Sun Feb 10, 2008 11:19 pm

Post by doubleu »

Things seemed to be working a week or two ago. Is anyone else getting results like this now?

Code: Select all

[14:24] <nick> !ud eggdrop
[14:24] <bot> Definition [1/4]: n/a
[14:24] <bot> Example [1/4]: k3nny on #bucktoof at irc.gamesurge.net is the greatest eggdrop talker bot on the planet.
[14:24] <nick> !ud 2 eggdrop
[14:24] <nick> !ud 3 eggdrop
[14:24] <bot> Definition [3/4]: n/a
[14:24] <bot> Example [3/4]: WTF???!? The egg drop is f*cked up!
g
goalie204
Halfop
Posts: 44
Joined: Thu Apr 28, 2011 7:31 pm

Post by goalie204 »

hey, me too, same thing.

anyone have a fix? :)

p.s. when i tried tmyoungjr's fix - i get Tcl error [::urbandict::pub]: couldn't compile regular expression pattern: quantifier operand invalid
g
goalie204
Halfop
Posts: 44
Joined: Thu Apr 28, 2011 7:31 pm

Post by goalie204 »

now no matter what i do i get this error ...
Post Reply