User talk:Bucz: Difference between revisions

From The Urban Dead Wiki
Jump to navigationJump to search
(Undead Nobleman here)
 
Line 122: Line 122:


I'll be waiting for your reply.
I'll be waiting for your reply.
Hey, thanks for contact. I will find some mobile and call you. Meanwhile, read post at the top of this page (DocRotten), it might apply to you also?

Latest revision as of 19:52, 10 November 2009

Doc Rotten

Hello Doc! here write what you have on mind, so we don't waste AP. First of all I think that we both should get mobiles... and think what we should do actually... Maybe regaining some abandoned building in Miltown district? Maybe this one? It has a mobile mast, hospital, NT and police nearby... And it's a factory, there are gennies there... What you think about it?

Upcoming!

Malton Block Party -- from 20th September! don't miss!

Related Talks

http://wiki.urbandead.com/index.php/User_talk:Brainguard#weather_script

What the hell?

Why did you delete my signature, as seen here?--Yonnua Koponen Talk ! Contribs 15:57, 10 September 2009 (BST)

I'm going to pipe in and suggest that it was a mistake, it happens from time to time. --DANCEDANCEREVOLUTION-- 16:07, 10 September 2009 (BST)
Yeah, I tend to do annoyed titles though. I'd still like to know why he did it. Then we can prevent the same mistake again.--Yonnua Koponen Talk ! Contribs 16:09, 10 September 2009 (BST)
Me? No idea. My mistake, eventually. Or maybe some zombies, though. -- Bucz 00:54, 11 September 2009 (BST)

Your Script

If you have a weather-detection script, you may be able to do something a lot more useful than submitting suggestions; if you make a UD-based greasemonkey script with your weather reader, people will actually have a good chance of seeing it implemented. Lelouch vi Britannia is helping make Ridleybank green_ and gives Achievements 18:57, 10 September 2009 (BST)

Why greasemonkey? I don't know much about JavaScript. The script I have made is in Perl, like the engine (I suppose), so it would be easy to integrate. -- Bucz 10:47, 11 September 2009 (BST)
Because Greasemonkey alters Client Side Scripting, allowing users to implement your changes without kevin or Urban Dead having to do a thing. If you have another plugin that accomplishes the same thing, feel free to use that one, but less than .001% of all suggestions are implemented whether they pass or not... Lelouch vi Britannia is helping make Ridleybank green_ and gives Achievements 13:35, 11 September 2009 (BST)

No Wiki Tags

You need to place it in no wiki tags, a button can be found in your tool panel, the crossed red circle with a 'W' in it, or use the raw tags: <nowiki></nowiki>

Ironically, to display the tags I had to put them in no wiki tags.... -- To know the face of God is to know madness....Praise knowledge! Mischief! Mayhem! The Rogues Gallery!. <== DDR Approved Editor 23:09, 14 September 2009 (BST)

Thanks, but now when I paste the script new lines are not respected - puts all in a single veeery long wrapped (crapped) line... -- Bucz 20:05, 15 September 2009 (BST)

Put only the parts that involve code, the <> parts, in the tags. Lelouch vi Britannia is helping make Ridleybank green_ and gives Achievements 22:33, 15 September 2009 (BST)

<pre></pre> tags did the job. -- Bucz 13:54, 17 September 2009 (BST)

#!/usr/bin/perl
use warnings;
use strict;

#.......url with the weather
my $num = $ARGV[0] || 878; # code for Providence
my $pageurl = 'http://www.timeanddate.com/worldclock/city.html?n='.$num;

#.......filter to get the decription
my $filter_description = '<tr><td>Description:</td><td colspan="3">(.*?)</td></tr>';

my $www = page($pageurl);
$www =~ /$filter_description/;
my $desc = $1;
#.......some error, no descripton found
if (not $desc) {
    print STDERR "no description!\n";
    exit;
}

# my $desc = 'Foggy. Showers.';
fogcheck($desc);


printf "%s #\n%s\n", $desc, description($desc);
exit;


#................................................................
#.......process description
#       split the sentences and and merge again into something more accurate.
sub description {
    my $desc = shift || return;
    #.......trim sentence
    $desc =~ s/^\s+//g;
    $desc =~ s/[\s\.]+$//g;

    #.......split sentences
    my @a = split /\s*\.\s*/, $desc;
    return '' if not @a; #.......empty?
    return sprintf "%s.", $a[0] if scalar @a == 1; #.......only one sentence

    #.......if there are two, merge them into a single one
    return sprintf "%s, %s.", $a[0], lc $a[$#a] if scalar @a == 2;

    #.......if there are tree or more, merge first two and the last one
    return sprintf "%s, %s. %s.", $a[0], lc $a[1], $a[$#a];
}

#................................................................
sub fogcheck {
    my $desc = shift;
    fogalarm() if $desc =~ /\bFOG/i;
}

#................................................................
#.......................ADJUST THOSE, IF NEEDED..................
#................................................................

#.......get source of the webpage
sub page {
    my $url = shift || return;
#........quiet, timeout 30 sec, output to stdout
    return `wget -q -t 30 -O - '$url'`;
}

#................................................................
#.......here, react for fog. write a flag to a file, or something
sub fogalarm {
    print "FOG!\n";

}

Thanks, but what is this written in? Perl? --Matthewbluewars /New City\ 21:46, 17 September 2009 (BST)

Yup, Perl. And under Linux - I use wget function to download page source (but there are also per functions, it was just easier for me to use embedded Linux-ish one) -- Bucz 23:13, 17 September 2009 (BST)

Undead Nobleman here

Hello. You said to leave comment so here is one. If that suggestion about group still applies I have this thing http://wiki.urbandead.com/index.php/DSS_Satellite_Phone and my phone number is 888-0481. You can contact me through that.

I'll be waiting for your reply.

Hey, thanks for contact. I will find some mobile and call you. Meanwhile, read post at the top of this page (DocRotten), it might apply to you also?