From 67bab9ba74aab951cab63402bb9d1db99895d55a Mon Sep 17 00:00:00 2001 From: Silverwizard Date: Wed, 28 Aug 2019 16:07:58 -0400 Subject: [PATCH] Little fixes --- Cyberpunk.pl | 22 +++++++++------------- 1 file changed, 9 insertions(+), 13 deletions(-) diff --git a/Cyberpunk.pl b/Cyberpunk.pl index a9a0a45..ce28de3 100755 --- a/Cyberpunk.pl +++ b/Cyberpunk.pl @@ -3,15 +3,16 @@ use strict; use warnings; use File::Random qw/:all/; -use constant depth => 5; +use constant depth => 10; $ARGV[0] =~ s/ /_/g; +$ARGV[1] =~ s/ /_/g; mkdir $ARGV[0], 0755 unless -d $ARGV[0]; foreach my $item ("Male", "Female", "Nonbinary", "Cyborg"){ mkdir $ARGV[0] . "/" . $item unless -d $ARGV[0] . "/" . $item; } -generate($ARGV[0], $ARGV[0], 1); +generate($ARGV[0], $ARGV[1], 1); sub generate { my $CHAR; @@ -69,7 +70,7 @@ sub generate { }else{ printf $CHAR " twin"; } - my $ch = name($_[0],$_[1],depth+1,0); + my $ch = name($_[0],$_[1],0,0); printf $CHAR " sibling, named " . $ch . " who "; $var = roll(10,1); if(($var == 1)||($var == 2)){ @@ -97,7 +98,7 @@ sub generate { printf $CHAR table("A weapon", "A tool", "A piece of clothing", "A photograph", "A book or diary", "A recording", "A musical instrument", "A piece of jewelery", "A toy", "A letter", "Most Valued Possession"); printf $CHAR "AGE: "; my $age = roll(6,1)+roll(6,1); - print $CHAR $age+16; + printf $CHAR $age+16; printf $CHAR "\n\n"; while($age >= 0){ @@ -228,8 +229,6 @@ sub generate { }elsif($var <= 6){ $var = roll(10,1); if($var <= 5){ - #DEBUG - print "0: " . $_[0] . " 2: " . $_[2] . "\n"; my $ch = name($_[0],$_[1],$_[2]); printf $CHAR "You made a friend named [" . $ch . "](" . $ch . ".html).\n\n"; printf $CHAR table("They are like a big brother/sister to you.", "They are like a kid sister/brother to you.", "They are like a teacher or mentor.", "They are like a partner or co-worker.", "They're an old lover.", "They're an old enemy.", "They are like a foster parent to you.", "They're a relative.", "You've reconnected with an old childhood friend.", "You met through a common interest.", "Your relationship"); @@ -294,7 +293,7 @@ sub generate { } } }elsif($var <= 8){ - my $ch = name($_[0],$_[1],depth+1,0); + my $ch = name($_[0],$_[1],$_[2]); printf $CHAR "You had a romance! With someone named [" . $ch . "](" . $ch . ".html).\n\n"; printf $CHAR romance(); }elsif($var <=10){ @@ -335,24 +334,21 @@ sub name{ }else{ $flip = roll(10,1); } - print "Flip:" . $flip . "3:" . $_[3]; - if($flip >= 3){ - print " and entered\n"; + if($flip >= 3 || $_[2] < depth){ $name = File::Random::random_file(-dir=>"$ARGV[0]"); $name =~ s/.md$//g; - print "Target: " . $name . " Source: " . $_[1] . "\n"; if($name ne $_[1]){ $named = 1; } } - if($named > 0 && $name eq "" ){ + if($named == 0){ $name = `notwhoami|head -n1`; $name =~ s/ /_/g; + chomp($name); if($_[2] < depth){ generate($_[0], $name, $_[2]+1); } } - print $name . "\n"; return $name; }