Apolyton Archive  |  Preserved copy of the Apolyton Civilization Site and its forums as they stood in September 2005. Read-only; nothing here can be posted to or replied to.  |  Forum index |  About this archive |  The 1998–2001 UBB forums
Today on Apolyton WARDELL INTERVIEW PROMO A.C.S. HISTORY CHAPTER 4 GET CIV4 /w FREE PLUS! A.C.S. PHOTO GALLERY GET A.O.M. V1.1
Apolyton Civilization Forums
main| civ2| civ3| civ4| smac| ctp2| ron| moo3| galciv| galciv2| alt| about|
ApolytonPLUS | register | search | faq | new posts | pm (-/-) | upload | members
hall of fame new! | civgroups | civgroups news | interviews | the column | radio | chat | directory | news | store | PLUS
Apolyton Civilization Forums : Powered by vBulletin version 2.0.3 Apolyton Civilization Forums > Alternative Civs > Freeciv > any perl wizards in here?
Show a Printable Version | Email This Page to Someone! | Receive updates to this thread | Report this to Apolyton news!
04.Sep: `FC` 2.0.5 COMPLETED AND RELEASED
27.Jul: `FC` 2.0.4 COMPLETED AND RELEASED
16.Jul: `FC` 2.0.3 COMPLETED AND RELEASED

bottom of page
  
Author
Thread    < Last Thread     Next Thread > Post New Thread     Post A Reply
MarkG
Guest

Not Yet
time:
Post  Old Post 17-06-2000 09:50
Edit/Delete Message Reply w/Quote
#1 Report this post to a moderator
any perl wizards in here? Lose 30 kilos (of popups)

I need some help...

Thue is offline Thue
Freeciv Developer
Copenhagen, Denmark
Jan 1970
time: 06:14
Post  Old Post 16-06-2000 22:03 Visit Thue's homepage!
Edit/Delete Message Reply w/Quote
#2 Report this post to a moderator
Enter the AD-FREE zone

I am by no means a perl wizard, but if you would describe the problem I can see if I can help!

paulz is offline paulz
Freeciv Webmaster
San Diego, CA, USA
May 2000
time: 21:14
Post  Old Post 16-06-2000 23:08 Visit paulz's homepage!
Edit/Delete Message Reply w/Quote
#3 Report this post to a moderator
Support Apolyton, buy Civilization 2

I have been known to write a perl line or too as well...

Kumiorava is offline Kumiorava
Prince

Jan 1970
time: 00:14
Post  Old Post 17-06-2000 03:05
Edit/Delete Message Reply w/Quote
#4 Report this post to a moderator
Enter the AD-FREE zone

quote:

Originally posted by MarkG on 06-16-2000 12:50 PM
I need some help...


And he looks for a place to find a perl wiz, and comes to the logical conclusion - the best must reside among the Linux peeps. Quite true.

deepone is offline deepone
Settler

May 2000
time: 05:14
Thumbs up  Old Post 17-06-2000 04:05 Visit deepone's homepage!
Edit/Delete Message Reply w/Quote
#5 Report this post to a moderator
Help yourself to an AD-FREE life

Indeed...

MarkG
Guest

Not Yet
time:
Post  Old Post 17-06-2000 04:36
Edit/Delete Message Reply w/Quote
#6 Report this post to a moderator
Support Apolyton, buy Alpha Centauri

of course, what do stupid windows people know about perl?

ok, I've added this code on one of the forums scripts which limits the numbers of threads one can make per X days to 1(this is enabled only for the off-topic forum)

code:
# Multiple post per day check if (($Status ne "Administrator") && ($Status ne "Moderator")) { if ($number == 23) { $numDaysToWait = 1; @finalPList = (); $nowListTime = time; if (-e "$MembersPath/postedlist.cgi") { open (POSTED, "$MembersPath/postedlist.cgi"); @postedList = ; close (POSTED); foreach $hasPosted (@postedList) { ($UserHP, $DateHP, $ForumNumHP) = split(/\|\!\|/, $hasPosted); chomp($ForumNumHP); if (($nowListTime - $DateHP) < ($numDaysToWait * 86400)) { push @finalPList, $hasPosted; if (($UserHP eq $UserName) && ($ForumNumHP == $number)) { &StandardHTML("Sorry, but you may only post one new topic in this forum once every $numDaysToWait day."); exit; } } } } open (POSTED, ">$MembersPath/postedlist.cgi"); print POSTED @finalPList; print POSTED "$UserName|!|$nowListTime|!|$number\n"; close (POSTED); chmod (0666, "$MembersPath/postedlist.cgi"); } }


I want to limit a poster to X number of threads for X days(instead of 1 thread for X days)

I'm sure it's something easy, but above my level of perl knowledge

Mark von Wagner is offline Mark von Wagner
Prince
Albert in a Can
May 1999
time: 00:14
Post  Old Post 17-06-2000 11:44 Visit Mark von Wagner's homepage!
Edit/Delete Message Reply w/Quote
#7 Report this post to a moderator
Support Apolyton, buy GURPS/ Alpha Centauri

I've never written a PERL program before, so I don't know how good or bad my style is, but this should do the job (give or take a few syntax errors).



if ((($Status ne "Administrator") && ($Status ne "Moderator")) | | ($UserName ne "Mark von Wagner")) {
if ($number == 23) {
$numDaysToWait = 1;
$numberOfThreads = 3;
@finalPList = ();
$nowListTime = time;
if (-e "$MembersPath/postedlist.cgi") {
open (POSTED, "$MembersPath/postedlist.cgi");
@postedList = ;
close (POSTED);
$userFound = 0;

foreach $hasPosted (@postedList) {
@DateHPs = ();
$slotsFound = 0;
($UserHP,$ForumNumHP,$DateHP) = split(/\|\!\|/, $hasPosted, 3);
chomp($DateHP);
for($counter1 = 0; $counter1 < $numberOfThreads; $counter1++) {
($dateTemp, $DateHP) = split(/\|\!\|/, $hasPosted, 2);
push @DateHPs, $dateTemp;
if(($nowListTime - $dateTemp) > ($numDaysToWait * 86400)) {
$slotsFound++;
}
}
if (($UserHP eq $UserName) && ($ForumNumHP == $number)) {
$userFound = 1;

if($slotsFound == 0) {
&StandardHTML("Sorry, but you may only post $numberOfThreads new topics in this forum every 24 hours.");
exit;
}
else {
$flag1 = 0;
$slotsFound = $slotsFound - 1;
$hasPosted = sprintf("%s|!|%s", $UserHP,$ForumNumHP);
foreach $dateTemp(@DateHPs) {
if ((($nowListTime - $dateTemp) > ($numDaysToWait * 86400)) && ($flag1 == 0)) {
$flag1 = 1;
$dateTemp = $nowListTime;
}
$hasPosted = sprintf("%s|!|%d",$hasPosted,$dateTemp);
}
}
push @finalPList, $hasPosted;
}
else if (($slotsFound < $numberOfThreads)) {
$hasPosted = sprintf("%s|!|%s", $UserHP,$ForumNumHP);
foreach $dateTemp(@DateHPs) {
$hasPosted = sprintf("%s|!|%d",$hasPosted,$dateTemp);
}
push @finalPList, $hasPosted;
}
}
if($userFound == 0){
$oldListTime = $nowListTime - 86400 * numDaysToWait;
$hasPosted = sprintf("%s|!|%s|!|%d", $UserHP,$ForumNumHP, $nowListTime);
for($counter1 = 0; $counter1 < $numberOfThreads; $counter1++) {
$hasPosted = sprintf("%s|!|%d",$hasPosted,$oldListTime);
}
push @finalPList, $hasPosted;
}
}
open (POSTED, ">$MembersPath/postedlist.cgi");
print POSTED @finalPList;
close (POSTED);
chmod (0666, "$MembersPath/postedlist.cgi");
}
}

Edit: Corrected indenting
[This message has been edited by Mark von Wagner (edited June 17, 2000).]

Thue is offline Thue
Freeciv Developer
Copenhagen, Denmark
Jan 1970
time: 06:14
Post  Old Post 17-06-2000 14:06 Visit Thue's homepage!
Edit/Delete Message Reply w/Quote
#8 Report this post to a moderator
Support Apolyton, buy Call to Power 2

Now, I don't have time for a real review right now, but reading the first line

if ((($Status ne "Administrator") && ($Status ne "Moderator")) | | ($UserName ne "Mark von Wagner")) {

The last | | should be an &&

MarkG
Guest

Not Yet
time:
Post  Old Post 17-06-2000 14:17
Edit/Delete Message Reply w/Quote
#9 Report this post to a moderator
Suffering from ads?

actually, the | | ($UserName ne "Mark von Wagner") part shouldnt exist

thanks Mark I'll give it a try

MarkG
Guest

Not Yet
time:
Post  Old Post 17-06-2000 17:20
Edit/Delete Message Reply w/Quote
#10 Report this post to a moderator
Support Apolyton, buy Civilization: The Boardgame

minor problem 1
this code

code:
else if (($slotsFound < $numberOfThreads)) {

should be
code:
else { if (($slotsFound < $numberOfThreads)) {
with a } at the end of the if...

else if does not work on perl

[This message has been edited by MarkG (edited June 17, 2000).]

MarkG
Guest

Not Yet
time:
Post  Old Post 17-06-2000 17:25
Edit/Delete Message Reply w/Quote
#11 Report this post to a moderator
Support Apolyton, buy Call to Power 2

bgier problem: something is wrong and the scripts write wrong things on the file...

Mark von Wagner is offline Mark von Wagner
Prince
Albert in a Can
May 1999
time: 00:14
Post  Old Post 18-06-2000 08:16 Visit Mark von Wagner's homepage!
Edit/Delete Message Reply w/Quote
#12 Report this post to a moderator
Support Apolyton, buy GURPS/ Alpha Centauri

Sorry about the problems in my first version. As you can probably tell, I do most of my programming in C++, where things like "else if" are valid. Here is a corrected version that, at least in my tests, works correctly.



if (($Status ne "Administrator") && ($Status ne "Moderator")) {
if ($number == 23) {
$numDaysToWait = 1;
$numberOfThreads = 3;
$userFound = 0;
@finalPList = ();
$nowListTime = time;
if (-e "$MembersPath/postedlist.cgi") {
open (POSTED, "$MembersPath/postedlist.cgi");
@postedList = ;
close (POSTED);
foreach $hasPosted (@postedList) {
@DateHPs = ();
$slotsFound = 0;
($UserHP,$ForumNumHP,$DateHP) = split(/\|\!\|/, $hasPosted, 3);
chomp($DateHP);
for($counter1 = 0; $counter1 < $numberOfThreads; $counter1++) {
($dateTemp, $DateHP) = split(/\|\!\|/, $DateHP, 2);
push @DateHPs, $dateTemp;
if(($nowListTime - $dateTemp) > ($numDaysToWait * 86400)) {
$slotsFound++;
}
}
if (($UserHP eq $UserName) && ($ForumNumHP == $number)) {
$userFound = 1;

if($slotsFound == 0) {
&StandardHTML("Sorry, but you may only post $numberOfThreads new topics in this forum every 24 hours.");
exit;
}
else {
$flag1 = 0;
$slotsFound = $slotsFound - 1;
$hasPosted = sprintf("%s|!|%s", $UserHP,$ForumNumHP);
foreach $dateTemp(@DateHPs) {
if ((($nowListTime - $dateTemp) > ($numDaysToWait * 86400)) && ($flag1 == 0)) {
$flag1 = 1;
$dateTemp = $nowListTime;
}
$hasPosted = sprintf("%s|!|%d",$hasPosted,$dateTemp);
}
}
$hasPosted = sprintf("%s\n",$hasPosted);
push @finalPList, $hasPosted;
}
else {
if (($slotsFound < $numberOfThreads)) {
$hasPosted = sprintf("%s|!|%s", $UserHP,$ForumNumHP);
foreach $dateTemp(@DateHPs) {
$hasPosted = sprintf("%s|!|%d",$hasPosted,$dateTemp);
}
$hasPosted = sprintf("%s\n",$hasPosted);
push @finalPList, $hasPosted;
}
}
}
}
if($userFound == 0){
$oldListTime = $nowListTime - (86400 * $numDaysToWait);
$hasPosted = sprintf("%s|!|%s|!|%d", $UserName,$number, $nowListTime);
for($counter1 = 1; $counter1 < $numberOfThreads; $counter1++) {
$hasPosted = sprintf("%s|!|%d",$hasPosted,$oldListTime);
}
$hasPosted = sprintf("%s\n",$hasPosted);
push @finalPList, $hasPosted;
}
open (POSTED, ">$MembersPath/postedlist.cgi");
print POSTED @finalPList;
close (POSTED);
chmod (0666, "$MembersPath/postedlist.cgi");
}
}


[This message has been edited by Mark von Wagner (edited June 17, 2000).]

MacHatter is offline MacHatter
Chieftain

Jun 2000
time: 21:14
  Old Post 18-06-2000 08:33
Edit/Delete Message Reply w/Quote
#13 Report this post to a moderator
Support Apolyton, buy Civilization: The Boardgame

quote:

Originally posted by MarkG on 06-17-2000 08:20 AM

else if does not work on perl

[This message has been edited by MarkG (edited June 17, 2000).]


I belive that the perl version of else if is elsif. It's been about a month since I was working with perl, so I may be wrong, but I don't think so Yep, I was right.

PS. Could I get the title freeciv porter?

------------------
Andy Black
----------
Mac Port manager for Freeciv

Mark von Wagner is offline Mark von Wagner
Prince
Albert in a Can
May 1999
time: 00:14
Question  Old Post 28-06-2000 09:54 Visit Mark von Wagner's homepage!
Edit/Delete Message Reply w/Quote
#14 Report this post to a moderator
Support Apolyton, buy Civilization: The Boardgame

MarkG, have you gotten around to testing my modifications yet?

MarkG
Guest

Not Yet
time:
Post  Old Post 29-06-2000 23:01
Edit/Delete Message Reply w/Quote
#15 Report this post to a moderator
Browse Apolyton AD-FREE

not yet

Richard Cranium
Guest

Not Yet
time:
Exclamation  Old Post 11-07-2000 09:55
Edit/Delete Message Reply w/Quote
#16 Report this post to a moderator
Support Apolyton, buy Alpha Centauri

In regards to a post in the Apolyton forum:
BUMP

*sounds of 6367 feet tapping*

Edit: just testing a hypothesis...
[This message has been edited by Richard Cranium (edited July 21, 2000).]

Murgatroyd is offline Murgatroyd
King
95 South, 113 West
Feb 2000
time: 21:14
Exclamation  Old Post 03-09-2000 01:39
Edit/Delete Message Reply w/Quote
#17 Report this post to a moderator
Support Apolyton, buy GURPS/ Alpha Centauri

In regards to a post in the Off-Topic forum:
BUMP

*sounds of 6717 feet tapping*

Murgatroyd is offline Murgatroyd
King
95 South, 113 West
Feb 2000
time: 21:14
Post  Old Post 13-09-2000 10:02
Edit/Delete Message Reply w/Quote
#18 Report this post to a moderator
Support Apolyton, buy Civilization 2

An additional BUMP. This thread will not be forgotten!

ProvostQ
Guest

Not Yet
time:
Wink  Old Post 14-09-2000 02:57
Edit/Delete Message Reply w/Quote
#19 Report this post to a moderator
Avatar Enlargement: We've got the solution

I don't consider myself a perl wizard. A perl sourcerer, maybe.

MarkG
Guest

Not Yet
time:
Post  Old Post 14-09-2000 04:02
Edit/Delete Message Reply w/Quote
#20 Report this post to a moderator
Support Apolyton, buy GURPS/ Alpha Centauri

this thread has served it's purpose
lets leave the forum for it's real use...

  < Last Thread     Next Thread > Post New Thread     Post A Reply
All times are GMT. The time now is 05:14.
Apolyton Time is 00:14.
    top of page
Rate This Thread:
Forum Jump:
Forum Rules:
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
HTML code is ON
vB code is ON
Smilies are ON
[IMG] code is ON
 




Contact Us - Apolyton Civilization Site - Support Us!

Building a better Apolyton through better information. Click here and take our poll!
Non-US visitors, click here!

Powered by: vBulletin Version 2.0.3
Copyright ©2000, 2001, Jelsoft Enterprises Limited.

Page generated in 0.0473 seconds (90.96% PHP - 9.04% MySQL) with 30 queries
Page Loading Time:

Support Apolyton: Amazon USA | Amazon UK | Amazon DE | Amazon FR |
Support Apolyton and get FREE PLUS, Buy from Chips&Bits: Galactic Civilizations | Galactic Civilizations: Deluxe Edition | Call to Power 2 | Civilization: The Boardgame | GURPS/ Alpha Centauri | Alpha Centauri | Civilization IV | Civilization III: Complete |


Front Page | Civilization IV | Civilization III | Civilization II | Call to Power II | Alpha Centauri | Master of Orion III
Rise of Nations | Galactic Civilizations | Galactic Civilizations II | Misc
Alt.Civs | Civ I | C:CtP I | About | News | Directory | Apolyton Store | Forums | Chat | Columns | Interviews | Newsletter
Scenario League | CSC | Clash of Civs | Spanish Site | CtP Maps | Cradle of Civ | WesW's Ctp1/2 Site | Civ3 Haven

apolyton.net | apolyton.com | civilization2.net | civilization3.net | civilization4.net | civilizationiv.info | calltopower.net | galciv.net | galciv2.net | moo3.net