Hey, here's my hookshot code that I wrote for the Custom Element Revival contest. I ended up doing it mostly from scratch as I didn't have access to Dischorran's script at the time.
It's also more complicated than necessary, as it covers two different types:
* one-turn-delay, ignore force arrow
* no-delay, obey force arrow
There's also some convoluted nonsense to check for golem/construct rubble.
I also made an excel sheet for generating the bits of the code that work out how it interacts with different tiles and monsters. So if you want to make one that behaves differently, you can do that as follows:
* open spreadsheet
* in columns D, set what you want to happen
* Block: hookshot is blocked, no further tiles are checked
* Stab: hookshot stabs the tile
* Pull: hookshot pulls the creature to Beethro
* Anchor: hookshot pulls Beethro to the creature
* <
leave blank>
: ignore that tile, check the next tile
* the output is in columns G, J, M, P. copy the code lines into a text document and search and replace "
newline"
with a newline character.[1]
* find the comments in the code that say
Set var ".Comment" : Blocking Creatures
and replace the section after that with the relevant code lines.
Complications (I could improve this perhaps)
* If a creature has two actions, you'll need to do that manually. e.g. Adders, Rattlers, Golems and Constructs need both anchor and stabs so they need to be manually added in.
* Pullable creatures need to be sorted by their safe ground, so if you pull them onto water or pits they'll fall or not fall appropriately.
DROD script:
Click here to view the secret text
×
Appear
Imperative 1
Set var ".homeX" = _MyX
Set var ".homeY" = _MyY
Go to Start
Label OneTurnPause
GoSub ResetMyScript
If ...
Wait until var "HookshotType" = 0
Wait 0
If ...
Wait for player to input Special Command
Set var "_MyScriptX" = _X
Set var "_MyScriptY" = _Y
Game effect Center,Puff explosion,0,0,Off
If End
If End
Label Start
GoSub ResetMyScript
Wait 0
Wait for player to input Special Command
Set var ".Comment" : Initialise Variables
Set var "_MyScriptX" = _X
Set var "_MyScriptY" = _Y
Set var "_MyScriptW" = 0
Set var "_MyScriptH" = 0
Set var ".targetPullSteps" = -1
Set var ".playerPullSteps" = -1
Set var ".pullTargetType" = -1
Set var ".pullTargetValue" = -1
Set var ".pullTargetOrientation" = -1
Set var ".pullTargetFloor" = -1
Set var ".isPlayerPull" = 0
Set var ".isTargetPull" = 0
Set var ".isBlock" = 0
Set var ".isStab" = 0
Set var ".Comment" : Set up Hookshot Loop parameters
Set var ".deltaX" = (_O % 3) - 1
Set var ".deltaY" = (_O / 3) - 1
Set var ".deltaCount" = 0
Set var ".Comment" : TODO: Check Player Arrow here
If ...
Wait until var "HookshotType" = 1
Set var ".inputO" = _O
GoSub ArrowCheck
If ...
Wait until var ".outputIsBlocked" = 1
Set var ".playerPullSteps" = 0
If End
If End
Label HookshotLoop
Set var ".deltaCount" + 1
Set var "_MyScriptX" = _X + (.deltaX * .deltaCount)
Set var "_MyScriptY" = _Y + (.deltaY * .deltaCount)
GoSub CheckOutOfBounds
If ...
Wait until var "_ReturnX" = 1
Go to OneTurnPause
If End
Set var "_MyScriptW" = 4
Set var "_MyScriptH" = 8
Game effect Center,Bolt,0,0,Off
Set var "_MyScriptW" = 0
Set var "_MyScriptH" = 0
Set var ".Comment" : Arrow Check
If ...
Wait until var "HookshotType" = 1
If ...
Wait until var ".playerPullSteps" = -1
Set var ".inputO" = _O
GoSub ArrowCheck
If ...
Wait until var ".outputIsBlocked" = 1
Set var ".playerPullSteps" = .deltaCount - 1
If End
If End
Set var ".inputO" = 8 - _O
GoSub ArrowCheck
If ...
Wait until var ".outputIsBlocked" = 1
Set var ".targetPullSteps" = .deltaCount + 1
If End
If End
Set var ".Comment" : Anchor Items
Set var "_MyScriptF" = 4
GoSub CheckIfAnchorItem
Set var "_MyScriptF" = 6
GoSub CheckIfAnchorItem
Set var "_MyScriptF" = 7
GoSub CheckIfAnchorItem
Set var "_MyScriptF" = 8
GoSub CheckIfAnchorItem
Set var "_MyScriptF" = 9
GoSub CheckIfAnchorItem
Set var "_MyScriptF" = 12
GoSub CheckIfAnchorItem
Set var "_MyScriptF" = 37
GoSub CheckIfAnchorItem
Set var "_MyScriptF" = 39
GoSub CheckIfAnchorItem
Set var "_MyScriptF" = 40
GoSub CheckIfAnchorItem
Set var "_MyScriptF" = 41
GoSub CheckIfAnchorItem
Set var "_MyScriptF" = 47
GoSub CheckIfAnchorItem
Set var "_MyScriptF" = 48
GoSub CheckIfAnchorItem
Set var "_MyScriptF" = 61
GoSub CheckIfAnchorItem
Set var "_MyScriptF" = 63
GoSub CheckIfAnchorItem
Set var "_MyScriptF" = 63
GoSub CheckIfAnchorItem
Set var "_MyScriptF" = 64
GoSub CheckIfAnchorItem
Set var "_MyScriptF" = 66
GoSub CheckIfAnchorItem
Set var "_MyScriptF" = 74
GoSub CheckIfAnchorItem
Set var "_MyScriptF" = 77
GoSub CheckIfAnchorItem
Set var "_MyScriptF" = 83
GoSub CheckIfAnchorItem
Set var ".Comment" : Stab Items
Set var "_MyScriptF" = 5
GoSub CheckIfStabItem
Set var "_MyScriptF" = 24
GoSub CheckIfStabItem
Set var "_MyScriptF" = 43
GoSub CheckIfStabItem
Set var "_MyScriptF" = 62
GoSub CheckIfStabItem
Set var "_MyScriptF" = 90
GoSub CheckIfStabItem
Set var "_MyScriptF" = 91
GoSub CheckIfStabItem
Set var "_MyScriptF" = 92
GoSub CheckIfStabItem
Set var ".Comment" : Blocking Items
Set var "_MyScriptF" = 35
GoSub CheckIfHookBlockedItem
Set var "_MyScriptF" = 59
GoSub CheckIfHookBlockedItem
Set var "_MyScriptF" = 60
GoSub CheckIfHookBlockedItem
Set var "_MyScriptF" = 76
GoSub CheckIfHookBlockedItem
Set var "_MyScriptF" = 103
GoSub CheckIfHookBlockedItem
Set var ".Comment" : Pull Items
Set var "_MyScriptF" = 49
GoSub CheckIfPullItem
Set var ".Comment" : Anchor Creatures
Set var "_MyScriptF" = 7
GoSub CheckIfAnchor
Set var "_MyScriptF" = 13
GoSub CheckIfAnchor
GoSub CheckIfStab
Set var "_MyScriptF" = 14
GoSub CheckIfAnchor
GoSub CheckIfStab
Set var "_MyScriptF" = 22
GoSub CheckIfAnchor
Set var "_MyScriptF" = 41
GoSub CheckIfAnchor
Set var ".Comment" : Stab Creatures
Set var "_MyScriptF" = 15
GoSub CheckIfStab
GoSub CheckIfAnchor
Set var "_MyScriptF" = 19
GoSub CheckIfStab
Set var "_MyScriptF" = 24
GoSub CheckIfStab
Set var "_MyScriptF" = 27
GoSub CheckIfStab
Set var "_MyScriptF" = 35
GoSub CheckIfStab
GoSub CheckIfAnchor
Set var "_MyScriptF" = 36
GoSub CheckIfStab
Set var "_MyScriptF" = 40
GoSub CheckIfStab
GoSub CheckIfAnchor
Set var "_MyScriptF" = 42
GoSub CheckIfStab
Set var ".Comment" : Blocking Creatures
Set var "_MyScriptF" = 2
GoSub CheckIfHookBlocked
Set var "_MyScriptF" = 8
GoSub CheckIfHookBlocked
Set var "_MyScriptF" = 9
GoSub CheckIfHookBlocked
Set var "_MyScriptF" = 29
GoSub CheckIfHookBlocked
Set var "_MyScriptF" = 30
GoSub CheckIfHookBlocked
Set var "_MyScriptF" = 31
GoSub CheckIfHookBlocked
Set var "_MyScriptF" = 32
GoSub CheckIfHookBlocked
Set var "_MyScriptF" = 33
GoSub CheckIfHookBlocked
Set var ".Comment" : Pullable Creatures
Set var ".Comment" : 0: Floor only 1: Shallow Water 2: Deep Water 3: Flying
Set var ".pullTargetFloorType" = 0
Set var "_MyScriptF" = 0
GoSub CheckIfPull
Set var "_MyScriptF" = 1
GoSub CheckIfPull
Set var "_MyScriptF" = 3
GoSub CheckIfPull
Set var "_MyScriptF" = 6
GoSub CheckIfPull
Set var "_MyScriptF" = 18
GoSub CheckIfPull
Set var "_MyScriptF" = 21
GoSub CheckIfPull
Set var "_MyScriptF" = 23
GoSub CheckIfPull
Set var ".pullTargetFloorType" = 1
Set var "_MyScriptF" = 10
GoSub CheckIfPull
Set var "_MyScriptF" = 11
GoSub CheckIfPull
Set var "_MyScriptF" = 12
GoSub CheckIfPull
Set var "_MyScriptF" = 20
GoSub CheckIfPull
Set var "_MyScriptF" = 25
GoSub CheckIfPull
Set var "_MyScriptF" = 28
GoSub CheckIfPull
Set var "_MyScriptF" = 34
GoSub CheckIfPull
Set var "_MyScriptF" = 37
GoSub CheckIfPull
Set var "_MyScriptF" = 38
GoSub CheckIfPull
Set var "_MyScriptF" = 39
GoSub CheckIfPull
Set var ".pullTargetFloorType" = 2
Set var "_MyScriptF" = 16
GoSub CheckIfPull
Set var "_MyScriptF" = 17
GoSub CheckIfPull
Set var ".pullTargetFloorType" = 3
Set var "_MyScriptF" = 5
GoSub CheckIfPull
Set var "_MyScriptF" = 26
GoSub CheckIfPull
Set var "_MyScriptF" = 43
GoSub CheckIfPull
If ...
Wait until var ".isBlock" = 1
Go to OneTurnPause
Else If
Wait until var ".isStab" = 1
Set var "_MyScriptF" = -9999
Attack tile 0,0,Stab
If ...
Wait until var ".isPlayerPull" = 1
Go to PlayerPull
If End
Go to OneTurnPause
Else If
Wait until var ".isTargetPull" = 1
Go to TargetPull
Else If
Wait until var ".isPlayerPull" = 1
Go to PlayerPull
If End
Set var ".Comment" : Check for Rubble
Teleport to 0,0
Set var "_MyScriptF" = -9999
If ...
Wait for entity Self 0,0,0,0
Set var "_MyScriptX" = .homeX
Set var "_MyScriptY" = .homeY
Teleport to 0,0
Else
Go to PlayerPull
If End
Go to HookshotLoop
Label TargetPull
Set var "_MyScriptF" = -9999
If ...
Wait until var ".targetPullSteps" = -1
Set var ".targetPullSteps" = 1
Else If
Wait until var ".targetPullSteps" > .deltaCount
Set var ".targetPullSteps" = .deltaCount
If End
If ...
Wait until var ".pullTargetType" = 1
Set var ".Comment" : Only mirror
Attack tile 0,0,Explosion
Set var "_MyScriptX" = .targetPullSteps * .deltaX + _X
Set var "_MyScriptY" = .targetPullSteps * .deltaY + _Y
Set var "_MyScriptF" = .pullTargetValue
Build Alternate floor,0,0,0,0
Else
Attack tile 0,0,Kill
Set var "_MyScriptX" = .targetPullSteps * .deltaX + _X
Set var "_MyScriptY" = .targetPullSteps * .deltaY + _Y
If ...
Wait for item Pit,0,0,0,0
If ...
Wait until var ".pullTargetFloor" < 3
Go to TargetFall
If End
Else If
Wait for item Image pit,0,0,0,0
If ...
Wait until var ".pullTargetFloor" < 3
Go to TargetFall
If End
Else If
Wait for item Water,0,0,0,0
If ...
Wait until var ".pullTargetFloor" < 2
Go to TargetSplash
If End
Else If
Wait for item Shallow water,0,0,0,0
If ...
Wait until var ".pullTargetFloor" < 1
Go to TargetSplash
If End
If End
Set var "_MyScriptW" = .pullTargetOrientation
Set var "_MyScriptH" = .pullTargetValue
Generate entity Beethro,0,0,northwest
Set var "_MyScriptW" = 0
Set var "_MyScriptH" = 0
If End
Go to OneTurnPause
Label TargetFall
Set var "_MyScriptW" = 4
Set var "_MyScriptH" = 11
Game effect Center,Bolt,0,0,Off
Go to OneTurnPause
Label TargetSplash
Set var "_MyScriptW" = 4
Set var "_MyScriptH" = 10
Game effect Center,Bolt,0,0,Off
Go to OneTurnPause
Label PlayerPull
If ...
Wait until var ".playerPullSteps" = -1
Set var ".playerPullSteps" = .deltaCount - 1
If End
Set var "_MyScriptX" = .playerPullSteps * .deltaX + _X
Set var "_MyScriptY" = .playerPullSteps * .deltaY + _Y
Teleport Player to 0,0
Go to OneTurnPause
Label CheckOutOfBounds
Set var "_ReturnX" = 0
If ...
Wait until var "_MyScriptX" < 0
Set var "_ReturnX" = 1
Else If
Wait until var "_MyScriptX" > 37
Set var "_ReturnX" = 1
Else If
Wait until var "_MyScriptY" < 0
Set var "_ReturnX" = 1
Else If
Wait until var "_MyScriptY" > 31
Set var "_ReturnX" = 1
If End
Return
Label CheckIfHookBlocked
If ...
Wait for entity type Beethro,0,0,0,0
Set var ".isBlock" = 1
If End
Return
Label CheckIfHookBlockedItem
If ...
Wait for item Floor,0,0,0,0
Set var ".isBlock" = 1
If End
Return
Label CheckIfStab
If ...
Wait for entity type Beethro,0,0,0,0
Set var ".isStab" = 1
If End
Return
Label CheckIfStabItem
If ...
Wait for item Floor,0,0,0,0
Set var ".isStab" = 1
If End
Return
Label CheckIfAnchor
If ...
Wait for entity type Beethro,0,0,0,0
Set var ".isPlayerPull" = 1
If End
Return
Label CheckIfAnchorItem
If ...
Wait for item Floor,0,0,0,0
Set var ".isPlayerPull" = 1
If End
Return
Label CheckIfPull
If ...
Wait for entity type Beethro,0,0,0,0
Set var ".isTargetPull" = 1
Set var ".pullTargetValue" = _MyScriptF
Set var ".pullTargetFloor" = .pullTargetFloorType
Set var ".pullTargetType" = 0
Get entity direction 0,0
Set var ".pullTargetOrientation" = _ReturnX
If End
Return
Label CheckIfPullItem
If ...
Wait for item Floor,0,0,0,0
Set var ".isTargetPull" = 1
Set var ".pullTargetValue" = _MyScriptF
Set var ".pullTargetType" = 1
Get entity direction 0,0
Set var ".pullTargetOrientation" = _ReturnX
If End
Return
Label ArrowCheck
Set var ".outputIsBlocked" = 0
Set var "_MyScriptF" = 45
If ...
Wait for item Ortho square,0,0,0,0
Set var ".ArrowOCheck" = .inputO % 2
If ...
Wait until var ".ArrowOCheck" = 0
Set var ".outputIsBlocked" = 1
If End
Return
If End
If ...
Wait until var ".inputO" <= 2
Set var ".ArrowOCheck" = .inputO + 2
Else If
Wait until var ".inputO" = 3
Set var ".ArrowOCheck" = 1
Else If
Wait until var ".inputO" = 6
Set var ".ArrowOCheck" = 0
Else If
Wait until var ".inputO" = 8
Set var ".ArrowOCheck" = 6
Else
Set var ".ArrowOCheck" = .inputO
If End
Set var "_MyScriptF" = (.ArrowOCheck % 8) + 13
If ...
Wait for item Force arrow (east),0,0,0,0
Set var ".outputIsBlocked" = 1
If End
Set var "_MyScriptF" = ((.ArrowOCheck + 1) % 8) + 13
If ...
Wait for item Force arrow (east),0,0,0,0
Set var ".outputIsBlocked" = 1
If End
Set var "_MyScriptF" = ((.ArrowOCheck + 2) % 8) + 13
If ...
Wait for item Force arrow (east),0,0,0,0
Set var ".outputIsBlocked" = 1
If End
Return
Label ResetMyScript
Set var "_MyScriptX" = -9999
Set var "_MyScriptY" = -9999
Set var "_MyScriptW" = -9999
Set var "_MyScriptH" = -9999
Set var "_MyScriptF" = -9999
Return
[1] I think it wasn't possible to do this directly because when you cut and paste multiline cells out of excel it always sticks quotes around it.