This is a minimal solution. You'll need to EXAMINE lots of things for this solution to make sense. Some optional (but significant) commands are shown in parentheses. These can be omitted once you know what to do.
001 - W
002 - U
003 - D
004 - X CABIN (you find a pair of glasses)
005 - GET GLASSES
006 - (WEAR THEM) (the lenses are like magnifying glasses, so you take them off)
007 - U
008 - JUMP
009 - E
010 - S
011 - LOOK UNDER PLANK (you find a hook)
012 - GET HOOK
013 - E
014 - (X ANCHOR) (it's half submerged in the sand, you wonder if you could dig it out)
015 - DIG ANCHOR (or SEARCH ANCHOR) (you find a rope)
016 - GET ROPE
017 - TIE IT TO HOOK (now it looks like a grappling hook)
018 - W
019 - N
020 - N
021 - N
022 - E
023 - U
024 - GET STONE
025 - D
026 - W
027 - S
028 - E
029 - THROW ROPE OVER PALISADE
030 - U
031 - E
032 - (X CHEST) (it's closed)
033 - OPEN CHEST (it's locked by a heavy padlock)
034 - (X PADLOCK) (it's rusty)
035 - BREAK PADLOCK WITH STONE (it snaps and falls to the ground)
036 - (DROP STONE)
037 - OPEN CHEST (you find an old lantern)
038 - GET LANTERN
039 - W
040 - U
041 - W
042 - S
043 - S
044 - E
045 - (E) (it's pitch dark)
046 - (W)
047 - LIGHT LANTERN WITH GLASSES
048 - (DROP GLASSES)
049 - E
050 - (X PIRATE) (he's wearing pirate's clothes)
051 - GET CLOTHES
052 - (WEAR CLOTHES) (you have no reason to wear a dead pirate's clothes)
053 - Z (repeat until water raises you to ceiling, don't panic, you won't drown)
054 - (X CEILING) (you see a cavity)
055 - REACH INTO CAVITY (a parchment falls out)
056 - (GET PARCHMENT)
057 - (X IT) (it looks like a treasure map, maybe you should read it)
058 - READ PARCHMENT ('X' marks the spot)
059 - Z (repeat until water goes down)
060 - W
061 - W
062 - N
063 - N
064 - N
065 - N
066 - E
067 - N
068 - (X MAN) (he looks like a castaway)
069 - (TALK TO MAN)
070 - (ASK MAN ABOUT CASTAWAY, FIREPIT, FLIPPERS, GHOSTS, HIMSELF, KNIFE, ME, PIRATES, SCUBA GEAR, SHIPWRECK, TREASURE)
071 - WEAR CLOTHES (the castaway is frightened by your appearance and runs away)
072 - DROP LANTERN
073 - GET SCUBA
074 - WEAR IT
075 - GET FLIPPERS (you can't walk around while wearing them)
076 - S
077 - W
078 - S
079 - E
080 - U
081 - U
082 - WEAR FLIPPERS
083 - JUMP
084 - D
085 - IN
086 - GET TREASURE