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 

Worldtime1.3.tcl working, again.
Goto page Previous  1, 2, 3, 4, 5, 6, 7  Next
 
Post new topic   Reply to topic    egghelp.org community Forum Index -> Script Support & Releases
View previous topic :: View next topic  
Author Message
LOQUILLO
Voice


Joined: 21 Jul 2004
Posts: 14
Location: Perú

PostPosted: Fri Dec 08, 2006 12:03 pm    Post subject: Reply with quote

username wrote:
What does it mean?
Code:
  if {[lsearch -exact {[censored] poo crap} $tloc] != -1} {
and
Code:
  if {[lsearch -exact {[censored] nigger [censored]} $tloc] != -1} {

I think forum blocks badwords from code and change them to [censored], so code what was copypasted from here wouldnt work.

Later:
I understand, I can change [censored] to any word I like to prevent commands like !tz idiot.


oh! here the newest
Code:

 if {[lsearch -exact {s-h-i-t poo crap} $tloc] != -1} {

Code:

if {[lsearch -exact {f-u-c-k nigger c-u-n-t} $tloc] != -1} {

you have in there the right words but you need delete the "-" in them.
_________________
LOQUILLO
IRC Network: EFnet
Channel: #Spanglish
Back to top
View user's profile Send private message Yahoo Messenger MSN Messenger
froggie
Voice


Joined: 18 Aug 2007
Posts: 2

PostPosted: Sat Aug 18, 2007 7:49 pm    Post subject: Lost it again Reply with quote

Not to open an old wound, but I believe the worldtime tcl has broke again. I had the old fix, and sometime between then and now, its fallen over again.

Anyone want to have a fresh look at it?

_________________
I am, the Pirate Froglet.
Back to top
View user's profile Send private message
speechles
Revered One


Joined: 26 Aug 2006
Posts: 1398
Location: emerald triangle, california (coastal redwoods)

PostPosted: Sat Aug 18, 2007 9:27 pm    Post subject: Reply with quote

Use the script from this post.

line 109 - change from:
Code:
regexp {<div id="analog-digital"><font size="7">(.+?)</font></div>} $tzout {} tztime
line 109 - change to:
Code:
regexp {<div id="analog-digital">.+?<font size="7">(.+?)</font>.+?</div>} $tzout {} tztime

line 111 - change from:
Code:
 return $tztime
line 111 - change to:
Code:
return [string trim $tztime]

Quote:
<speechles> !tz san francisco
<bot> The time in San Francisco,United States is 18:18
<speechles> !tz new york
<bot> The time in New York,United States is 21:18

Dunno if that is what the expected output should be but if it is, here you go. Laughing
Back to top
View user's profile Send private message
froggie
Voice


Joined: 18 Aug 2007
Posts: 2

PostPosted: Sat Aug 18, 2007 9:46 pm    Post subject: yay! Reply with quote

Woot, works again, thank you! Mr. Green
_________________
I am, the Pirate Froglet.
Back to top
View user's profile Send private message
Zircon
Op


Joined: 21 Aug 2006
Posts: 191
Location: Montreal

PostPosted: Sat Sep 22, 2007 2:17 am    Post subject: Reply with quote

Hi all

Worldtime.tcl isnt working again. I think something did change in the website and the script cant parse it correctly. Does anyone have a fix for it ? maybe speechles can help us Smile
Back to top
View user's profile Send private message
speechles
Revered One


Joined: 26 Aug 2006
Posts: 1398
Location: emerald triangle, california (coastal redwoods)

PostPosted: Sat Sep 22, 2007 3:59 pm    Post subject: Reply with quote

Zircon wrote:
Hi all

Worldtime.tcl isnt working again. I think something did change in the website and the script cant parse it correctly. Does anyone have a fix for it ? maybe speechles can help us Smile

Sure I can, this is a simple regexp fix. Enjoy Wink

line 109 - change from:
Code:
regexp {<div id="analog-digital">.+?<font size="7">(.+?)</font>.+?</div>} $tzout {} tztime
line 109 - change to:
Code:
regexp {<div id="analog-digital">.+?<span class="font7">(.+?)</span>.+?</div>} $tzout {} tztime


Conversely, for a bit more added info, you can change line 109 & 110 to this:
Code:
regexp {<div id="analog-digital">.+?<span class="font7">(.+?)<.+?<span class="font1">(.+?)<} $tzout {} tztime tzzone
return "[string trim $tztime] [string trim $tzzone]"
#NoWordWrap##########################################################################################################
#NoWordWrap### only present to defeat linefeeds on the forum, isn't code you need to use.
example from irc wrote:
<speechles> !tz san francisco
<sp33chy> The time in San Francisco,United States is 13:14 Pacific Daylight Time (PDT) -0700 UTC
<speechles> !tz berlin
<sp33chy> The time in Berlin,Germany is 22:16 Central European Summer Time (CEST) +0200 UTC

Tip: You can put what is below after your get html routine, but before the actual parsing begins, as a way to help debug.
Code:
# DEBUG DEBUG                   
set $_debug [open "my_debug.txt" w]
puts $_debug $VARIABLE_STORING_YOUR_HTML
close $_debug
Load your my_debug.txt into a program such as RegexBuddy or similar, it makes dealing with regular expressions childs play.

Last edited by speechles on Sat Sep 22, 2007 6:59 pm; edited 1 time in total
Back to top
View user's profile Send private message
Zircon
Op


Joined: 21 Aug 2006
Posts: 191
Location: Montreal

PostPosted: Sat Sep 22, 2007 6:58 pm    Post subject: Reply with quote

Hello speechles

Thanks a lot, it s working again, and thanks for the other infos Smile
Back to top
View user's profile Send private message
panasonic
Voice


Joined: 15 Sep 2007
Posts: 25

PostPosted: Fri Nov 02, 2007 7:34 am    Post subject: Reply with quote

hi!
can u update the latest fixes on the first page so we dont have to scroll pages to see where's the latest fixes?

can i know whether this script can be set to active on certain channel the bot is in by setting e.g .chanset #channel +worldtime ?

btw thanks for this great script!
Back to top
View user's profile Send private message
speechles
Revered One


Joined: 26 Aug 2006
Posts: 1398
Location: emerald triangle, california (coastal redwoods)

PostPosted: Fri Nov 02, 2007 5:54 pm    Post subject: Reply with quote

panasonic wrote:
hi!
can u update the latest fixes on the first page so we dont have to scroll pages to see where's the latest fixes?

Nah, doing on the first page makes it too easy (not to mention, I'm not LOQUILLO so how do you suggest I edit his post?). Let's instead bury the link to the the full working script here in this part of the thread.. Make them work for their bread.. heh.. Anyways, to get it (click here worldtime v1.3)

panasonic wrote:
can i know whether this script can be set to active on certain channel the bot is in by setting e.g .chanset #channel +worldtime ?

It will now work using .chanset #yourchan +worldtime per your request.
Code:
#    v1.3 Nov 02 2007 updated by speechles                            #
#       -- Fixed the regexp scraper.                                  #
#       -- Added scraper for new info to display, exciting! :P        #
#       -- Added chanset ability .chanset #yourchan +worldtime        #
#       -- Added preliminary Multi-Language ability.                  #
#       -- Script now scrapes entire output line directly from the    #
#          webpage, and how it has multilanguage capability, default  #
#          at the moment is english.                                  #
sample from irc wrote:
<speechles> !tz .de san francisco
<sp33chy> The current time in San Francisco, California, United States is 17:20 Pacific Daylight Time (PDT) -0700 UTC @ Freitag, 2. November 2007
<speechles> !tz san francisco
<sp33chy> The current time in San Francisco, California, United States is 5:20 PM Pacific Daylight Time (PDT) -0700 UTC @ Friday, November 02, 2007
<speechles> !tz .fr san francisco
<sp33chy> The current time in San Francisco, California, United States is 17:15 Pacific Daylight Time (PDT) -0700 UTC @ vendredi 2 novembre 2007

Now you have a 'full blown' time script. The multi language is functional, but just the date seems to be changing not the 'The current time in...' line (blame the website)... enjoy never the less Wink
Take note: The multi-language at the moment is an undocumented feature and the comments do not reference it in the usage portion, because of it's limitations. It's there if you want to use it for some reason...
Back to top
View user's profile Send private message
panasonic
Voice


Joined: 15 Sep 2007
Posts: 25

PostPosted: Sat Nov 03, 2007 2:04 am    Post subject: Reply with quote

thanks sir, it works great!
Code:

<panasonic> !time new york
<chanBot> The current time in New York, New York, United States is 2:02 AM Eastern Daylight Time (EDT) -0400 UTC @ Saturday, November 03, 2007
Back to top
View user's profile Send private message
speechles
Revered One


Joined: 26 Aug 2006
Posts: 1398
Location: emerald triangle, california (coastal redwoods)

PostPosted: Sun Nov 25, 2007 12:27 pm    Post subject: Reply with quote

Code:
<speechles> !tz san fran
<sp33chy> The current time in San Francisco, California, United States is 8:24 AM Pacific Standard Time (PST) -0800 UTC @ Sunday, November 25, 2007

<speechles> !tz .fr australia
<sp33chy> The current time in Adelaide, South Australia, Australia is 02:55 Central Daylight Time (CDT) +1030 UTC @ lundi 26 novembre 2007

Corrected minor issue with script giving no reply. Method used to parse now allows for much greater changes in html, so minor website changes should no longer affect this script.
Enjoy WorldTime v1.3 available here.
Back to top
View user's profile Send private message
Exedore
Halfop


Joined: 27 Jan 2008
Posts: 43

PostPosted: Thu Apr 17, 2008 12:58 am    Post subject: Reply with quote

!This last upgrade works perfect!

BUT..

¿What should I do, to make the bot sends the text in spanish?

Code:

<speechles> !tz san fran
<sp33chy> La hora actual en San Francisco, California, Estados Unidos es 8:24 AM Pacific Standard Time (PST) -0800 UTC @ Domingo 25 de Noviembre de 2007


Or at least partially...

This TCL is great!

Thxs
Back to top
View user's profile Send private message
speechles
Revered One


Joined: 26 Aug 2006
Posts: 1398
Location: emerald triangle, california (coastal redwoods)

PostPosted: Thu Apr 17, 2008 1:05 am    Post subject: Reply with quote

Exedore wrote:
!This last upgrade works perfect!

BUT..

¿What should I do, to make the bot sends the text in spanish?

Code:

<speechles> !tz san fran
<sp33chy> La hora actual en San Francisco, California, Estados Unidos es 8:24 AM Pacific Standard Time (PST) -0800 UTC @ Domingo 25 de Noviembre de 2007


Or at least partially...

This TCL is great!

Thxs

The partially part I can do for you, in fact, you already have the ability to do so.
Quote:
<speechles> !tz .es san francisco
<sp33chy> The current time in San Francisco, California, United States is 22:04 Pacific Daylight Time (PDT) -0700 UTC @ miércoles, 16 de abril de 2008
<speechles> !tz .fr new york
<sp33chy> The current time in New York, New York, United States is 01:08 Eastern Daylight Time (EDT) -0400 UTC @ jeudi 17 avril 2008
<speechles> !tz .it london
<sp33chy> The current time in London, United Kingdom is 6.08 DST +0100 UTC @ giovedì 17 aprile 2008

Unfortunately, you can see the parts which remain in english (this is a limitation of the website, not the script). But, you can use this for any regional dialect and it will work similar to how it does in the unoffficial google script.
Back to top
View user's profile Send private message
Exedore
Halfop


Joined: 27 Jan 2008
Posts: 43

PostPosted: Thu Apr 17, 2008 1:14 am    Post subject: Reply with quote

I understand...

anyway.. is a minor detail.

I switch this:
Code:
set lang "en"

For this:
Code:
set lang "es"


I don't know if is ok

'ES' of Español

Or should be 'SP'?
for Spanish?..
Back to top
View user's profile Send private message
speechles
Revered One


Joined: 26 Aug 2006
Posts: 1398
Location: emerald triangle, california (coastal redwoods)

PostPosted: Thu Apr 17, 2008 1:30 am    Post subject: Reply with quote

Exedore wrote:
I understand...

anyway.. is a minor detail.

I switch this:
Code:
set lang "en"

For this:
Code:
set lang "es"


I don't know if is ok

'ES' of Español

Or should be 'SP'?
for Spanish?..


Sure you can change that for the default behavior to be 'ES'.
Then if someone uses just !tz <somewhere> it will give spanish flavored results instead of english. But they can also at anytime, !tz .fr <somewhere> and get french results, even tho you have set that to 'ES'. Do you understand?
The script has a dual behavior. It will let you dynamically select your language when you trigger it (behavior 2). Or, If they choose not to give a language when they trigger it, they will instead be given the default (set lang "XX") language (behavior 1). This follows exactly how the unofficial google script works when dealing with languages, it has dual behavior as well.

And for any curious, this agent line is how languages are handled before loading the html.
Code:
puts $tzsock "Accept-Language: ${lang}-${lang},${lang};q=0.9,${lang};q=0.8,${lang};q=0.7,*;q=0.6"
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    egghelp.org community Forum Index -> Script Support & Releases All times are GMT - 4 Hours
Goto page Previous  1, 2, 3, 4, 5, 6, 7  Next
Page 2 of 7

 
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