# coding=utf8
# the above tag defines encoding for this document and is for Python 2.x compatibility
import re
regex = r"^(?>[\t\v]+(?<GECKScript>[]!#$%&()*+.\/0-9:;<=>A-Z[a-z{|}^-]+))+"
test_str = ("Scn NVDLC01VaultCodeHolderScript\n\n"
"; Script that handles variables, and events, for Elijah's confrontation at the Vault.\n"
"; - Jorge\n\n"
"; Vault Level Variables:\n\n"
"Short bPlayerSafe\n"
"Short bPlayerBlocks\n"
"Short bVaultOpen\n"
"Short bTreasureFound\n"
"Short bSecurityAltInfo\n"
"Short bChristineHelp\n"
"Short bDeanHelp\n\n"
"Int iTurretsDown\n"
"Int iSecurityState\n"
"Int iElevatorState\n"
"Int iMaintenanceState\n\n"
"; Elijah Variables:\n\n"
"Short bElijahContacted\n"
"Short bElijahTaunted\n"
"Short bElijahInVault\n"
"Short bElijahPaths\n"
"Short bElijahTurnsSecurityOn\n"
"Short bElijahEntersVault\n"
"Short bElijahArrivesVault\n"
"Short bElijahOpensVault\n"
"Short bElijahFights\n"
"Short bElijahDead\n"
"Short bElijahTrapped\n"
"Short bElijahTrapsPlayer\n"
"Short bElijahTeamsWithPlayer\n"
"short bPlayerTrapped\n\n"
"Int iElijahState\n"
"Int iChristineStrikes\n\n"
"Float fAngle\n\n"
"; Operational Variables:\n"
"Int iCount\n"
"Float fTimer\n\n"
"; >>>>---------------- Begin Code;\n\n"
"; >>>>----------------\n"
"Begin GameMode\n\n"
" If (bTreasureFound == 1)\n"
" If (bVaultOpen == 1) ; If Players have opened the Vault previously.\n"
" If (bElijahContacted == 1) ; If Players have contacted Elijah - start sequence.\n"
" If (iElijahState == 0) ; If First Stage of Endgame.\n"
" If (bElijahInVault == 0) ; If Elijah not yet teleported to Vault.\n"
" NVDLC01ElijahREF.Disable;\n"
" NVDLC01ElijahREF.MoveTo NVDLC01VaultStartMarkerREF;\n"
" SetStage NVDLC01MQ03 48;\n"
" Set bElijahInVault to 1;\n"
" Return;\n"
" Else\n"
" NVDLC01ElijahREF.Enable; ; Enable Elijah once he's been moved to the Vault.\n"
" Set iElijahState to 1; ; Ready Elijah for the next stage of events/AI behaviors.\n"
" Set bElijahPaths to 1; ; Set variable to be checked by Elijah's AI package.\n"
" Return;\n"
" Endif\n"
" Elseif (iElijahState == 1)\n"
" If (iCount == 0)\n"
" NVDLC01ElijahREF.AddScriptPackage NVDLC01VaultElijaIntroPathTravel; ; Add AI Package to Elijah to path to Vault.\n"
" NVDLC01ElijahREF.SetGhost 1; ; Make Elijah impervious to combat - this resets, and scene jumps to fight, if he's attacked.\n"
" Set iCount to 1;\n"
" Return;\n"
" Elseif (iCount >= 1)\n"
" If (NVDLC01ElijahREF.GetDetected Player == 1)\n"
" ;ShowWarning \"Elijah Detected You!\"\n"
" If (bPlayerSafe != 1)\n"
" If (iCount == 1)\n"
" NVDLC01ElijahREF.RemoveScriptPackage NVDLC01VaultElijaIntroPathTravel ;\n"
" Set iCount to 2;\n"
" Return;\n"
" Elseif (iCount == 2)\n"
" If (bElijahEntersVault == 0)\n"
" NVDLC01ElijahREF.AddScriptPackage NVDLC01VaultElijahFightOutTravel; ; Add AI Package to Elijah to path to Fight Outside spot.\n"
" Else\n"
" NVDLC01ElijahREF.AddScriptPackage NVDLC01VaultElijahFightOut2Travel; ; Add AI Package to Elijah to path to Fight Outside spot, but make him run.\n"
" Endif\n"
" VaultPeskyFieldREF.MoveTo VaultPeskyFieldOnMarker; ; In this case, we immediately close off the retraversal path doors, since Elijah will inevitably trigger the Vault Security against players\n"
" VaultPeskyFieldBlocker2REF.Enable; ; while trapping them inside the Vault Chamber area. This leads, always, to the \"Fight Elijah\" fall-through state.\n"
" VaultPeskyFieldBlocker3REF.Enable; ; These doors, will open again once Elijah dies.\n"
" VaultPeskyField03bREF.SetPos Z 10406.0000;\n"
" Set iElijahState to 2; ; Ready Elijah for the next stage of events/AI behaviors (2 = Fight Outside).\n"
" Set bElijahFights to 1;\n"
" Set iCount to 0; ; Reset operational integer.\n"
" Return;\n"
" Endif\n"
" Else ; If Elijah detects players, and they are in a safe zone (opposite side of Vault entrance),\n"
" VaultSecurityExitDoorsMarker.Enable; ; then we trigger the Vault's defenses, and move the script to the same state that happens\n"
" VaultEntryDoor02REF.SetOpenState 0; ; when Elijah has been trapped without noticing players (but we skip the scene where he gets attacked by security).\n"
" VaultEntryDoor01REF.SetOpenState 0;\n"
" VaultSecurityMeasuresMarker.Enable;\n"
" VaultFinalSpeaker01REF.SetDestroyed 0;\n"
" VaultFinalSpeaker02REF.SetDestroyed 0;\n"
" VaultFinalSpeaker01REF.Activate Player 1;\n"
" VaultFinalSpeaker02REF.Activate Player 1;\n"
" VaultFinalSpeaker01REF.SetDestroyed 1;\n"
" VaultFinalSpeaker02REF.SetDestroyed 1;\n"
" NVDLC01ElijahREF.PlayIdle PipboyManipulate;\n"
" Set iElijahState to 3;\n"
" Set iSecurityState to 1;\n"
" Set iCount to 0;\n"
" Set fTimer to 0;\n"
" Return;\n"
" Endif\n"
" Else ; If Elijah does not detect players, let him continue to the Vault door.\n"
" If (bElijahArrivesVault == 1) ; If Elijah gets to the front of the Door.\n"
" NVDLC01ElijahREF.AddScriptPackage NVDLC01VaultElijahOpenVaultDoorTravel; ; (TEMP) Add AI Package to Elijah to path to Vault door marker.\n"
" Set iElijahState to 3; ; Ready Elijah for stage of events/AI in which he can become trapped.\n"
" ;Set bElijahOpensVault to 1; ; Set variable to be checked by Elijah's AI package (to avoid AddScriptPackage calls).\n"
" Set iCount to 0;\n"
" Return;\n"
" Else ; If Elijah has not yet arrived at the door to the Vault.\n"
" If (bElijahTaunted == 1 || iSecurityState == 1) ; If Players have consciously provoked Elijah to fight during the intercom scene (that is, he's not going to fight inside right away).\n"
" If (NVDLC01ElijahREF.GetDistance VaultElijaVaultFightOutMarkerREF <= 320) ; If Elijah nears the Fight Outside Marker\n"
" NVDLC01ElijahREF.AddScriptPackage NVDLC01VaultElijahFightOutTravel; ; (TEMP) Add AI Package to Elijah to path to Fight Outside spot.\n"
" Set iElijahState to 2; ; Ready Elijah for the next stage of events/AI behaviors (2 = Fight Outside).\n"
" Set bElijahFights to 1; ; Set variable to be checked by Elijah's AI package (to avoid AddScriptPackage calls).\n"
" Set iCount to 0; ; Reset operational integer.\n"
" Return;\n"
" Else\n"
" If (bPlayerBlocks == 1) ; If players run up the main exit stairs, and Elijah's far from its fighting marker (as checked above, he's not going into chamber).\n"
" NVDLC01ElijahREF.AddScriptPackage NVDLC01VaultElijahFightOutTravel; ; (TEMP) Add AI Package to Elijah to path to Fight Outside spot.\n"
" Set iElijahState to 2; ; Ready Elijah for the next stage of events/AI behaviors (2 = Fight Outside).\n"
" Set bElijahFights to 1; ; Set variable to be checked by Elijah's AI package (to avoid AddScriptPackage calls).\n"
" Set iCount to 0; ; Reset operational integer.\n"
" Return;\n"
" Endif \n"
" Endif\n"
" Else ; If Elijah was tricked during the intercom conversation;\n"
" If (bPlayerBlocks == 1) ; If Player enters the quick-exit area (stairs to entry pod).\n"
" If (bElijahEntersVault == 0) ; If Elijah's not inside trap area.\n"
" NVDLC01ElijahREF.AddScriptPackage NVDLC01VaultElijahFightOutTravel; ; Add AI Package to Elijah to path to Fight Outside spot.\n"
" Set bElijahTaunted to 1; ; We artificially set this variable, as if Player had taunted Elijah to fight (or Elijah expected a fight).\n"
" Else ; Otherwise, if Elijah's inside trap area.\n"
" NVDLC01ElijahREF.AddScriptPackage NVDLC01VaultElijahFightInsideTravel; ; Add AI Package to Elijah to fight inside the Vault's Chamber (trape area).\n"
" Set bElijahTaunted to 0; ; We set this variable, as if Player had tricked Elijah to talk face to face, even though it was already 0 (precaution... dear friends).\n"
" Endif ; Otherwise, the script at bElijahState 2 will assume that he's not made it inside the Vault Chamber (trap area) yet.\n"
" Set iElijahState to 2; ; Ready Elijah for the next stage of events/AI behaviors (2 = Fight Outside).\n"
" Set bElijahFights to 1; ; Set variable to be checked by Elijah's AI package (to avoid AddScriptPackage calls).\n"
" Set iCount to 0; ; Reset operational integer.\n"
" Return;\n"
" Endif \n"
" Endif\n"
" Endif\n"
" Endif \n"
" Endif\n"
" Elseif (iElijahState == 2) ; If Elijah's state is \"Alerted to a Trap,\" or planning to trap Player.\n"
" If (NVDLC01ElijahRef.GetDead == 0) ; If Elijah lives during the combat scene.\n"
" If (iSecurityState == 0) ; If Vault Security is off.\n"
" If (bElijahTurnsSecurityOn == 1) ; If Elijah turns security before going into the trap area.\n"
" Set fTimer to (fTimer + GetSecondsPassed) ; Then we kick-off the scene where he traps Player inside Vault, and fires security.\n"
" If (iCount == 0 || iCount == 4) ; The second value of iCount gets set to 4 in the event of players rushing up the pod-stairs before Elijah can detect.\n"
" NVDLC01ElijahREF.PlayIdle PipboyManipulate;\n"
" Set iCount to 1;\n"
" Return;\n"
" Elseif (iCount == 1 && fTimer >= 1)\n"
" VaultSecurityExitDoorsMarker.Enable;\n"
" VaultPeskyFieldREF.MoveTo VaultPeskyFieldOnMarker;\n"
" VaultPeskyFieldBlocker2REF.Enable;\n"
" VaultPeskyFieldBlocker3REF.Enable;\n"
" VaultPeskyField03bREF.SetPos Z 10406.0000;\n"
" Set iCount to 2;\n"
" Return;\n"
" Elseif (iCount == 2 && fTimer >= 3)\n"
" VaultSecurityMeasuresMarker.Enable;\n"
" VaultFinalSpeaker01REF.SetDestroyed 0;\n"
" VaultFinalSpeaker02REF.SetDestroyed 0;\n"
" VaultFinalSpeaker01REF.Activate Player 1;\n"
" VaultFinalSpeaker02REF.Activate Player 1;\n"
" VaultFinalSpeaker01REF.SetDestroyed 1;\n"
" VaultFinalSpeaker02REF.SetDestroyed 1;\n"
" Set iCount to 3;\n"
" Return;\n"
" Elseif (iCount == 3 && fTimer >= 5)\n"
" VaultFinalTurret01REF.SetGhost 0;\n"
" VaultFinalTurret02REF.SetGhost 0;\n"
" VaultFinalTurret03REF.SetGhost 0;\n"
" VaultFinalTurret04REF.SetGhost 0;\n"
" VaultFinalTurret05REF.SetGhost 0;\n"
" VaultFinalTurret06REF.SetGhost 0;\n"
" SetEnemy NVDLC01VaultSecurityFaction PlayerFaction 0 1;\n"
" Set iCount to 0;\n"
" Set fTimer to 0;\n"
" Set iSecurityState to 2;\n"
" Return;\n"
" Endif\n"
" Else ; If Elijah has not turned security at force-field before going into the trap area.\n"
" If (bPlayerBlocks == 1) ; If player tries to go up the stairs, while Elijah's is alerted to the trap.\n"
" If (bElijahTaunted != 1) ; If Elijah was tricked, before he was alerted\n"
" If (iCount == 0) ; Then this means Elijah went into the Vault proper area (otherwise, state would've been skipped above, in iElijahState == 1).\n"
" NVDLC01ElijahREF.RemoveScriptPackage NVDLC01VaultElijahFightOutTravel; ; We take the AI to travel outside the trap (it's possible, but not necessary, that this was overriden before, in iElijahState == 1).\n"
" Set iCount to 1;\n"
" Return;\n"
" Elseif (iCount == 1)\n"
" NVDLC01ElijahREF.AddScriptPackage NVDLC01VaultElijahFightInsideTravel; ; We give AI to travel inside the trap, to fight (it's possible, but not necessary, that this was given before, in iElijahState == 1).\n"
" Set iCount to 2;\n"
" Return;\n"
" Elseif (iCount == 2)\n"
" Set fAngle to (NVDLC01ElijahREF.GetAngle Z + NVDLC01ElijahREF.GetHeadingAngle Player);\n"
" NVDLC01ElijahREF.SetAngle Z fAngle;\n"
" NVDLC01ElijahREF.PlayIdle PipboyManipulate;\n"
" Set bElijahTurnsSecurityOn to 1;\n"
" Set iSecurityState to 5; ; We skip down to segment that handles Elijah's fight, under \"improvised\" circumstances.\n"
" Set iCount to 0;\n"
" Set fTimer to 0;\n"
" Return;\n"
" Endif\n"
" Else ; If Elijah was expecting a trap, and player goes up the stairs to the pod.\n"
" If (iCount == 0)\n"
" VaultSecurityExitDoorsMarker.Enable; ; We lock the door, and set the code to run, idly - soon Elijah will reach the gate.\n"
" Set iCount to 4; ; And he'll set the security sequence where he traps the player (scripted immediately above).\n"
" Return;\n"
" Elseif (iCount == 4)\n"
" Return;\n"
" Endif\n"
" Endif\n"
" Endif\n"
" Endif\n"
" Elseif (iSecurityState == 1) ; If Vault Security is on when Elijah gets there - this state also gets set if Elijah triggers trap, and players are not in safe-zone (trapped too).\n"
" If (bElijahTurnsSecurityOn == 1)\n"
" Set fTimer to (fTimer + GetSecondsPassed);\n"
" If (iCount == 0)\n"
" NVDLC01ElijahREF.PlayIdle PipboyManipulate;\n"
" Set iCount to 1;\n"
" Return;\n"
" Elseif (iCount == 1 && fTimer >= 1)\n"
" Set iCount to 0;\n"
" Set fTimer to 0;\n"
" Set iSecurityState to 2;\n"
" Return;\n"
" Endif\n"
" Endif\n"
" Elseif (iSecurityState == 2)\n"
" If (iTurretsDown < 9)\n"
" If (bChristineHelp == 0 && iTurretsDown < 6) ; Christine helps out by taking down two turrets (only runs here if Elijah sets trap on player, and less than 3 turrets are down).\n"
" If (NVDLC01ChristineRef.GetDead == 0 && NVDLC01ChristineDialogue.nChristineAttitude > 1)\n"
" VaultChristineVoiceActivatorREF.Say NVDLC01ChristineVaultHelpTopic01 1;\n"
" Set bChristineHelp to 1;\n"
" Endif\n"
" Endif\n"
" If (iTurretsDown == 1)\n"
" If (iCount == 0)\n"
" NVDLC01ElijahREF.SayTo Player NVDLC01ElijahVaultSentryDownTopic01 1; ; Elijah's bark about futility of Players' actions, blah blah.\n"
" Set iCount to 1;\n"
" Endif\n"
" Elseif (iTurretsDown == 2)\n"
" If (iCount <= 1)\n"
" NVDLC01ElijahREF.SayTo Player NVDLC01ElijahVaultSentryDownTopic02 1; ; Elijah's bark about getting pissed off.\n"
" Set iCount to 2;\n"
" Endif\n"
" Elseif (iTurretsDown >= 3)\n"
" If (iCount <= 2)\n"
" NVDLC01ElijahREF.SayTo Player NVDLC01ElijahVaultSentryDownTopic03 1; ; Elijah's bark about having to finish this off himself.\n"
" VaultSecurityExitDoorsMarker.Disable;\n"
" NVDLC01ElijahRef.MoveTo VaultElijahFightsInsidePortPoint;\n"
" Set iSecurityState to 3;\n"
" Set iCount to 0;\n"
" Return;\n"
" Endif\n"
" Endif\n"
" Else ; This variable (iTurretsDown) gets set to 9 if players re-program the turrets to attack Elijah.\n"
" NVDLC01ElijahREF.SayTo Player NVDLC01ElijahVaultSentryDownTopic03 1;\n"
" ;VaultSecurityExitDoorsMarker.Disable;\n"
" NVDLC01ElijahRef.MoveTo VaultElijahFightsInsidePortPoint;\n"
" Set iSecurityState to 3;\n"
" Set iCount to 0;\n"
" Return;\n"
" Endif\n"
" Elseif (iSecurityState == 3)\n"
" NVDLC01ElijahRef.SetGhost 0;\n"
" SetEnemy NVDLC01ElijahFaction PlayerFaction 0 1;\n"
" NVDLC01ElijahRef.StartCombat Player;\n"
" NVDLC01ElijahREF.AddScriptPackage NVDLC01VaultElijahRushInsideTravel;\n"
" Set iSecurityState to 4;\n"
" Return;\n"
" Elseif (iSecurityState == 4) ; This is the standard fighting state, after players deal with enough security turrets, if Elijah trapped player\n"
" Set fTimer to (fTimer + GetSecondsPassed); ; inside the Vault's Chamber area, of if he was trapped inside alongside the player.\n"
" If (iCount == 0 && fTimer >= 0.5)\n"
" VaultSecurityExitDoorsMarker.Enable;\n"
" VaultPeskyFieldREF.MoveTo VaultPeskyFieldOnMarker;\n"
" VaultPeskyFieldBlocker2REF.Enable;\n"
" VaultPeskyFieldBlocker3REF.Enable;\n"
" VaultPeskyField03bREF.SetPos Z 10406.0000;\n"
" Set iCount to 1;\n"
" If (bDeanHelp == 0) ; Dean helps out by disabling the speakers.\n"
" If (NVDLC01DeanRef.GetDead == 0 && NVDLC01DeanDialogue.nDeanAttitude > 1)\n"
" VaultDeanVoiceActivatorREF.Say NVDLC01DeanVaultHelpTopic01 1;\n"
" Set bDeanHelp to 1;\n"
" Endif\n"
" Endif\n"
" Return;\n"
" Elseif (iCount == 1 && fTimer >= 6)\n"
" NVDLC01ElijahRef.Say NVDLC01ElijahVaultCombatBarkTopic01 1;\n"
" Set iCount to 2;\n"
" Return;\n"
" Elseif (iCount == 2 && fTimer >= 12)\n"
" If (bChristineHelp == 0) ; Christine helps out by taking down two turrets (only runs here if 3 turrets were down before Elijah sets trap on player).\n"
" If (iTurretsDown < 6) ; Only destroy turrets if at least one of them remains intact, and won't run if players have turned turrets against Elijah (variable == 9).\n"
" If (NVDLC01ChristineRef.GetDead == 0 && NVDLC01ChristineDialogue.nChristineAttitude > 1)\n"
" VaultChristineVoiceActivatorREF.Say NVDLC01ChristineVaultHelpTopic01 1; ; In her dialogue, a variable gets set to 1 in the VaultTurretCodeBox. The code to kill the turrets runs there.\n"
" Set bChristineHelp to 1;\n"
" Endif\n"
" Endif\n"
" Endif\n"
" Elseif (iCount == 2 && fTimer >= 20)\n"
" NVDLC01ElijahRef.Say NVDLC01ElijahVaultCombatBarkTopic02 1;\n"
" Set iCount to 3;\n"
" Return;\n"
" Elseif (iCount == 3 && fTimer >= 40)\n"
" NVDLC01ElijahRef.Say NVDLC01ElijahVaultCombatBarkTopic03 1;\n"
" Set iCount to 4;\n"
" Return;\n"
" Elseif (iCount == 4 && fTimer >= 60)\n"
" NVDLC01ElijahRef.Say NVDLC01ElijahVaultCombatBarkTopic04 1;\n"
" Set iCount to 5;\n"
" Return;\n"
" Elseif (iCount == 6)\n"
" Return;\n"
" Endif\n"
" Elseif (iSecurityState == 5) ; This case only takes place if players sneak behind Elijah, through the main exit stairs, when he's been duped to head to the\n"
" Set fTimer to (fTimer + GetSecondsPassed); ; Vault's chamber.\n"
" If (iCount == 0)\n"
" VaultSecurityExitDoorsMarker.Enable;\n"
" VaultPeskyFieldREF.MoveTo VaultPeskyFieldOnMarker;\n"
" VaultPeskyField03bREF.SetPos Z 10406.0000;\n"
" VaultPeskyFieldBlocker2REF.Enable;\n"
" VaultPeskyFieldBlocker3REF.Enable;\n"
" VaultSecurityMeasuresMarker.Enable;\n"
" VaultFinalSpeaker01REF.SetDestroyed 0;\n"
" VaultFinalSpeaker02REF.SetDestroyed 0;\n"
" VaultFinalSpeaker01REF.Activate Player 1;\n"
" VaultFinalSpeaker02REF.Activate Player 1;\n"
" VaultFinalSpeaker01REF.SetDestroyed 1;\n"
" VaultFinalSpeaker02REF.SetDestroyed 1;\n"
" Set iCount to 1;\n"
" Return;\n"
" Elseif (iCount == 1 && fTimer >= 2)\n"
" VaultFinalTurret01REF.SetGhost 0;\n"
" VaultFinalTurret02REF.SetGhost 0;\n"
" VaultFinalTurret03REF.SetGhost 0;\n"
" VaultFinalTurret04REF.SetGhost 0;\n"
" VaultFinalTurret05REF.SetGhost 0;\n"
" VaultFinalTurret06REF.SetGhost 0;\n"
" SetEnemy NVDLC01VaultSecurityFaction PlayerFaction 0 1;\n"
" If (bDeanHelp == 0) ; Dean helps out by disabling the speakers.\n"
" If (NVDLC01DeanRef.GetDead == 0 && NVDLC01DeanDialogue.nDeanAttitude > 1)\n"
" VaultDeanVoiceActivatorREF.Say NVDLC01DeanVaultHelpTopic01 1;\n"
" Set bDeanHelp to 1;\n"
" Endif\n"
" Endif\n"
" Set iCount to 2;\n"
" Return;\n"
" Elseif (iCount == 2 && fTimer >= 4)\n"
" NVDLC01ElijahRef.SetGhost 0;\n"
" SetEnemy NVDLC01ElijahFaction PlayerFaction 0 1;\n"
" NVDLC01ElijahRef.StartCombat Player;\n"
" Set iCount to 3;\n"
" Set fTimer to 0;\n"
" Return;\n"
" Elseif (iCount == 3 && fTimer >= 6)\n"
" NVDLC01ElijahRef.Say NVDLC01ElijahVaultCombatBarkTopic01 1;\n"
" Set iCount to 4;\n"
" Return;\n"
" Elseif (iCount == 4 && fTimer >= 12)\n"
" If (bChristineHelp == 0)\n"
" If (iTurretsDown < 6)\n"
" If (NVDLC01ChristineRef.GetDead == 0 && NVDLC01ChristineDialogue.nChristineAttitude > 1)\n"
" VaultChristineVoiceActivatorREF.Say NVDLC01ChristineVaultHelpTopic01 1;\n"
" Set bChristineHelp to 1;\n"
" Endif\n"
" Endif\n"
" Endif\n"
" Elseif (iCount == 4 && fTimer >= 20)\n"
" NVDLC01ElijahRef.Say NVDLC01ElijahVaultCombatBarkTopic02 1;\n"
" Set iCount to 5;\n"
" Return;\n"
" Elseif (iCount == 5 && fTimer >= 40)\n"
" NVDLC01ElijahRef.Say NVDLC01ElijahVaultCombatBarkTopic03 1;\n"
" Set iCount to 6;\n"
" Return;\n"
" Elseif (iCount == 6 && fTimer >= 60)\n"
" NVDLC01ElijahRef.Say NVDLC01ElijahVaultCombatBarkTopic04 1;\n"
" Set iCount to 7;\n"
" Return;\n"
" Elseif (iCount == 7)\n"
" Return;\n"
" Endif\n"
" Endif\n"
" Else ; If Elijah's dead while the combat scene takes place.\n"
" If (bElijahDead == 0)\n"
" VaultFinalTurret01REF.SetGhost 0; ; Make security turrets vulnerable, just in case Elijah dies before they get set to Ghost 0.\n"
" VaultFinalTurret02REF.SetGhost 0;\n"
" VaultFinalTurret03REF.SetGhost 0;\n"
" VaultFinalTurret04REF.SetGhost 0;\n"
" VaultFinalTurret05REF.SetGhost 0;\n"
" VaultFinalTurret06REF.SetGhost 0;\n"
" Set iCount to 0; ; Reset operational variables to use in scripting for Elijah's death-event.\n"
" Set fTimer to 0;\n"
" Set bElijahDead to 1; ; This variable is important to set to 1 - dialogue will check against this (Veronica).\n"
" Set iElijahState to 4; ; Set script to handle Elijah's death-event next.\n"
" Return;\n"
" Endif\n"
" Endif\n"
" Elseif (iElijahState == 3) ; Elijah's tricked into opening the Vault, or Elijah discovers the trap before players spring it on him.\n"
" If (iSecurityState == 0) ; If Vault Security is off, or Elijah hasn't been alarmed by player actions yet.\n"
" If (bElijahTurnsSecurityOn == 1) ; If Elijah is done with using terminal animations\n"
" Set fTimer to (fTimer + GetSecondsPassed); ; We kick off a timer to handle timing of events where Elijah triggers Vault security.\n"
" If (NVDLC01ElijahREF.IsInCombat == 0) ; If Elijah's not in combat\n"
" If (iCount == 0)\n"
" ;NVDLC01ElijahRef.SetGhost 0; ; At this point, Elijah's vulnerable.\n"
" Set iCount to 1;\n"
" Return;\n"
" Elseif (iCount == 1 && fTimer >= 1)\n"
" VaultSecurityExitDoorsMarker.Enable;\n"
" VaultPeskyFieldREF.MoveTo VaultPeskyFieldOnMarker;\n"
" VaultPeskyField03bREF.SetPos Z 10406.0000;\n"
" VaultPeskyFieldBlocker2REF.Enable;\n"
" VaultPeskyFieldBlocker3REF.Enable;\n"
" VaultEntryDoor02REF.SetOpenState 0;\n"
" VaultEntryDoor01REF.SetOpenState 0;\n"
" Set iCount to 2;\n"
" Return;\n"
" Elseif (iCount == 2 && fTimer >= 1.5)\n"
" Set fAngle to (NVDLC01ElijahREF.GetAngle Z + NVDLC01ElijahREF.GetHeadingAngle VaultElijaVaultFightOutMarkerREF);\n"
" NVDLC01ElijahREF.SetAngle Z fAngle;\n"
" NVDLC01ElijahRef.Say NVDLC01ElijahVaultTrappedTopic01 1;\n"
" Set iCount to 3;\n"
" Return;\n"
" Elseif (iCount == 3 && fTimer >= 4.5)\n"
" VaultSecurityMeasuresMarker.Enable;\n"
" VaultFinalSpeaker01REF.SetDestroyed 0;\n"
" VaultFinalSpeaker02REF.SetDestroyed 0;\n"
" VaultFinalSpeaker01REF.Activate Player 1;\n"
" VaultFinalSpeaker02REF.Activate Player 1;\n"
" VaultFinalSpeaker01REF.SetDestroyed 1;\n"
" VaultFinalSpeaker02REF.SetDestroyed 1;\n"
" Set iCount to 4;\n"
" Return;\n"
" Elseif (iCount == 4 && fTimer >= 5)\n"
" Set fAngle to (NVDLC01ElijahREF.GetAngle Z + NVDLC01ElijahREF.GetHeadingAngle VaultFinalSpeaker01REF);\n"
" NVDLC01ElijahREF.SetAngle Z fAngle;\n"
" NVDLC01ElijahRef.Say NVDLC01ElijahVaultTrappedTopic02 1;\n"
" Set iCount to 5;\n"
" Return;\n"
" Elseif (iCount == 5 && fTimer >= 5.5)\n"
" NVDLC01ElijahREF.PlayIdle LooseWildlyAngryShortLength;\n"
" Set iCount to 6;\n"
" Return;\n"
" Elseif (iCount == 6 && fTimer >= 11)\n"
" Set fAngle to (NVDLC01ElijahREF.GetAngle Z + NVDLC01ElijahREF.GetHeadingAngle Player);\n"
" NVDLC01ElijahREF.SetAngle Z fAngle;\n"
" NVDLC01ElijahREF.PlayIdle PipboyManipulate;\n"
" NVDLC01ElijahRef.Say NVDLC01ElijahVaultTrappedTopic03 1;\n"
" VaultFinalTurret01REF.AddScriptPackage NVDLC01VaultTurretFakeAttackElijah;\n"
" VaultFinalTurret02REF.AddScriptPackage NVDLC01VaultTurretFakeAttackElijah;\n"
" VaultFinalTurret03REF.AddScriptPackage NVDLC01VaultTurretFakeAttackElijah;\n"
" VaultFinalTurret06REF.AddScriptPackage NVDLC01VaultTurretFakeAttackElijah;\n"
" Set iCount to 0;\n"
" Set fTimer to 0;\n"
" Set iSecurityState to 1;\n"
" Return;\n"
" Endif\n"
" Else ; This means that Elijah started combat, which can only happen if his Ghost state is 0, which means he opened the Vault.\n"
" If (VaultSecurityMeasuresMarker.GetDisabled == 1) ; If the previous sequence didn't get to this point, then enable the security of the Vault.\n"
" VaultSecurityMeasuresMarker.Enable; ; Note: this state is a safeguard against extremely fringe-like cases (detonators, mines, etc, that may hurt Elijah here).\n"
" VaultFinalSpeaker01REF.SetDestroyed 0;\n"
" VaultFinalSpeaker02REF.SetDestroyed 0;\n"
" VaultFinalSpeaker01REF.Activate Player 1;\n"
" VaultFinalSpeaker02REF.Activate Player 1;\n"
" VaultFinalSpeaker01REF.SetDestroyed 1;\n"
" VaultFinalSpeaker02REF.SetDestroyed 1;\n"
" Endif\n"
" NVDLC01ElijahRef.Say NVDLC01ElijahVaultTrappedTopic03 1; ; Elijah kickstarts the event where he's aware of the trap/combat, and he's in the Vault Chamber area.\n"
" Set iCount to 0; ; We skip to where we check for player positions (out of trap, or inside trap area), and let it run its expected course (below).\n"
" Set fTimer to 0; ; Again, this is highly unlikely.\n"
" Set iSecurityState to 1;\n"
" Return;\n"
" Endif\n"
" Endif\n"
" Elseif (iSecurityState == 1) ; Here we check for players' position. If they are safe, then Elijah's trapped. Also, this stage is a fall-through for \"trap-discovered!\"\n"
" If (bPlayerSafe == 1) || (bElijahTrapped == 1) ; bPlayerSafe is passed by an actor-zone that stands beyond the security force-fields, near entry pod, and retraversal path pod.\n"
" Set fTimer to (fTimer + GetSecondsPassed); ; However, we also check for bElijahTrapped == 1. We want this to continue once it starts, regardless of subsequent player-actions.\n"
" If (iCount == 0)\n"
" NVDLC01ElijahRef.SetGhost 0;\n"
" Set bElijahTrapped to 1; ; Set Elijah to be formally \"trapped.\"\n"
" VaultMaintenanceDoorREF.Unlock;\n"
" NVDLC01VaultElevatorREF.Unlock;\n"
" PlaySound NVDLC01AMBVaultEscapeStart;\n"
" Set iCount to 1;\n"
" Return;\n"
" Elseif (iCount == 1 && fTimer >= 6)\n"
" NVDLC01ElijahRef.Say NVDLC01ElijahVaultTrappedTopic04 1;\n"
" NVDLC01ElijahREF.AddScriptPackage NVDLC01VaultElijahTrappedCurseTravel;\n"
" Set NVDLC01Collars to 0; ; We disable the standard collar functions.\n"
" Set VaultCollarCodeBox.bCollarOn to 1; ; Elijah's pissed off now - he triggers the player's bomb-collar (this runs in the Vault level only).\n"
" VaultEscapeSoundMarker.Enable;\n"
" VaultEntryDoor02REF.SetOpenState 0;\n"
" VaultEntryDoor01REF.SetOpenState 0;\n"
" Set iCount to 2;\n"
" Return;\n"
" Elseif (iCount == 2 && fTimer >= 6.5)\n"
" Set iCount to 3;\n"
" Return;\n"
" Elseif (iCount == 3 && fTimer >= 7)\n"
" PlayMusic NVDLC01EndGameEscape;\n"
" NVDLC01ElijahRef.SetGhost 0;\n"
" VaultFinalTurret01REF.SetGhost 0;\n"
" VaultFinalTurret02REF.SetGhost 0;\n"
" VaultFinalTurret03REF.SetGhost 0;\n"
" VaultFinalTurret04REF.SetGhost 0;\n"
" VaultFinalTurret05REF.SetGhost 0;\n"
" VaultFinalTurret06REF.SetGhost 0;\n"
" SetEnemy NVDLC01VaultSecurityFaction PlayerFaction 0 1;\n"
" VaultFinalTurret01REF.StartCombat Player;\n"
" VaultFinalTurret02REF.StartCombat Player;\n"
" VaultFinalTurret03REF.StartCombat Player;\n"
" VaultFinalTurret04REF.StartCombat Player;\n"
" VaultFinalTurret05REF.StartCombat Player;\n"
" VaultFinalTurret06REF.StartCombat Player;\n"
" Set iCount to 4;\n"
" Set fTimer to 60.5; ; Players have 60 seconds to get to the elevator before it leaves.\n"
" Return;\n"
" Elseif (iCount == 4)\n"
" If (iElevatorState == 0)\n"
" Set fTimer to (fTimer - GetSecondsPassed);\n"
" If (fTimer <= 0)\n"
" Set iElevatorState to 1; ; Elevator leaves when the timer runs out.\n"
" Return;\n"
" Endif\n"
" Endif \n"
" Endif\n"
" Else ; If Player is not in safe-zone when Elijah triggers the Vault's Security System.\n"
" VaultFinalTurret01REF.SetGhost 0;\n"
" VaultFinalTurret02REF.SetGhost 0;\n"
" VaultFinalTurret03REF.SetGhost 0;\n"
" VaultFinalTurret04REF.SetGhost 0;\n"
" VaultFinalTurret05REF.SetGhost 0;\n"
" VaultFinalTurret06REF.SetGhost 0;\n"
" NVDLC01ElijahRef.SetGhost 0;\n"
" SetEnemy NVDLC01VaultSecurityFaction PlayerFaction 0 1;\n"
" Set bElijahFights to 1; ; We kick back the script to the fall-through stage (Elijah Fight Scene).\n"
" Set iElijahState to 2;\n"
" Set iSecurityState to 3;\n"
" Endif\n"
" Endif \n"
" Elseif (iElijahState == 4) ; Elijah's dead - end scene, reset variables, do groovy stuff.\n"
" Set fTimer to (fTimer + GetSecondsPassed)\n"
" If (iCount == 0 && fTimer >= 1)\n"
" VaultFinalTurret01REF.PlaceAtMe NV40mmGrenadeExplosion;\n"
" VaultSecurityMeasuresMarker.Disable;\n"
" VaultFinalSpeaker01REF.SetDestroyed 0;\n"
" VaultFinalSpeaker02REF.SetDestroyed 0;\n"
" VaultFinalSpeaker01REF.Activate Player 1;\n"
" VaultFinalSpeaker02REF.Activate Player 1;\n"
" VaultFinalSpeaker01REF.SetDestroyed 1;\n"
" VaultFinalSpeaker02REF.SetDestroyed 1;\n"
" VaultPeskyFieldREF.MoveTo VaultPeskyFieldOffMarker;\n"
" VaultPeskyField03bREF.SetPos Z 7406.0000\n"
" VaultPeskyFieldBlocker2REF.Disable;\n"
" VaultPeskyFieldBlocker3REF.Disable;\n"
" Set iCount to 1;\n"
" Return;\n"
" Elseif (iCount == 1 && fTimer >= 1.4)\n"
" VaultFinalTurret03REF.PlaceAtMe NV40mmGrenadeExplosion;\n"
" ;VaultFinalTurret01REF.KillActor Player 0\n"
" VaultFinalTurret01REF.CIOS NVDLC01KillSpell;\n"
" Set iCount to 2;\n"
" Return;\n"
" Elseif (iCount == 2 && fTimer >= 2.4)\n"
" VaultFinalTurret02REF.PlaceAtMe NV40mmGrenadeExplosion;\n"
" VaultFinalTurret03REF.CIOS NVDLC01KillSpell;\n"
" Set iCount to 3;\n"
" Return;\n"
" Elseif (iCount == 3 && fTimer >= 3.4)\n"
" VaultFinalTurret05REF.PlaceAtMe NV40mmGrenadeExplosion;\n"
" VaultFinalTurret02REF.CIOS NVDLC01KillSpell;\n"
" Set iCount to 4;\n"
" Return;\n"
" Elseif (iCount == 4 && fTimer >= 3.6)\n"
" VaultFinalTurret06REF.PlaceAtMe NV40mmGrenadeExplosion;\n"
" VaultFinalTurret05REF.CIOS NVDLC01KillSpell;\n"
" Set iCount to 5;\n"
" Return;\n"
" Elseif (iCount == 5 && fTimer >= 3.9)\n"
" VaultFinalTurret04REF.PlaceAtMe NV40mmGrenadeExplosion;\n"
" VaultFinalTurret06REF.CIOS NVDLC01KillSpell;\n"
" Set iCount to 6;\n"
" Return;\n"
" Elseif (iCount == 6 && fTimer >= 4.8)\n"
" VaultFinalSpeaker01REF.PlaceAtMe NV40mmGrenadeExplosion;\n"
" VaultFinalTurret04REF.CIOS NVDLC01KillSpell;\n"
" Set iCount to 7;\n"
" Return;\n"
" Elseif (iCount == 7 && fTimer >= 5.1)\n"
" VaultFinalSpeaker02REF.PlaceAtMe NV40mmGrenadeExplosion;\n"
" ;VaultSecurityExitDoorsMarker.Disable;\n"
" VaultPeskyFieldREF.MoveTo VaultPeskyFieldOffMarker;\n"
" VaultPeskyFieldBlocker2REF.Disable;\n"
" Set NVDLC01Collars to 0; ; We disable the standard collar functions.\n"
" Set VaultCollarCodeBox.bCollarOn to 1; ; Elijah dies, and that automatically triggers the player's bomb-collar (this runs in the Vault level only).\n"
" VaultEscapeSoundMarker.Enable;\n"
" VaultMaintenanceDoorREF.Unlock; ; We make sure the doors leading out are unlocked, and some of them are to be closed (freak out time, when collar's ticking).\n"
" NVDLC01VaultElevatorREF.Unlock;\n"
" VaultEntryDoor02REF.SetOpenState 0;\n"
" VaultEntryDoor01REF.SetOpenState 0;\n"
" Set iCount to 8;\n"
" Return;\n"
" Endif\n"
" Endif\n"
" Endif\n"
" Endif\n"
" Endif\n\n"
"End\n"
"; <<<<----------------")
matches = re.finditer(regex, test_str, re.MULTILINE)
for matchNum, match in enumerate(matches, start=1):
print ("Match {matchNum} was found at {start}-{end}: {match}".format(matchNum = matchNum, start = match.start(), end = match.end(), match = match.group()))
for groupNum in range(0, len(match.groups())):
groupNum = groupNum + 1
print ("Group {groupNum} found at {start}-{end}: {group}".format(groupNum = groupNum, start = match.start(groupNum), end = match.end(groupNum), group = match.group(groupNum)))
# Note: for Python 2.7 compatibility, use ur"" to prefix the regex and u"" to prefix the test string and substitution.
Please keep in mind that these code samples are automatically generated and are not guaranteed to work. If you find any syntax errors, feel free to submit a bug report. For a full regex reference for Python, please visit: https://docs.python.org/3/library/re.html