From bafe3a95ef926f27df89d4ee3ed385c70480a8d0 Mon Sep 17 00:00:00 2001 From: silverwizard Date: Fri, 23 Aug 2019 23:30:15 -0400 Subject: [PATCH 01/10] Added symlinks for genders for later usage --- Cyberpunk.pl | 3 +++ 1 file changed, 3 insertions(+) diff --git a/Cyberpunk.pl b/Cyberpunk.pl index af20e7e..26252d7 100755 --- a/Cyberpunk.pl +++ b/Cyberpunk.pl @@ -7,6 +7,9 @@ use constant depth => 5; $ARGV[0] =~ s/ /_/g; mkdir $ARGV[0], 0755 unless -d $ARGV[0]; +foreach my $item ("Male", "Female", "Nonbinary", "Cyborg"){ + mkdir $ARGV[0] . "/" . $item,"0755" unless -d $ARGV[0] . "/" . $item; +} generate($ARGV[0], $ARGV[0], 1); sub generate { -- 2.37.3 From c0c5b6cf2cadf7d1554d0c08c5f29f39a37e8edd Mon Sep 17 00:00:00 2001 From: silverwizard Date: Fri, 23 Aug 2019 23:58:04 -0400 Subject: [PATCH 02/10] Fixed the table function to not suck --- Cyberpunk.pl | 53 ++++++---------------------------------------------- 1 file changed, 6 insertions(+), 47 deletions(-) diff --git a/Cyberpunk.pl b/Cyberpunk.pl index 26252d7..955245a 100755 --- a/Cyberpunk.pl +++ b/Cyberpunk.pl @@ -338,56 +338,15 @@ sub name{ sub table{ my $return; - $return = $_[10] . ": "; - my $var = roll(10,1); - SWITCH: { - $var == 1 && do { - $return = $return . $_[0]; - last SWITCH; - }; - $var == 2 && do { - $return = $return . $_[1]; - last SWITCH; - }; - $var == 3 && do { - $return = $return . $_[2]; - last SWITCH; - }; - $var == 4 && do { - $return = $return . $_[3]; - last SWITCH; - }; - $var == 5 && do { - $return = $return . $_[4]; - last SWITCH; - }; - $var == 6 && do { - $return = $return . $_[5]; - last SWITCH; - }; - $var == 7 && do { - $return = $return . $_[6]; - last SWITCH; - }; - $var == 8 && do { - $return = $return . $_[7]; - last SWITCH; - }; - $var == 9 && do { - $return = $return . $_[8]; - last SWITCH; - }; - $var == 10 && do { - $return = $return . $_[9]; - last SWITCH; - }; - } - $return = $return . "\n\n"; + my $length = scalar @_; + $return = $_[$length-1] . ": "; + my $var = roll($length-2,1); + $return = $return . $_[$var] . "\n\n"; return $return; } sub win{ my $return; - $return = $return . "You had a big win!\n\n"; + $return = "You had a big win!\n\n"; my $win = roll(10,1); SWITCH: { $win == 1 && do { @@ -446,7 +405,7 @@ sub win{ } sub romance{ - my $return; + my $return = ""; my $workedout = roll(10,1); if($workedout <= 4){ $return = $return . "You had a happy love affair, it worked out well\n\n"; -- 2.37.3 From ac3b888288f2bfa7063eab5b38aaea8796fbc5ba Mon Sep 17 00:00:00 2001 From: silverwizard Date: Sat, 24 Aug 2019 00:10:57 -0400 Subject: [PATCH 03/10] Added directories and symlinks to distinguish characters by gender to allow later usage --- Cyberpunk.pl | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/Cyberpunk.pl b/Cyberpunk.pl index 955245a..c2ff111 100755 --- a/Cyberpunk.pl +++ b/Cyberpunk.pl @@ -8,7 +8,7 @@ $ARGV[0] =~ s/ /_/g; mkdir $ARGV[0], 0755 unless -d $ARGV[0]; foreach my $item ("Male", "Female", "Nonbinary", "Cyborg"){ - mkdir $ARGV[0] . "/" . $item,"0755" unless -d $ARGV[0] . "/" . $item; + mkdir $ARGV[0] . "/" . $item unless -d $ARGV[0] . "/" . $item; } generate($ARGV[0], $ARGV[0], 1); @@ -33,6 +33,7 @@ sub generate { push(@ORIENTATION, $item); } } + symlink($_[0] . "/" . $_[1] . ".md", $_[0] . "/" . $GENDER . "/" . $_[1] . ".md"); printf $CHAR "Name: " . $_[1] . "\n\n"; printf $CHAR "INT: " . $INT . "\n"; -- 2.37.3 From d62540f8b5aad51fde446fcaca4cc56b8385355c Mon Sep 17 00:00:00 2001 From: silverwizard Date: Sat, 24 Aug 2019 00:23:24 -0400 Subject: [PATCH 04/10] Fixed so that gender is now tagged on all characters --- Cyberpunk.pl | 38 ++++++++++++++++++++------------------ 1 file changed, 20 insertions(+), 18 deletions(-) diff --git a/Cyberpunk.pl b/Cyberpunk.pl index c2ff111..efc4f2e 100755 --- a/Cyberpunk.pl +++ b/Cyberpunk.pl @@ -33,25 +33,11 @@ sub generate { push(@ORIENTATION, $item); } } - symlink($_[0] . "/" . $_[1] . ".md", $_[0] . "/" . $GENDER . "/" . $_[1] . ".md"); - printf $CHAR "Name: " . $_[1] . "\n\n"; - printf $CHAR "INT: " . $INT . "\n"; - printf $CHAR "REF: " . $REF . "\n"; - printf $CHAR "CL: " . $CL . "\n"; - printf $CHAR "TECH: " . $TECH . "\n"; - printf $CHAR "LK: " . $LK . "\n"; - printf $CHAR "ATT: " . $ATT . "\n"; - printf $CHAR "MA: " . $MA . "\n"; - printf $CHAR "EMP: " . $EMP . "\n"; - printf $CHAR "BT: " . $BT . "\n\n"; - printf $CHAR $GENDER; - printf $CHAR $SEX; - printf $CHAR "Orientation: "; - foreach my $item (@ORIENTATION) { - printf $CHAR $item . " "; - } - printf $CHAR "\n\n"; + $GENDER =~ s/^.*: //; + chomp($GENDER); + chomp($GENDER); + symlink($_[0] . "/" . $_[1] . ".md", $_[0] . "/" . $GENDER . "/" . $_[1] . ".md"); printf $CHAR table("Biker Leathers", "Blue Jeans", "Corporate Suits", "Jumpsuits", "Miniskirts", "High Fashion", "Cammos", "Normal Clothes", "Nude", "Bag Lady Chic", "Generally Wears"); printf $CHAR table("Mohawk", "Long & Ratty", "Short & Spiked", "Wild & all over", "Bald", "Stripped", "Tinted", "Neat, short", "Short, curly", "Long, straight", "Hair"); @@ -323,6 +309,22 @@ sub generate { } $age = $age-1; } + printf $CHAR "Name: " . $_[1] . "\n\n"; + printf $CHAR "INT: " . $INT . "\n"; + printf $CHAR "REF: " . $REF . "\n"; + printf $CHAR "CL: " . $CL . "\n"; + printf $CHAR "TECH: " . $TECH . "\n"; + printf $CHAR "LK: " . $LK . "\n"; + printf $CHAR "ATT: " . $ATT . "\n"; + printf $CHAR "MA: " . $MA . "\n"; + printf $CHAR "EMP: " . $EMP . "\n"; + printf $CHAR "BT: " . $BT . "\n\n"; + printf $CHAR $GENDER; + printf $CHAR $SEX; + printf $CHAR "Orientation: "; + foreach my $item (@ORIENTATION) { + printf $CHAR $item . " "; + } printf $CHAR "\n\n"; close($CHAR); } -- 2.37.3 From ab0e0ed3d024ed55224de5a3a658a4d9824779a9 Mon Sep 17 00:00:00 2001 From: Silverwizard Date: Tue, 27 Aug 2019 22:45:11 -0400 Subject: [PATCH 05/10] Added an intense amount of updates --- Cyberpunk.pl | 61 +++++++++++++++++++++++++++++++++------------------- 1 file changed, 39 insertions(+), 22 deletions(-) diff --git a/Cyberpunk.pl b/Cyberpunk.pl index efc4f2e..a9a0a45 100755 --- a/Cyberpunk.pl +++ b/Cyberpunk.pl @@ -1,6 +1,7 @@ #!/usr/local/bin/perl use strict; use warnings; +use File::Random qw/:all/; use constant depth => 5; @@ -68,8 +69,8 @@ sub generate { }else{ printf $CHAR " twin"; } - my $ch = name(); - printf $CHAR " sibling, named " . substr($ch, 0, -1) . " who "; + my $ch = name($_[0],$_[1],depth+1,0); + printf $CHAR " sibling, named " . $ch . " who "; $var = roll(10,1); if(($var == 1)||($var == 2)){ printf $CHAR "dislikes you\n\n"; @@ -86,7 +87,6 @@ sub generate { if(($var == 9)||($var == 10)){ printf $CHAR "hates you\n\n"; } - #generate($_[0] . "/" . substr(join('_', split(/ /,$ch)),0,-1), substr($ch,0,-1)); $i = $i - 1; } } @@ -151,7 +151,7 @@ sub generate { last SWITCH; }; $var == 6 && do { - printf $CHAR "Lover, friend, or relative killed. You lost someone you really cared about (named " . name() . ") "; + printf $CHAR "Lover, friend, or relative killed. You lost someone you really cared about (named " . name($_[0],$_[1],$_[2],0) . ") "; my $how = roll(10,1); if($how <= 5){ printf $CHAR "They died accidentally.\n\n"; @@ -228,18 +228,14 @@ sub generate { }elsif($var <= 6){ $var = roll(10,1); if($var <= 5){ - my $ch = name(); - printf $CHAR "You made a friend named [" . substr($ch,0,-1) . "](" . substr($ch,0,-1) . ".html).\n\n"; + #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"); - if($_[2] < depth){ - generate($_[0], substr($ch,0,-1), $_[2]+1); - } }else{ - my $ch = name(); - printf $CHAR "You made an enemy named [" . substr($ch,0,-1) . "](" . substr($ch,0,-1) . ".html).\n\n"; - if($_[2] < depth){ - generate($_[0], substr($ch,0,-1), $_[2]+1); - } + my $ch = name($_[0],$_[1],$_[2]); + printf $CHAR "You made an enemy named [" . $ch . "](" . $ch . ".html).\n\n"; printf $CHAR table("Ex friend.", "Ex lover.", "Relative.", "Childhood enemy.", "Person working for you.", "Person you work for.", "Partner or co-worker.", "Booster gang member.", "Corporate Exec.", "Government official.", "Who are they"); my $why = roll(10,1); SWITCH: { @@ -298,12 +294,9 @@ sub generate { } } }elsif($var <= 8){ - my $ch = name(); - printf $CHAR "You had a romance! With someone named [" . substr($ch,0,-1) . "](" . substr($ch,0,-1) . ".html).\n\n"; + my $ch = name($_[0],$_[1],depth+1,0); + printf $CHAR "You had a romance! With someone named [" . $ch . "](" . $ch . ".html).\n\n"; printf $CHAR romance(); - if($_[2] < depth){ - generate($_[0], substr($ch,0,-1), $_[2]+1); - } }elsif($var <=10){ printf $CHAR "You have an uneventful year\n\n"; } @@ -334,9 +327,33 @@ sub roll{ } sub name{ - my $name = `notwhoami|head -n1`; - $name =~ s/ /_/g; - return $name + my $name; + my $flip; + my $named = 0; + if(scalar @_ > 3){ + $flip = $_[3]; + }else{ + $flip = roll(10,1); + } + print "Flip:" . $flip . "3:" . $_[3]; + if($flip >= 3){ + print " and entered\n"; + $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 "" ){ + $name = `notwhoami|head -n1`; + $name =~ s/ /_/g; + if($_[2] < depth){ + generate($_[0], $name, $_[2]+1); + } + } + print $name . "\n"; + return $name; } sub table{ -- 2.37.3 From 286bc373d176f566adc26f14fefb0e61331b2161 Mon Sep 17 00:00:00 2001 From: Silverwizard Date: Wed, 28 Aug 2019 16:04:38 -0400 Subject: [PATCH 06/10] Fixed the issues with new directory structure --- tohtml.sh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/tohtml.sh b/tohtml.sh index 58f2fc1..052b0bf 100644 --- a/tohtml.sh +++ b/tohtml.sh @@ -1,4 +1,4 @@ -for char in `ls $1` +for char in `find $1 -maxdepth 1 -type f` do - markdown $1/$char > $1/`echo $char |sed 's/.md$/.html/'` + markdown $char > `echo $char |sed 's/.md$/.html/'` done -- 2.37.3 From 67bab9ba74aab951cab63402bb9d1db99895d55a Mon Sep 17 00:00:00 2001 From: Silverwizard Date: Wed, 28 Aug 2019 16:07:58 -0400 Subject: [PATCH 07/10] 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; } -- 2.37.3 From 526c6ddea6a71c1e3485e31a40881aea14225017 Mon Sep 17 00:00:00 2001 From: silverwizard Date: Fri, 30 Aug 2019 21:37:47 -0400 Subject: [PATCH 08/10] Addeda bunch of small fixes --- Cyberpunk.pl | 35 +++++++++++++++++++---------------- 1 file changed, 19 insertions(+), 16 deletions(-) diff --git a/Cyberpunk.pl b/Cyberpunk.pl index ce28de3..4c8876a 100755 --- a/Cyberpunk.pl +++ b/Cyberpunk.pl @@ -7,12 +7,13 @@ use constant depth => 10; $ARGV[0] =~ s/ /_/g; $ARGV[1] =~ s/ /_/g; +our @SEXES = ("Male", "Female", "Nonbinary", "Cyborg"); mkdir $ARGV[0], 0755 unless -d $ARGV[0]; -foreach my $item ("Male", "Female", "Nonbinary", "Cyborg"){ +foreach my $item (@SEXES){ mkdir $ARGV[0] . "/" . $item unless -d $ARGV[0] . "/" . $item; } -generate($ARGV[0], $ARGV[1], 1); +generate($ARGV[0], $ARGV[1], 1,@SEXES); sub generate { my $CHAR; @@ -27,10 +28,10 @@ sub generate { my $MA = roll(8,3); my $EMP = roll(8,3); my $BT = roll(8,3); - my $GENDER = table("Male", "Male", "Female", "Male", "Female", "Female", "Male", "Female", "Nonbinary", "Cyborg", "Gender"); + my $GENDER = $_[3][roll(scalar @_[3]-1,0)]; my $SEX = table($GENDER, $GENDER, $GENDER, "Male", "Male", "Female", "Male", "Female", "Female", "Male", "Female", "Nonbinary", "Cyborg", "Sex"); my @ORIENTATION; - foreach my $item ("Male", "Female", "Nonbinary", "Cyborg"){ + foreach my $item (@SEXES){ if(roll(2,1)>1){ push(@ORIENTATION, $item); } @@ -70,8 +71,10 @@ sub generate { }else{ printf $CHAR " twin"; } - my $ch = name($_[0],$_[1],0,0); - printf $CHAR " sibling, named " . $ch . " who "; + #my $ch = name($_[0],$_[1],0,0); + my $ch = name($_[0],$_[1],$_[2],@SEXES,0); + #printf $CHAR " sibling, named " . $ch . " who "; + printf $CHAR " sibling, named [" . $ch . "](" . $ch . ".html) who "; $var = roll(10,1); if(($var == 1)||($var == 2)){ printf $CHAR "dislikes you\n\n"; @@ -152,7 +155,7 @@ sub generate { last SWITCH; }; $var == 6 && do { - printf $CHAR "Lover, friend, or relative killed. You lost someone you really cared about (named " . name($_[0],$_[1],$_[2],0) . ") "; + printf $CHAR "Lover, friend, or relative killed. You lost someone you really cared about (named " . name($_[0],$_[1],$_[2],@SEXES,0) . ") "; my $how = roll(10,1); if($how <= 5){ printf $CHAR "They died accidentally.\n\n"; @@ -229,11 +232,11 @@ sub generate { }elsif($var <= 6){ $var = roll(10,1); if($var <= 5){ - my $ch = name($_[0],$_[1],$_[2]); + my $ch = name($_[0],$_[1],$_[2],@SEXES); 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"); }else{ - my $ch = name($_[0],$_[1],$_[2]); + my $ch = name($_[0],$_[1],$_[2],@SEXES); printf $CHAR "You made an enemy named [" . $ch . "](" . $ch . ".html).\n\n"; printf $CHAR table("Ex friend.", "Ex lover.", "Relative.", "Childhood enemy.", "Person working for you.", "Person you work for.", "Partner or co-worker.", "Booster gang member.", "Corporate Exec.", "Government official.", "Who are they"); my $why = roll(10,1); @@ -293,7 +296,7 @@ sub generate { } } }elsif($var <= 8){ - my $ch = name($_[0],$_[1],$_[2]); + my $ch = name($_[0],$_[1],$_[2],@ORIENTATION); printf $CHAR "You had a romance! With someone named [" . $ch . "](" . $ch . ".html).\n\n"; printf $CHAR romance(); }elsif($var <=10){ @@ -311,7 +314,7 @@ sub generate { printf $CHAR "MA: " . $MA . "\n"; printf $CHAR "EMP: " . $EMP . "\n"; printf $CHAR "BT: " . $BT . "\n\n"; - printf $CHAR $GENDER; + printf $CHAR "Gender: " . $GENDER . "\n"; printf $CHAR $SEX; printf $CHAR "Orientation: "; foreach my $item (@ORIENTATION) { @@ -329,12 +332,12 @@ sub name{ my $name; my $flip; my $named = 0; - if(scalar @_ > 3){ - $flip = $_[3]; + if(scalar @_ > 4){ + $flip = $_[4]; }else{ - $flip = roll(10,1); + $flip = roll(depth*2,1); } - if($flip >= 3 || $_[2] < depth){ + if($flip <= $_[2] || $_[2] > depth){ $name = File::Random::random_file(-dir=>"$ARGV[0]"); $name =~ s/.md$//g; if($name ne $_[1]){ @@ -346,7 +349,7 @@ sub name{ $name =~ s/ /_/g; chomp($name); if($_[2] < depth){ - generate($_[0], $name, $_[2]+1); + generate($_[0], $name, $_[2]+1,@SEXES); } } return $name; -- 2.37.3 From 171483672fd49738920323cffe24c9dd0c5681af Mon Sep 17 00:00:00 2001 From: Silverwizard Date: Fri, 30 Aug 2019 22:29:52 -0400 Subject: [PATCH 09/10] Last bug seems to be that asexual people can't have romances, fix this --- Cyberpunk.pl | 40 ++++++++++++++++++++++++---------------- 1 file changed, 24 insertions(+), 16 deletions(-) diff --git a/Cyberpunk.pl b/Cyberpunk.pl index 4c8876a..313668a 100755 --- a/Cyberpunk.pl +++ b/Cyberpunk.pl @@ -13,7 +13,7 @@ mkdir $ARGV[0], 0755 unless -d $ARGV[0]; foreach my $item (@SEXES){ mkdir $ARGV[0] . "/" . $item unless -d $ARGV[0] . "/" . $item; } -generate($ARGV[0], $ARGV[1], 1,@SEXES); +generate($ARGV[0], $ARGV[1], 1,\@SEXES); sub generate { my $CHAR; @@ -28,7 +28,9 @@ sub generate { my $MA = roll(8,3); my $EMP = roll(8,3); my $BT = roll(8,3); - my $GENDER = $_[3][roll(scalar @_[3]-1,0)]; + my @POSSEX = $_[3]->[0]; + my $genderroll = roll(scalar @POSSEX-1,0); + my $GENDER = $POSSEX[$genderroll]; my $SEX = table($GENDER, $GENDER, $GENDER, "Male", "Male", "Female", "Male", "Female", "Female", "Male", "Female", "Nonbinary", "Cyborg", "Sex"); my @ORIENTATION; foreach my $item (@SEXES){ @@ -40,7 +42,7 @@ sub generate { $GENDER =~ s/^.*: //; chomp($GENDER); chomp($GENDER); - symlink($_[0] . "/" . $_[1] . ".md", $_[0] . "/" . $GENDER . "/" . $_[1] . ".md"); + symlink("../" . "/" . $_[1] . ".md", "./" . $_[0] . "/" . $GENDER . "/" . $_[1] . ".md"); printf $CHAR table("Biker Leathers", "Blue Jeans", "Corporate Suits", "Jumpsuits", "Miniskirts", "High Fashion", "Cammos", "Normal Clothes", "Nude", "Bag Lady Chic", "Generally Wears"); printf $CHAR table("Mohawk", "Long & Ratty", "Short & Spiked", "Wild & all over", "Bald", "Stripped", "Tinted", "Neat, short", "Short, curly", "Long, straight", "Hair"); @@ -72,7 +74,7 @@ sub generate { printf $CHAR " twin"; } #my $ch = name($_[0],$_[1],0,0); - my $ch = name($_[0],$_[1],$_[2],@SEXES,0); + my $ch = name($_[0],$_[1],$_[2],\@SEXES,1); #printf $CHAR " sibling, named " . $ch . " who "; printf $CHAR " sibling, named [" . $ch . "](" . $ch . ".html) who "; $var = roll(10,1); @@ -155,7 +157,7 @@ sub generate { last SWITCH; }; $var == 6 && do { - printf $CHAR "Lover, friend, or relative killed. You lost someone you really cared about (named " . name($_[0],$_[1],$_[2],@SEXES,0) . ") "; + printf $CHAR "Lover, friend, or relative killed. You lost someone you really cared about (named " . name($_[0],$_[1],$_[2],\@SEXES,1) . ") "; my $how = roll(10,1); if($how <= 5){ printf $CHAR "They died accidentally.\n\n"; @@ -232,11 +234,11 @@ sub generate { }elsif($var <= 6){ $var = roll(10,1); if($var <= 5){ - my $ch = name($_[0],$_[1],$_[2],@SEXES); + my $ch = name($_[0],$_[1],$_[2],\@SEXES); 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"); }else{ - my $ch = name($_[0],$_[1],$_[2],@SEXES); + my $ch = name($_[0],$_[1],$_[2],\@SEXES); printf $CHAR "You made an enemy named [" . $ch . "](" . $ch . ".html).\n\n"; printf $CHAR table("Ex friend.", "Ex lover.", "Relative.", "Childhood enemy.", "Person working for you.", "Person you work for.", "Partner or co-worker.", "Booster gang member.", "Corporate Exec.", "Government official.", "Who are they"); my $why = roll(10,1); @@ -296,7 +298,7 @@ sub generate { } } }elsif($var <= 8){ - my $ch = name($_[0],$_[1],$_[2],@ORIENTATION); + my $ch = name($_[0],$_[1],$_[2],\@ORIENTATION); printf $CHAR "You had a romance! With someone named [" . $ch . "](" . $ch . ".html).\n\n"; printf $CHAR romance(); }elsif($var <=10){ @@ -332,13 +334,19 @@ sub name{ my $name; my $flip; my $named = 0; - if(scalar @_ > 4){ - $flip = $_[4]; - }else{ - $flip = roll(depth*2,1); - } - if($flip <= $_[2] || $_[2] > depth){ - $name = File::Random::random_file(-dir=>"$ARGV[0]"); + my @POSSEX = $_[3]->[0]; + my $genderroll = roll(scalar @POSSEX-1,0); + my $GENDER = $POSSEX[$genderroll]; + $flip = roll(depth*2,1); + if($flip <= $_[2] || $_[2] > depth || defined $_[4] ){ + my $dir = "./" . $ARGV[0] . "/" . $GENDER; + print "Dir: ". $dir . "\n"; + $name = File::Random::random_file( + -dir => "$dir", + -follow => 1, + -recursive => 1 + ); + print "Name: " . $name . "\n"; $name =~ s/.md$//g; if($name ne $_[1]){ $named = 1; @@ -349,7 +357,7 @@ sub name{ $name =~ s/ /_/g; chomp($name); if($_[2] < depth){ - generate($_[0], $name, $_[2]+1,@SEXES); + generate($_[0], $name, $_[2]+1,\@POSSEX); } } return $name; -- 2.37.3 From 0d185b281eba06bbaf8e597e088335a96ec07062 Mon Sep 17 00:00:00 2001 From: silverwizard Date: Sun, 1 Sep 2019 23:46:07 -0400 Subject: [PATCH 10/10] ok! I did the needful! --- Cyberpunk.pl | 32 ++++++++++++++------------------ 1 file changed, 14 insertions(+), 18 deletions(-) diff --git a/Cyberpunk.pl b/Cyberpunk.pl index 313668a..a4f9aa5 100755 --- a/Cyberpunk.pl +++ b/Cyberpunk.pl @@ -3,7 +3,7 @@ use strict; use warnings; use File::Random qw/:all/; -use constant depth => 10; +use constant depth => 5; $ARGV[0] =~ s/ /_/g; $ARGV[1] =~ s/ /_/g; @@ -28,8 +28,9 @@ sub generate { my $MA = roll(8,3); my $EMP = roll(8,3); my $BT = roll(8,3); - my @POSSEX = $_[3]->[0]; - my $genderroll = roll(scalar @POSSEX-1,0); + my @POSSEX = @{ $_[3] }; + my $genderroll = roll(scalar @POSSEX,1); + $genderroll = $genderroll -1; my $GENDER = $POSSEX[$genderroll]; my $SEX = table($GENDER, $GENDER, $GENDER, "Male", "Male", "Female", "Male", "Female", "Female", "Male", "Female", "Nonbinary", "Cyborg", "Sex"); my @ORIENTATION; @@ -38,10 +39,6 @@ sub generate { push(@ORIENTATION, $item); } } - - $GENDER =~ s/^.*: //; - chomp($GENDER); - chomp($GENDER); symlink("../" . "/" . $_[1] . ".md", "./" . $_[0] . "/" . $GENDER . "/" . $_[1] . ".md"); printf $CHAR table("Biker Leathers", "Blue Jeans", "Corporate Suits", "Jumpsuits", "Miniskirts", "High Fashion", "Cammos", "Normal Clothes", "Nude", "Bag Lady Chic", "Generally Wears"); @@ -73,10 +70,8 @@ sub generate { }else{ printf $CHAR " twin"; } - #my $ch = name($_[0],$_[1],0,0); my $ch = name($_[0],$_[1],$_[2],\@SEXES,1); - #printf $CHAR " sibling, named " . $ch . " who "; - printf $CHAR " sibling, named [" . $ch . "](" . $ch . ".html) who "; + printf $CHAR " sibling, named " . $ch . " who "; $var = roll(10,1); if(($var == 1)||($var == 2)){ printf $CHAR "dislikes you\n\n"; @@ -334,21 +329,21 @@ sub name{ my $name; my $flip; my $named = 0; - my @POSSEX = $_[3]->[0]; + my @POSSEX = @{ $_[3] }; + if (scalar @POSSEX == 0){ + @POSSEX = @SEXES; + } my $genderroll = roll(scalar @POSSEX-1,0); my $GENDER = $POSSEX[$genderroll]; - $flip = roll(depth*2,1); - if($flip <= $_[2] || $_[2] > depth || defined $_[4] ){ + $flip = roll(depth*1.5,1); + if($flip <= $_[2] && $_[2] < depth && !defined $_[4] ){ my $dir = "./" . $ARGV[0] . "/" . $GENDER; - print "Dir: ". $dir . "\n"; $name = File::Random::random_file( -dir => "$dir", -follow => 1, -recursive => 1 ); - print "Name: " . $name . "\n"; - $name =~ s/.md$//g; - if($name ne $_[1]){ + if($name ne $_[1] && $name ne ""){ $named = 1; } } @@ -356,10 +351,11 @@ sub name{ $name = `notwhoami|head -n1`; $name =~ s/ /_/g; chomp($name); - if($_[2] < depth){ + if($_[2] < depth && !defined $_[4]){ generate($_[0], $name, $_[2]+1,\@POSSEX); } } + $name =~ s/.md$//g; return $name; } -- 2.37.3