Skip to content

Instantly share code, notes, and snippets.

@pancelor
Created June 26, 2020 02:15
Show Gist options
  • Save pancelor/80810c5e40734af2296380fa907ed3e8 to your computer and use it in GitHub Desktop.
Save pancelor/80810c5e40734af2296380fa907ed3e8 to your computer and use it in GitHub Desktop.
Sock Friends (PuzzleScript Script)
Play this game by pasting the script in http://www.puzzlescript.net/editor.html
title Sock Friends
author pancelor
homepage www.twitter.com/pancelor
(noaction) (debug; activative this at ship)
again_interval 0.05
run_rules_on_level_start
realtime_interval 0.50
(verbose_logging)
========
OBJECTS
========
_0
white
00000
0..00
0.0.0
00..0
00000
_1
white
000..
..0..
..0..
..0..
00000
_2
white
00000
....0
00000
0....
00000
_3
white
0000.
....0
..00.
....0
0000.
_4
white
0....
0....
0..0.
00000
...0.
_5
white
00000
0....
0000.
....0
0000.
_6
white
.000.
0....
0000.
0...0
.000.
_7
white
00000
....0
...0.
..0..
.0...
_8
white
.000.
0...0
.000.
0...0
.000.
_9
white
.000.
0...0
.0000
....0
.000.
Dryer
white lightgray gray darkgray black
11141
12321
13031
12321
11111
UnmatchedSock
#F4F4F4 #BA091D gray (red)
000..
111..
000..
00001
20001
MatchedSock
#F4F4F4 #0071B2 gray (blue)
000..
111..
000..
00001
20001
StringH0
black
.....
.....
0.0.0
.....
.....
StringH1
black
.....
.....
.0.0.
.....
.....
StringV0
black
..0..
.....
..0..
.....
..0..
StringV1
black
.....
..0..
.....
..0..
.....
mTooClose
darkred transparent
...01
...01
...00
.....
.....
mTooClose2
lightred transparent
...01
...01
...00
.....
.....
mTooCloseR
darkred transparent
.....
1....
01...
01...
01...
mTooCloseR2
lightred transparent
.....
1....
01...
01...
01...
mTooCloseL
darkred transparent
...10
...10
...10
...10
...10
mTooCloseL2
lightred transparent
...10
...10
...10
...10
...10
mTooCloseU
darkred transparent
.....
.....
.....
1111.
00001
mTooCloseU2
lightred transparent
.....
.....
.....
1111.
00001
mTooCloseD
darkred transparent
00000
11111
.....
.....
.....
mTooCloseD2
lightred transparent
00000
11111
.....
.....
.....
mTooCloseUL
darkred transparent
.....
.....
.....
....1
...10
mTooCloseUL2
lightred transparent
.....
.....
.....
....1
...10
mTooCloseUR
darkred transparent
.....
.....
.....
.....
.....
mTooCloseUR2
lightred transparent
.....
.....
.....
.....
.....
mTooCloseDL
darkred transparent
...10
....1
.....
.....
.....
mTooCloseDL2
lightred transparent
...10
....1
.....
.....
.....
mTooCloseDR
darkred transparent
01...
1....
.....
.....
.....
mTooCloseDR2
lightred transparent
01...
1....
.....
.....
.....
Background
#F4D63F #EDB83D
00100
01110
11011
01110
00100
(
Player
black orange white blue
.000.
.111.
22222
.333.
.3.3.
)
Player
#F2BDF9 #FFEDD0 #C18BD1 #181466
.000.
01110
22222
03330
.3.3.
(
Player
transparent #9D836D #5C4D51 #404040
1.1.2
222.1
23212
.1111
.31.1
)
Crate
#AA6853 #E0AE9F #DB856B
00000
01110
01110
01110
00000
Wall
brown darkbrown #316312
00010
11111
01000
11111
00010
Vines1
#316312
.0...
..0..
..0..
...0.
.0...
Vines2
#316312
00...
.0...
..00.
00..0
..000
Vines3
#316312
.0..0
...0.
.0...
...0.
0..0.
Vines4
#316312
0...0
.0.0.
...00
.00..
.0...
Sky0
#89C3E5
GlassCrate
#AA6853 white
00000
0.1.0
01..0
0..10
00000
Window
darkgray white
1....
....1
...1.
..1..
.1...
WindowBorderL
darkgray white
0....
0....
0....
0....
0....
WindowBorderR
darkgray white
....0
....0
....0
....0
....0
WindowBorderU
darkgray white
00000
.....
.....
.....
.....
WindowBorderD
darkgray white
.....
.....
.....
.....
00000
mMatchProbeR
yellow
mMatchProbeL
yellow
mMatchProbeU
yellow
mMatchProbeD
yellow
mWasMatchedMoving
red
mWasMatchedStationary
red
mDiagProbe
red
mDiagProbeTriggered
red
mStringProbeL0
red
mStringProbeL1
red
mStringProbeR0
red
mStringProbeR1
red
mStringProbeU0
red
mStringProbeU1
red
mStringProbeD0
red
mStringProbeD1
red
mWin
transparent
mTimer0
transparent
mTimer1
transparent
mTimerTemp
transparent
mFlashTooClose
transparent
mResetEditor
transparent
=======
LEGEND
=======
. = Background
* = Sky0
# = Wall
@ = Player and mTimerTemp
c = Crate
g = GlassCrate
w = Window
s = UnmatchedSock
(only here for level editing convenience:)
m = MatchedSock
& = Player
0 = _0 and Sky0 (debug; change to (_0 and) Sky0 at ship?)
1 = _1 and Sky0
2 = _2 and Sky0
3 = _3 and Sky0
4 = _4 and Sky0
5 = _5 and Sky0
6 = _6 and Sky0
7 = _7 and Sky0
8 = _8 and Sky0
9 = _9 and Sky0
cSock = UnmatchedSock or MatchedSock
cPushable = cSock or Crate or Player or GlassCrate
cMatchProbe = mMatchProbeL or mMatchProbeR or mMatchProbeU or mMatchProbeD
cVines = Vines1 or Vines2 or Vines3 or Vines4
cSky = Sky0
cSockTestBlocker = Wall or Crate or Player or cSock
cTooClose = mTooClose or mTooCloseL or mTooCloseR or mTooCloseU or mTooCloseD or mTooCloseUL or mTooCloseUR or mTooCloseDL or mTooCloseDR or mTooClose2 or mTooCloseL2 or mTooCloseR2 or mTooCloseU2 or mTooCloseD2 or mTooCloseUL2 or mTooCloseUR2 or mTooCloseDL2 or mTooCloseDR2
cStringH = StringH0 or StringH1
cStringV = StringV0 or StringV1
cString = cStringH or cStringV
cStringProbeH = mStringProbeL0 or mStringProbeL1 or mStringProbeR0 or mStringProbeR1
cStringProbeV = mStringProbeU0 or mStringProbeU1 or mStringProbeD0 or mStringProbeD1
cStringProbe = cStringProbeH or cStringProbeV
cWindowBorder = WindowBorderL or WindowBorderR or WindowBorderU or WindowBorderD
cTimerNonStartup = mTimer0 or mTimer1
cNumber = _0 or _1 or _2 or _3 or _4 or _5 or _6 or _7 or _8 or _9
cText = cNumber (or cLetter)
=======
SOUNDS
=======
Crate MOVE 36772507
cSock MOVE 41144707
cancel 87775304
sfx0 84149500
(ty to stephen for the sound recommendation)
sfx1 9675111
(sfx1 22057104)
EndLevel 3994900
================
COLLISIONLAYERS
================
(visual)
Background
cSky
Player, Wall, Window, Crate, GlassCrate, cSock
Dryer
cVines
WindowBorderL
WindowBorderR
WindowBorderU
WindowBorderD
cStringH
cStringV
mTooClose, mTooClose2
mTooCloseU, mTooCloseU2
mTooCloseD, mTooCloseD2
mTooCloseR, mTooCloseR2
mTooCloseL, mTooCloseL2
mTooCloseUL, mTooCloseUL2
mTooCloseUR, mTooCloseUR2
mTooCloseDL, mTooCloseDL2
mTooCloseDR, mTooCloseDR2
cText
(non-visual)
mTimerTemp, mTimer0, mTimer1
mFlashTooClose
mResetEditor
mDiagProbe
mDiagProbeTriggered
mWasMatchedMoving
mWasMatchedStationary
cStringProbeH
cStringProbeV
cMatchProbe
mWin
======
RULES
======
(startup wall randomization)
startloop
random [Wall no cVines] -> [Wall Vines1]
random [Wall no cVines] -> [Wall Vines2]
random [Wall no cVines] -> [Wall Vines3]
random [Wall no cVines] -> [Wall Vines4]
endloop
(win until proven otherwise)
[Player] -> [Player mWin]
(push stuff)
[ > cPushable | cPushable ] -> [ > cPushable | > cPushable ]
(socks wont move it it will unmatch them; track whether they were matched beforehand)
[ > MatchedSock ] -> [ > MatchedSock > mWasMatchedMoving ]
[ > mWasMatchedMoving | Wall ] -> [ mWasMatchedMoving | Wall ]
[ > mWasMatchedMoving | Window ] -> [ mWasMatchedMoving | Window ]
[ stationary MatchedSock ] -> [ MatchedSock mWasMatchedStationary ]
(
recalculate matched socks
shoot out MatchProbe marks from each sock; when they hit an unmatched sock it becomes matched
)
[cSock] -> [UnmatchedSock]
(Left)
late Left [cSock] -> [cSock mMatchProbeL]
late Left [mMatchProbeL | no cSockTestBlocker] -> [ | mMatchProbeL]
late Left [mMatchProbeL | cSock] -> [ mStringProbeR0 | MatchedSock]
(Right)
late Right [cSock] -> [cSock mMatchProbeR]
late Right [mMatchProbeR | no cSockTestBlocker] -> [ | mMatchProbeR]
late Right [mMatchProbeR | cSock] -> [ mStringProbeL0 | MatchedSock]
(Up)
late Up [cSock] -> [cSock mMatchProbeU]
late Up [mMatchProbeU | no cSockTestBlocker] -> [ | mMatchProbeU]
late Up [mMatchProbeU | cSock] -> [ mStringProbeD0 | MatchedSock]
(Down)
late Down [cSock] -> [cSock mMatchProbeD]
late Down [mMatchProbeD | no cSockTestBlocker] -> [ | mMatchProbeD]
late Down [mMatchProbeD | cSock] -> [ mStringProbeU0 | MatchedSock]
late [cMatchProbe] -> []
(notice unpairing)
late [mWasMatchedMoving no MatchedSock] -> cancel
(notice new pairs)
late [cTimerNonStartup][MatchedSock no mWasMatchedMoving no mWasMatchedStationary] -> sfx0
late [cTimerNonStartup][UnmatchedSock mWasMatchedStationary] -> sfx1
late [mWasMatchedMoving] -> []
late [mWasMatchedStationary] -> []
(draw window Borders)
late [cWindowBorder] -> []
late Left [Window | no Window] -> [Window WindowBorderL | ]
late Right [Window | no Window] -> [Window WindowBorderR | ]
late Up [Window | no Window] -> [Window WindowBorderU | ]
late Down [Window | no Window] -> [Window WindowBorderD | ]
(connect matched socks with String)
[cString] -> []
(Left)
late Left [mStringProbeL0 no cSockTestBlocker | ] -> [StringH0 | mStringProbeL1]
+late Left [mStringProbeL1 no cSockTestBlocker | ] -> [StringH1 | mStringProbeL0]
late Left [mStringProbeL0] -> []
late Left [mStringProbeL1] -> []
(Right)
late Right [mStringProbeR0 no cSockTestBlocker | ] -> [StringH0 | mStringProbeR1]
+late Right [mStringProbeR1 no cSockTestBlocker | ] -> [StringH1 | mStringProbeR0]
late Right [mStringProbeR0] -> []
late Right [mStringProbeR1] -> []
(Up)
late Up [mStringProbeU0 no cSockTestBlocker | ] -> [StringV0 | mStringProbeU1]
+late Up [mStringProbeU1 no cSockTestBlocker | ] -> [StringV1 | mStringProbeU0]
late Up [mStringProbeU0] -> []
late Up [mStringProbeU1] -> []
(Down)
late Down [mStringProbeD0 no cSockTestBlocker | ] -> [StringV0 | mStringProbeD1]
+late Down [mStringProbeD1 no cSockTestBlocker | ] -> [StringV1 | mStringProbeD0]
late Down [mStringProbeD0] -> []
late Down [mStringProbeD1] -> []
late [cStringProbe] -> []
(check for socks too close together)
late [cTooClose] -> []
(orthogonal)
late [cSock | cSock] -> [cSock mTooClose | cSock mTooClose]
(diagonal)
late Horizontal [cSock | ] -> [cSock | mDiagProbe]
late Vertical [mDiagProbe | cSock] -> [mDiagProbeTriggered mDiagProbe | cSock mTooClose]
late Horizontal [cSock | mDiagProbeTriggered] -> [cSock mTooClose | ]
late [mDiagProbe] -> []
late [mDiagProbeTriggered] -> []
(draw)
late Left [mTooClose | ] -> [mTooClose | mTooCloseL]
late Right [mTooClose | ] -> [mTooClose | mTooCloseR]
late Up [mTooClose | ] -> [mTooClose | mTooCloseU]
late Down [mTooClose | ] -> [mTooClose | mTooCloseD]
late Right [ | mTooCloseU | ] -> [mTooCloseUL | mTooCloseU | mTooCloseUR]
late Right [ | mTooCloseD | ] -> [mTooCloseDL | mTooCloseD | mTooCloseDR]
(win checking + flashing cTooClose)
late [mWin][UnmatchedSock] -> [][UnmatchedSock]
(this line flashes always)
(late [mTimer0][cTooClose] -> [mTimer0 mFlashTooClose][cTooClose])
(this line only flashes when cTooClose is the only thing preventing a win)
late [mTimer0][mWin][cTooClose] -> [mTimer0 mFlashTooClose][mWin][cTooClose]
late [mWin][cTooClose] -> [][cTooClose]
late [mTimer0] -> [mTimerTemp]
late [mTimer1] -> [mTimer0]
late [mTimerTemp] -> [mTimer1]
late [mFlashTooClose][mTooClose] -> [mFlashTooClose][mTooClose2]
late [mFlashTooClose][mTooCloseU] -> [mFlashTooClose][mTooCloseU2]
late [mFlashTooClose][mTooCloseD] -> [mFlashTooClose][mTooCloseD2]
late [mFlashTooClose][mTooCloseR] -> [mFlashTooClose][mTooCloseR2]
late [mFlashTooClose][mTooCloseL] -> [mFlashTooClose][mTooCloseL2]
late [mFlashTooClose][mTooCloseUL] -> [mFlashTooClose][mTooCloseUL2]
late [mFlashTooClose][mTooCloseUR] -> [mFlashTooClose][mTooCloseUR2]
late [mFlashTooClose][mTooCloseDL] -> [mFlashTooClose][mTooCloseDL2]
late [mFlashTooClose][mTooCloseDR] -> [mFlashTooClose][mTooCloseDR2]
late [mFlashTooClose] -> []
(for level exporting; debug; remove at ship)
[action Player] -> [Player mResetEditor] sfx0
late [mResetEditor][cVines] -> [mResetEditor][]
late [mResetEditor][MatchedSock] -> [mResetEditor][UnmatchedSock]
late [mResetEditor][mTimer0] -> [mResetEditor][]
late [mResetEditor][mTimer1] -> [mResetEditor][]
late [mResetEditor][Player] -> [mResetEditor][Player mTimerTemp]
(remove visual stuff; not technically necessary)
late [mResetEditor][cTooClose] -> [mResetEditor][]
late [mResetEditor][cString] -> [mResetEditor][]
late [mResetEditor][cWindowBorder] -> [mResetEditor][]
(finish)
late [mResetEditor] -> []
==============
WINCONDITIONS
==============
any mWin
=======
LEVELS
=======
(
********************
*##################*
*#........#.......#*
*#......@...s...s.#*
*#...s............#*
*#....c...#.......#*
*#.s..#...#...cs###*
*#.....s..#.s...#s#*
*#........#.....#s#*
*#wwww##....#######*
*#................#*
*#..w..w..........#*
*##.www###........#*
*#s..wwws#........#*
*##################*
********************
)
message 1/n: socks want to be matched
10************
********#####*
*######*#...#*
*#....###.s.#*
*#.@.s#.....#*
*#s...#s....#*
*###....#####*
***######*****
**************
message 1/n: socks don't want to be alone
20**********
*########***
*#...#..#***
*#.#s..s###*
*#s#.#....#*
*#..@#...s#*
*##########*
************
30***********
****######***
*####....#***
*#..#...s#***
*#..#..#####*
*#s........#*
*#..#...#.@#*
*####.....s#*
****#.#s#..#*
****#...####*
****#####****
*************
message 1/n: crates get in the way
40*************
******###******
****###.###****
*####s...s####*
*#s....c....s#*
*###s.....s###*
***####@####***
******###******
***************
50*********
*#######***
*#s....#***
*#...c.#***
*###...#***
***#s.s#***
***#...###*
***#.@...#*
***#....s#*
***#######*
***********
message 1/n: animals with three feet need matching socks too
60***********
*****#####***
*#####...#***
*#..##.s.#***
*#@.##...#***
*#...##.####*
*##.s......#*
**#..#...#.#*
**#..#...s.#*
**##########*
*************
110********
***####****
***#..#****
**##.s####*
**#....s.#*
**#.@..#.#*
*##s#..s.#*
*#.....###*
*#..#...#**
*#..#..s#**
*#####..#**
*****####**
***********
70**********
*#####******
*#...#**###*
*#.s.##*#s#*
*#....###.#*
*#..@....s#*
*#......###*
*####....s#*
****#...###*
****#.s.#***
****#####***
************
80**********
******#####*
****###..s#*
*####...#.#*
*#........#*
*#.s#...#.#*
*#.@#.s...#*
*##########*
************
message 1/n: socks need some personal space
90********
****#####*
*####.s.#*
*#@##...#*
*#.#....#*
*#.s.s..#*
*##....##*
**######**
**********
100*******
*****###**
**####s#**
**#....#**
**#.s..#**
*##...s#**
*##....#**
*#....##**
*#s....#**
*#...@.##*
*#.....s#*
*#s#....#*
*########*
**********
message 1/n: didn't I already match these socks?
61***********
*****#####***
*#####...#***
*#..##.s.#***
*#@.##...#***
*#...##.####*
*##.s......#*
**#..#...#.#*
**#..#....s#*
**##########*
*************
101*******
*****###**
**####s#**
**#....#**
**#.s..#**
*##...s#**
*##....#**
*#....##**
*#s....#**
*#..@..##*
*#......#*
*#s#..s.#*
*########*
**********
51*******
*######**
*#s...#**
*##...#**
**#s..#**
**#.@.#**
**#..s#**
**#...##*
**#...s#*
**######*
*********
62*********
****#####**
****#...#**
*####.s.##*
*#..#....#*
*#.@##.#.#*
*#.s.....#*
*####..###*
****#...s#*
****######*
***********
102*******
*****###**
**####s#**
**#....#**
**#.s..#**
*##...s#**
*#.....#**
*#....##**
*#s....#**
*#...@.##*
*#......#*
*#s#...s#*
*########*
**********
63*********
***######**
***#..s.#**
***#....#**
***#....#**
*#####.##**
*#...#.#***
*#.s...###*
*####....#*
****#@..s#*
****######*
***********
message 1/n: socks love windows
120*********
**#########*
**#.......#*
**#.s.###.#*
**#...#...#*
**#...w.s.#*
**#.@.w...#*
*##...w.s.#*
*#s...#...#*
*##########*
************
(very similar to another level im trying to make near start)
130********
**#####****
**#s..#****
*###..###**
*#.w..w.#**
*#.w..w.#**
*#.w..w.#**
*#sw.sws#**
*#.#c@#.#**
*#......#**
*########**
***********
140**********
*###########*
*#.........#*
*#.s.##...s#*
*#...#.....#*
*#.@.#...###*
*###s..s.#***
*#...#...#***
*#s..#####***
*#...#*******
*#####*******
*************
190************
***#######*****
***#.....#*****
*###...s.#*****
*#s.s.#####****
*###..#...#****
*#s...#.s.#****
*###..#...#****
**#...##.#####*
**#......#...#*
**#.@......s.#*
**#......#...#*
**############*
***************
121*********
**#########*
**#.......#*
**#.s.###.#*
**#...w...#*
**#...w.s.#*
**#.@.w...#*
*##...w.s.#*
*#s...#...#*
*##########*
************
91***********
*#####*******
*#@..#######*
*##s.##...##*
*#..##...s.#*
*#..s....#.#*
*#####.....#*
*****#######*
*************
message 1/n: socks like glass crates
(are glass crates useful design elements? idk)
150***********
*######*******
*#....#######*
*#.@.g##....#*
*#..sc.....s#*
*###..#..####*
***#s##..#****
***###.s.#****
*****#...#****
*****#####****
**************
160*********
*######*****
*#.@..#*****
*#swws#*****
*#cwwg#*****
*#swws#*****
*#....#*****
*#....#####*
*#....wwws#*
*#....www##*
*#....wwws#*
*##########*
************
170**********
*###########*
*#.s.......#*
*#...@.....#*
*#....s.s..#*
*#.........#*
*#s.s#s.s#s#*
*###########*
*************
180**********
******#####**
**#####...#**
*##..s#.s.##*
*#s.......s#*
*#..#......#*
*#..#..@..s#*
*#..#......#*
*#..#sw...s#*
*#....w...##*
*##s..#...s#*
**##.#######*
***#s...s#***
***#######***
*************
(
##############
#########..s##
###.....#s...#
#.c...#c.....#
#.#...#c##.###
#@#..s......s#
###...########
##############
)
( (clowntown ish)
103******
*****###*
**####s#*
**#....#*
**#.s..#*
**#...s#*
*##....#*
*#....##*
*#s...#**
*#..@.#**
*#....#**
*#s#.s#**
*######**
*********
)
(
.............
...#######...
...#...@.#...
...#.....#...
.###.s...#...
.#......s#...
.#.......#...
.#.s....s###.
.###......s#.
...###s#####.
.....###.....
.............
)
(not really starbattle - 1-star rows are allowed and 3 star rows are allowed. fine?)
(
todo
* find more puzzles w/ current mechanics
* more mechanics?
* push socks into boxes (how to unwrap?)
* teleporters (dryers? lol)
* make cTooClose flash always?
cryss notes 2020-06-23
* she hit mTooClose on level 3 (large one)
* add glass?
* also she ran into triplet behavior (but didnt understand)
* very confused on this level (3)
* didn't need to understand connection-swapping before, suddenly needs to understand it in a level thats too big
* Q level - cheesed it with the box
"you win" screen - sock on head
things i wish puzzlescript could do
* a "reverse translation" section that resets visual elements when exiting the editor
* better level organization - e.g. a list with thumbnails. reorderable? tree structure?
* character select
* state
* could be used for both overworld and char select
* specifically, persistent (a la game maker) markers
* any additions must be opt-in for back compat; e.g. add new prelude.enable_level_select
todo before ship
* grep debug
)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment