
treasure map coding
| View previous topic :: View next topic |
| Author |
Message |
parksbanyon

Gunner 
Posts: 564 

 
13127 Gold -

|
Posted: Wed Apr 23, 2014 9:52 pm Post subject: code insertion |
|
|
Can't figure out where to put AdamMil's code. |
|
| Back to top |
|
 |
AdamMil

Cutthroat 
Posts: 279 

 
4759 Gold -

|
Posted: Wed Apr 23, 2014 10:36 pm Post subject: Re: code insertion |
|
|
| parksbanyon wrote: | | Can't figure out where to put AdamMil's code. | Jslangdo should really answer this, but from memory, you should:- Find the two arrays by searching for "Governor" or whatever, and replace them with mine.
- Search for something like "decode_landmark" or "translate_landmark" or something. That function needs to be modified, but it's not as simple as copying/pasting the last three lines into it because it has a minor bug or two that needs to be fixed first. ($x and $y aren't parsed correctly, IIRC.) Also the flow control needs to be tweaked. If you know Perl, it's not hard. Otherwise, let me know and if jslagndo doesn't reply before then I'll reply later after I get back home.
|
|
| Back to top |
|
 |
AdamMil

Cutthroat 
Posts: 279 

 
4759 Gold -

|
Posted: Sat May 03, 2014 11:24 pm Post subject: |
|
|
Sorry, it seems I forgot to go home... Anyway, find the code in jslangdo's save editor 1.43 or later that says | Code: | my @landmark_names = qw(Skull Governor Hangman's Cutthroat Captain's Cutlas Rum Powder Knife Thunder Blade Black Jellyfish Dagger Devil's Shark Lookout Blood Anchor Gallows );
my @landmark_nouns = qw(Reef Point Shallows Stone Cape Head Rock);
sub translate_landmark {
my ($string, $x, $y) = @_;
if (length $string != 2) { return; }
my $retval = "??";
if ($landmarks{$string}) { return $landmarks{$string}; }
if ($retval eq "Landmark") {
my $offset = ($x - $y + 40000) % 20;
return $landmark_names[$offset] . " " . $retval;
}
} |
and replace it with
| Code: | my @landmark_adjectives = qw(
Skull Blood Devil's Black Knife Cutlass Hangman's Gallows Lookout Dagger Blade
Powder Captain's Governor Anchor Shark Jellyfish Thunder Rum Cutthroat);
my @landmark_nouns = qw(Rock Point Stone Head Reef Shallows Cape);
sub translate_landmark {
my ($string, $x, $y) = @_;
if (length $string != 2) { return; }
my $retval = $landmarks{$string} || "??";
if ($retval eq "Landmark") {
$x =~ s/^[^_]+_//s;
my $n = ($x*33 + $y*47) % 1000;
my $adjective = $landmark_adjectives[$n % 20];
my $noun = $landmark_nouns[$n / 20 % 7];
$retval = "$adjective $noun $retval";
}
return $retval;
} |
Jslangdo might have integrated it a bit differently, but I think this should work. (The formula worked when I first tested it weeks (months?) ago, but it's possible I've misremembered how to integrate it into the editor.) Let me know if you have any trouble. |
|
| Back to top |
|
 |
parksbanyon

Gunner 
Posts: 564 

 
13127 Gold -

|
Posted: Mon May 12, 2014 1:55 am Post subject: reply |
|
|
Will do, and let you know. Thanks! |
|
| Back to top |
|
 |
|
|
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
|
Powered by phpBB © 2001, 2005 phpBB Group
|
|