I was lucky enough to have been given the opportunity to contribute some scripted elements to TSS! Some of my contributions are post-mastery rewards, and I would like to eventually make those scripts available to use. I'll probably wait a while before I do that - post-mastery stuff is meant to be secret!
In this element pack, I contributed the Flashlight/ScaredRoach. It's simple to use, but it does need a little bit of explanation.
1. Copy the default script of the FlashlightRoachManager character in this hold and add it to the default script of a character in your hold. Same with the ScaredRoach default script.
2. Include one FlashlightRoachManager character in your room. Not visible.
3. Create as many ScaredRoach characters as you like. Set them visible.
4. Add a spider on any empty tile. This will put the room in an unconquered state.
5. Create an invisible character whose only action is to immediately kill the spider. (Attack Tile Kill)
6. Enjoy!
I was regrettably AWOL in the months leading up to release, so I missed the addition of the brilliant _PlayerLightType variable. The devs were kind enough to set that variable in the flashlight rooms - thanks guys!
We could actually reduce the character count in the room by one if we set _PlayerLightType at the top of FlashlightManager. Also, we could now remove some obsolete cosmetic chunks of the script which are now handled by the new lighting effects. That would prevent build markers from appearing on walls.
Long story short, here's an updated version of
FlashlightManager:
Click here to view the secret text
× Set var "_PlayerLightType" = 80
Set player weapon Off
Set var "Flashlight1X" = -1
Set var "Flashlight2X" = -1
Set var "Flashlight3X" = -1
Set var "Flashlight4X" = -1
Set var "Flashlight5X" = -1
Set var "Flashlight6X" = -1
Set var "Flashlight7X" = -1
Set var "Flashlight8X" = -1
Set var "Flashlight9X" = -1
Set var "Flashlight10X" = -1
Set var "Flashlight1Y" = -1
Set var "Flashlight2Y" = -1
Set var "Flashlight3Y" = -1
Set var "Flashlight4Y" = -1
Set var "Flashlight5Y" = -1
Set var "Flashlight6Y" = -1
Set var "Flashlight7Y" = -1
Set var "Flashlight8Y" = -1
Set var "Flashlight9Y" = -1
Set var "Flashlight10Y" = -1
Label Loop
Label NW
If ...
Wait until var "_O" = 0
Set var "Flashlight1X" = _X-1
Set var "Flashlight2X" = _X-2
Set var "Flashlight3X" = _X-3
Set var "Flashlight4X" = _X-4
Set var "Flashlight5X" = _X-1
Set var "Flashlight6X" = _X-2
Set var "Flashlight7X" = _X-3
Set var "Flashlight8X" = _X-1
Set var "Flashlight9X" = _X-2
Set var "Flashlight10X" = _X-1
Set var "Flashlight1Y" = _Y-1
Set var "Flashlight2Y" = _Y-1
Set var "Flashlight3Y" = _Y-1
Set var "Flashlight4Y" = _Y-1
Set var "Flashlight5Y" = _Y-2
Set var "Flashlight6Y" = _Y-2
Set var "Flashlight7Y" = _Y-2
Set var "Flashlight8Y" = _Y-3
Set var "Flashlight9Y" = _Y-3
Set var "Flashlight10Y" = _Y-4
If End
Label N
If ...
Wait until var "_O" = 1
Set var "Flashlight1X" = _X
Set var "Flashlight2X" = _X+1
Set var "Flashlight3X" = _X
Set var "Flashlight4X" = _X-1
Set var "Flashlight5X" = _X+2
Set var "Flashlight6X" = _X+1
Set var "Flashlight7X" = _X
Set var "Flashlight8X" = _X-1
Set var "Flashlight9X" = _X-2
Set var "Flashlight10X" = -1
Set var "Flashlight1Y" = _Y-1
Set var "Flashlight2Y" = _Y-2
Set var "Flashlight3Y" = _Y-2
Set var "Flashlight4Y" = _Y-2
Set var "Flashlight5Y" = _Y-3
Set var "Flashlight6Y" = _Y-3
Set var "Flashlight7Y" = _Y-3
Set var "Flashlight8Y" = _Y-3
Set var "Flashlight9Y" = _Y-3
Set var "Flashlight10Y" = -1
If End
Label NE
If ...
Wait until var "_O" = 2
Set var "Flashlight1X" = _X+1
Set var "Flashlight2X" = _X+2
Set var "Flashlight3X" = _X+3
Set var "Flashlight4X" = _X+4
Set var "Flashlight5X" = _X+1
Set var "Flashlight6X" = _X+2
Set var "Flashlight7X" = _X+3
Set var "Flashlight8X" = _X+1
Set var "Flashlight9X" = _X+2
Set var "Flashlight10X" = _X+1
Set var "Flashlight1Y" = _Y-1
Set var "Flashlight2Y" = _Y-1
Set var "Flashlight3Y" = _Y-1
Set var "Flashlight4Y" = _Y-1
Set var "Flashlight5Y" = _Y-2
Set var "Flashlight6Y" = _Y-2
Set var "Flashlight7Y" = _Y-2
Set var "Flashlight8Y" = _Y-3
Set var "Flashlight9Y" = _Y-3
Set var "Flashlight10Y" = _Y-4
If End
Label E
If ...
Wait until var "_O" = 5
Set var "Flashlight1X" = _X+1
Set var "Flashlight2X" = _X+2
Set var "Flashlight3X" = _X+2
Set var "Flashlight4X" = _X+2
Set var "Flashlight5X" = _X+3
Set var "Flashlight6X" = _X+3
Set var "Flashlight7X" = _X+3
Set var "Flashlight8X" = _X+3
Set var "Flashlight9X" = _X+3
Set var "Flashlight10X" = -1
Set var "Flashlight1Y" = _Y
Set var "Flashlight2Y" = _Y+1
Set var "Flashlight3Y" = _Y
Set var "Flashlight4Y" = _Y-1
Set var "Flashlight5Y" = _Y+2
Set var "Flashlight6Y" = _Y+1
Set var "Flashlight7Y" = _Y
Set var "Flashlight8Y" = _Y-1
Set var "Flashlight9Y" = _Y-2
Set var "Flashlight10Y" = -1
If End
Label SE
If ...
Wait until var "_O" = 8
Set var "Flashlight1X" = _X+1
Set var "Flashlight2X" = _X+2
Set var "Flashlight3X" = _X+3
Set var "Flashlight4X" = _X+4
Set var "Flashlight5X" = _X+1
Set var "Flashlight6X" = _X+2
Set var "Flashlight7X" = _X+3
Set var "Flashlight8X" = _X+1
Set var "Flashlight9X" = _X+2
Set var "Flashlight10X" = _X+1
Set var "Flashlight1Y" = _Y+1
Set var "Flashlight2Y" = _Y+1
Set var "Flashlight3Y" = _Y+1
Set var "Flashlight4Y" = _Y+1
Set var "Flashlight5Y" = _Y+2
Set var "Flashlight6Y" = _Y+2
Set var "Flashlight7Y" = _Y+2
Set var "Flashlight8Y" = _Y+3
Set var "Flashlight9Y" = _Y+3
Set var "Flashlight10Y" = _Y+4
If End
Label S
If ...
Wait until var "_O" = 7
Set var "Flashlight1X" = _X
Set var "Flashlight2X" = _X+1
Set var "Flashlight3X" = _X
Set var "Flashlight4X" = _X-1
Set var "Flashlight5X" = _X+2
Set var "Flashlight6X" = _X+1
Set var "Flashlight7X" = _X
Set var "Flashlight8X" = _X-1
Set var "Flashlight9X" = _X-2
Set var "Flashlight10X" = -1
Set var "Flashlight1Y" = _Y+1
Set var "Flashlight2Y" = _Y+2
Set var "Flashlight3Y" = _Y+2
Set var "Flashlight4Y" = _Y+2
Set var "Flashlight5Y" = _Y+3
Set var "Flashlight6Y" = _Y+3
Set var "Flashlight7Y" = _Y+3
Set var "Flashlight8Y" = _Y+3
Set var "Flashlight9Y" = _Y+3
Set var "Flashlight10Y" = -1
If End
Label SW
If ...
Wait until var "_O" = 6
Set var "Flashlight1X" = _X-1
Set var "Flashlight2X" = _X-2
Set var "Flashlight3X" = _X-3
Set var "Flashlight4X" = _X-4
Set var "Flashlight5X" = _X-1
Set var "Flashlight6X" = _X-2
Set var "Flashlight7X" = _X-3
Set var "Flashlight8X" = _X-1
Set var "Flashlight9X" = _X-2
Set var "Flashlight10X" = _X-1
Set var "Flashlight1Y" = _Y+1
Set var "Flashlight2Y" = _Y+1
Set var "Flashlight3Y" = _Y+1
Set var "Flashlight4Y" = _Y+1
Set var "Flashlight5Y" = _Y+2
Set var "Flashlight6Y" = _Y+2
Set var "Flashlight7Y" = _Y+2
Set var "Flashlight8Y" = _Y+3
Set var "Flashlight9Y" = _Y+3
Set var "Flashlight10Y" = _Y+4
If End
Label W
If ...
Wait until var "_O" = 3
Set var "Flashlight1X" = _X-1
Set var "Flashlight2X" = _X-2
Set var "Flashlight3X" = _X-2
Set var "Flashlight4X" = _X-2
Set var "Flashlight5X" = _X-3
Set var "Flashlight6X" = _X-3
Set var "Flashlight7X" = _X-3
Set var "Flashlight8X" = _X-3
Set var "Flashlight9X" = _x-3
Set var "Flashlight10X" = -1
Set var "Flashlight1Y" = _Y
Set var "Flashlight2Y" = _Y+1
Set var "Flashlight3Y" = _Y
Set var "Flashlight4Y" = _Y-1
Set var "Flashlight5Y" = _Y+2
Set var "Flashlight6Y" = _Y+1
Set var "Flashlight7Y" = _Y
Set var "Flashlight8Y" = _Y-1
Set var "Flashlight9Y" = _Y-2
Set var "Flashlight10Y" = -1
If End
Wait 0
Go to Loop
And the unchanged code for
ScaredRoach, because why not? Its code is more interesting anyway:
Click here to view the secret text
× Imperative 7
Imperative 3
If ...
Wait for clean room
Disappear
End
If End
Set var ".tempx" = 0
Set var ".tempy" = 0
Set var ".IsFleeing" = 0
Set var ".FleeDirection" = -1
Set var ".ReturnValue" = 0
Label Loop
Set var ".tempx" = _MyX
Set var ".tempy" = _MyY
GoSub CheckPointForFlashlight
GoSub SetFleeState
Label Flee
If ...
Wait until var ".IsFleeing" = 1
Set var "_MyO" = .FleeDirection
Set var "_MyScriptX" = .FleeDirection
Go to Check for direct movement
Else
Label Pursue as Roach
Set var ".tempx" = _MyX
Set var ".tempy" = _MyY
GoSub GetPoint'sCardinalDirectionFromPlayer
Set var "_MyO" = 8 - .ReturnValue
Set var "_MyScriptX" = _MyO
Label Check for direct movement
If ...
Wait for open move northwest
Set var "_MyScriptX" = -9999
Set var ".tempx" = _MyX + ((_MyO%3) -1)
Set var ".tempy" = _MyY + ((_MyO/3) -1)
GoSub CheckPointForFlashlight
GoSub SetFleeState
Set var "_MyScriptX" = (_MyO%3) -1
Set var "_MyScriptY" = (_MyO/3) -1
Move 0,0,1,0
Set var "_MyScriptX" = -9999
Set var "_MyScriptY" = -9999
Else
Label Check whether we were moving diagonally, cleanup if not
Set var "temp" = _MyO%2
If ...
Wait until var "temp" = 1
If ...
Wait until var ".IsFleeing" = 1
Set var "_MyScriptX" = -9999
Set var ".IsFleeing" = 0
Set var ".FleeDirection" = -1
Set var ".tempx" = _MyX
Set var ".tempy" = _MyY
GoSub CheckPointForFlashlight
If ...
Wait until var ".ReturnValue" = 1
Wait 1
If End
Else
Set var "_MyScriptX" = _MyO
Face direction northwest
Set var "_MyScriptX" = -9999
Wait 0
If End
Else
Label Check for north/south movement
Set var "_MyScriptX" = ((_MyO/3)*3)+1
If ...
Wait for open move northwest
Set var "_MyScriptX" = -9999
Set var ".tempy" = _MyY + ((_MyO/3) -1)
GoSub CheckPointForFlashlight
GoSub SetFleeState
Set var "_MyScriptY" = (_MyO/3) -1
Move 0,0,1,0
Set var "_MyScriptY" = -9999
Else
Label Check for east/west movement
Set var "_MyScriptX" = (_MyO%3)+3
If ...
Wait for open move northwest
Set var "_MyScriptX" = -9999
Set var ".tempx" = _MyX + ((_MyO%3) -1)
GoSub CheckPointForFlashlight
GoSub SetFleeState
Set var "_MyScriptX" = (_MyO%3) -1
Move 0,0,1,0
Set var "_MyScriptX" = -9999
Else
Label No diag move open, so cleanup instead
If ...
Wait until var ".IsFleeing" = 1
Set var "_MyScriptX" = -9999
Set var ".IsFleeing" = 0
Set var ".FleeDirection" = -1
Set var ".tempx" = _MyX
Set var ".tempy" = _MyY
GoSub CheckPointForFlashlight
If ...
Wait until var ".ReturnValue" = 1
Wait 1
If End
Else
Set var "_MyScriptX" = _MyO
Face direction northwest
Set var "_MyScriptX" = -9999
Wait 0
If End
If End
If End
If End
If End
If End
Go to Loop
Label CheckPointForFlashlight
Set var ".ReturnValue" = 0
Set var ".FlashlightCheckX" = Flashlight1X
Set var ".FlashlightCheckY" = Flashlight1Y
GoSub FlashlightCheckSub
Set var ".FlashlightCheckX" = Flashlight2X
Set var ".FlashlightCheckY" = Flashlight2Y
GoSub FlashlightCheckSub
Set var ".FlashlightCheckX" = Flashlight3X
Set var ".FlashlightCheckY" = Flashlight3Y
GoSub FlashlightCheckSub
Set var ".FlashlightCheckX" = Flashlight4X
Set var ".FlashlightCheckY" = Flashlight4Y
GoSub FlashlightCheckSub
Set var ".FlashlightCheckX" = Flashlight5X
Set var ".FlashlightCheckY" = Flashlight5Y
GoSub FlashlightCheckSub
Set var ".FlashlightCheckX" = Flashlight6X
Set var ".FlashlightCheckY" = Flashlight6Y
GoSub FlashlightCheckSub
Set var ".FlashlightCheckX" = Flashlight7X
Set var ".FlashlightCheckY" = Flashlight7Y
GoSub FlashlightCheckSub
Set var ".FlashlightCheckX" = Flashlight8X
Set var ".FlashlightCheckY" = Flashlight8Y
GoSub FlashlightCheckSub
Set var ".FlashlightCheckX" = Flashlight9X
Set var ".FlashlightCheckY" = Flashlight9Y
GoSub FlashlightCheckSub
Set var ".FlashlightCheckX" = Flashlight10X
Set var ".FlashlightCheckY" = Flashlight10Y
GoSub FlashlightCheckSub
Return
Label FlashlightCheckSub
If ...
Wait until var ".tempx" = .FlashlightCheckX
If ...
Wait until var ".tempy" = .FlashlightCheckY
Set var ".ReturnValue" = 1
If End
If End
Return
Label GetPoint'sCardinalDirectionFromPlayer
Set var ".ReturnValue" = 0
If ...
Wait until var ".tempx" < _X
Set var ".ReturnValue" + 0
If End
If ...
Wait until var ".tempx" = _X
Set var ".ReturnValue" + 1
If End
If ...
Wait until var ".tempx" > _X
Set var ".ReturnValue" + 2
If End
If ...
Wait until var ".tempy" < _Y
Set var ".ReturnValue" + 0
If End
If ...
Wait until var ".tempy" = _Y
Set var ".ReturnValue" + 3
If End
If ...
Wait until var ".tempy" > _Y
Set var ".ReturnValue" + 6
If End
Return
Label SetFleeState
If ...
Wait until var ".ReturnValue" = 1
Set var ".IsFleeing" = 1
Set var ".tempx" = _MyX
Set var ".tempy" = _MyY
GoSub GetPoint'sCardinalDirectionFromPlayer
Set var ".FleeDirection" = .ReturnValue
If End
Return
____________________________
http://beepsandbloops.wordpress.com/
[Last edited by RoboBob3000 at 08-16-2014 07:06 AM]