Notepad++ Setup

From the CreationKit Wiki
Revision as of 22:01, 5 March 2012 by imported>Aarondhp24 (→‎Setting up a quick compile)
Jump to navigation Jump to search


Notepad++ is a freeware text editor that can be used to edit and compile Papyrus scripts. It can be downloaded from the official Notepad++ site. Notepad++ supports user-defined syntax highlighting autocomplete, folding, and can be set up to quickly compile Papyrus scripts, making it a more robust option than using the basic in-editor text editor.

Setting up a quick compile

  1. Open Notepad++
  2. Hit F5 (run)
  3. Paste the following line into the input in the"Run..." dialogue window in Notepad++:
    "C:\Program Files (x86)\Steam\steamapps\common\skyrim\Papyrus compiler\ScriptCompile.bat" $(FILE_NAME)
    NOTE: Inside the quotes, paste in the equivalent path on your PC while points to that ScriptCompile.bat file.
  4. Select Save...
  5. Name it something useful like "Compile Papyrus"
  6. Set up a keyboard shortcut if you want, such as CTRL+F5.
  • You can find the new shortcut under the Run menu option, or just use your keyboard shortcut if you defined one. (If you attempt to use the shortcut and nothing happens, double check that you have linked the shortcut to the ScriptCompile.bat file, and not the PapyrusCompiler.exe)
  • You can change the keyboard shortcut under Settings -> Shortcut Mapper -> Run Tab
  • This will compile the script you are currently tabbed to while in Notepad++.
  • NOTE: Check the ScriptCompile.bat (Windows Batch File) located in your Skyrim\Papyrus Compiler folder and make sure its contents match the strings of code listed below. An example is given for both 64-Bit and 32-Bit windows OS's. If you have a Program Files(x86) folder then use the 64-bit example.

To edit your ScriptCompile.bat file, you can right click on it in Windows Explorer and select "Edit with Notepad++" You may end up with a screen of random characters that make no sense, at which point you should close out and try again. (This is simply a glitch)

The string of code below (in its entirety) should work for a default ScriptCompile.bat Skyrim installation on x86 or x64 Windows Vista/7:

"%ProgramFiles(x86)%\Steam\SteamApps\Common\Skyrim\Papyrus Compiler\PapyrusCompiler.exe" %1 -f="TESV_Papyrus_Flags.flg" -i="%ProgramFiles(x86)%\Steam\SteamApps\Common\Skyrim\Data\Scripts\Source" -o="%ProgramFiles(x86)%\Steam\SteamApps\Common\Skyrim\Data\Scripts"
Pause

For 32-Bit Win XP, use the below:

"%ProgramFiles%\Steam\SteamApps\Common\Skyrim\Papyrus Compiler\PapyrusCompiler.exe" %1 -f="TESV_Papyrus_Flags.flg" -i="%ProgramFiles%\Steam\SteamApps\Common\Skyrim\Data\Scripts\Source" -o="%ProgramFiles%\Steam\SteamApps\Common\Skyrim\Data\Scripts"
Pause
  • For the setup in that example, your script must be saved and located in "C:\Program Files (x86)\Steam\steamapps\common\skyrim\Data\Scripts\Source" for the compilation to work.
  • See the Papyrus Compiler Reference for more information on using the compiler.

Setting up Papyrus Language Definitions

Notepad++ supports both autocomplete and syntax highlighting for custom language. The following two sections describe the steps you need to take to enable each of these features for Papyrus.

Autocomplete

  1. Open up Notepad++
  2. Copy the content from this page into a new file: Papyrus Autocomplete Language Definitions
  3. Save the new file as papyrus.xml in your Notepad++\plugins\APIs directory (for example, C:\Program Files (x86)\Notepad++\plugins\APIs)
  4. In the Backup/Auto-Completion tab of the Preferences window of Notepad++ (under Settings), tick the "Enable auto-completion on each input" and configure the feature to work how you want.
    Currently, a portion of the functions have parameter information defined, so if you tick "Function parameters hint on input" you will see more information when typing these functions.

Syntax Highlighting

  1. Create an XML file with the following content (you can call it whatever you like and save it anywhere you like):
    <NotepadPlus>
        <UserLang name="Papyrus" ext="psc">
            <Settings>
                <Global caseIgnored="yes" />
                <TreatAsSymbol comment="yes" commentLine="yes" />
                <Prefix words1="no" words2="no" words3="no" words4="no" />
            </Settings>
            <KeywordLists>
                <Keywords name="Delimiters">&quot;00&quot;00</Keywords>
                <Keywords name="Folder+">Event Function If State While</Keywords>
                <Keywords name="Folder-">EndEvent EndFunction EndIf EndState EndWhile Native</Keywords>
                <Keywords name="Operators">- ! % &amp; ( ) * , . / [ ] | + &lt; = &gt;</Keywords>
                <Keywords name="Comment">1{ 2} 0;</Keywords>
                <Keywords name="Words1">abs acos Activate Add AddAchievement AddDependentAnimatedObjectReference AddForm AddHavokBallAndSocketConstraint AddInventoryEventFilter AddItem AddPerk AddShout AddSpell AddToFaction AddToMap AdvanceSkill AllowBleedoutDialogue AllowPCDialogue Apply ApplyCrossFade ApplyHavokImpulse asin atan AttachAshPile BlockActivation CalculateEncounterLevel CalculateFavorCost CanFastTravelToMarker CanPayCrimeGold CaptureFrameRate Cast Ceiling CenterOnCell CenterOnCellAndWait Clear ClearArrested ClearDestruction ClearExtraArrows ClearForcedMovement ClearKeepOffsetFromActor ClearLookAt ClearPrison ClearTempEffects CloseUserLog CompleteAllObjectives CompleteQuest cos CreateDetectionEvent DamageActorValue DamageAV DamageObject DBSendPlayerPosition DebugChannelNotify DegreesToRadians Delete DeleteWhenAble Disable DisableNoWait DisablePlayerControls Dispel DispelAllSpells DispelSpell DoCombatSpellApply DropObject DumpAliasData Enable EnableAI ENableFastTravel EnableFastTravel EnableNoWait EnablePlayerControls EndFrameRateCapture EquipItem EquipShout EquipSpell EvaluatePackage FadeOutGame FailAllObjectives FastTravel FindClosestActor FindClosestReferenceOfAnyTypeInList FindClosestReferenceOfType FindRandomActor FindRandomReferenceOfAnyTypeInList FindRandomReferenceOfType FindWeather Fire Floor ForceActive ForceActorValue ForceAddRagdollToWorld ForceAV ForceFirstPerson ForceLocationTo ForceMovementDirection ForceMovementDirectionRamp ForceMovementRotationSpeed ForceMovementRotationSpeedRamp ForceMovementSpeed ForceMovementSpeedRamp ForceRefTo ForceRemoveRagdollFromWorld ForceStart ForceTargetAngle ForceTargetDirection ForceTargetSpeed ForceThirdPerson GameTimeToString Get GetActorBase GetActorOwner GetActorReference GetActorValue GetActorValuePercentage GetAlias GetAngleX GetAngleY GetAngleZ GetAnimationVariableBool GetAnimationVariableFloat GetAnimationVariableInt GetAssociatedSkill GetAt GetAV GetAverageFrameRate GetAVPercentage GetBaseActorValue GetBaseAV GetBaseObject GetBribeAmount GetBudgetCount GetBudgetName GetCasterActor GetClass GetClassification GetCombatState GetCombatTarget GetConfigName GetCrimeFaction GetCrimeGold GetCrimeGoldNonViolent GetCrimeGoldViolent GetCurrentBudget GetCurrentDestructionStage GetCurrentGameTime GetCurrentLocation GetCurrentMemory GetCurrentPackage GetCurrentRealTime GetCurrentScene GetCurrentStageID GetCurrentWeather GetCurrentWeatherTransition GetDeadCount GetDialogueTarget GetDistance GetEditorLocation GetEquippedItemType GetEquippedShield GetEquippedShout GetEquippedSpell GetEquippedWeapon GetFactionOwner GetFactionRank GetFactionReaction GetFavorPoints GetFlyingState GetForcedLandingMarker GetForm GetFormID GetGameSettingFloat GetGameSettingInt GetGameSettingString GetGiftFilter GetGoldAmount GetGoldValue GetHeadingAngle GetHeight GetHigestRelationshipRank GetHighestRelationshipRank GetInfamy GetInfamyNonViolent GetInfamyViolent GetItemCount GetItemHealthPercent GetKey GetKeywordData GetKiller GetLength GetLevel GetLeveledActorBase GetLightLevel GetLinkedRef GetLocation GetLockLevel GetLowestRelationshipRank GetMass GetMaxFrameRate GetMinFrameRate GetNoBleedoutRecovery GetNthLinkedRef GetOpenState GetOutgoingWeather GetOwningQuest GetParentCell GetPlatformName GetPlayer GetPlayerControls GetPlayerGrabbedRef GetPlayersLastRiddenHorse GetPositionX GetPositionY GetPositionZ GetRace GetReaction GetRealHoursPassed GetReference GetRefTypeAliveCount GetRefTypeDeadCount GetRegard GetRelationshipRank GetReputation GetScale GetSex GetSitState GetSize GetSkyMode GetSleepState GetStage GetStageDone GetState GetStolenItemValueCrime GetStolenItemValueNoCrime GetTargetActor GetTemplate GetTriggerObjectCount GetValue GetVersionNumber GetVoiceRecoveryTime GetVoiceType GetWidth GetWorldSpace GoToState GtLockLevel HasAssociation HasCommonParent HasEffectKeyword HasFamilyRelationship HasForm HasKeyword HasLOS HasMagicEffect HasMagicEffectWithKeyword HasNode HasParentRelationship HasPerk HasRefType HasSpell HideTitleSequenceMenu IgnoreFriendlyHits IncrementSkill IncrementSkillBy IncrementStat InterruptCast Is3DLoaded IsActionComplete IsActivateChild IsActivateControlsEnabled IsActivationBlocked IsActive IsAlarmed IsAlerted IsAllowedToFly IsArrested IsArrestingTarget IsAttached IsBleedingOut IsBribed IsCamSwitchControlsEnabled IsChild IsCleared IsCommandedActor IsCompleted IsDead IsDetectedBy IsDisabled IsDoingFavor IsEquipped IsEssential IsEuiped IsFactionInCrimeGroup IsFastTravelEnabled IsFightingControlsEnabled IsFlying IsFurnitureInUse IsFurnitureMarkerInUse IsGhost IsGuard IsHostile IsHostileToActor IsIgnoringFriendlyHits IsInCombat IsInDialogueWithPlayer IsInFaction IsInInterior IsInKillMove IsInMenuMode IsInterior IsIntimidated IsInvulnerable IsJournalControlsEnabled IsLoaded IsLockBroken IsLocked IsLookingControlsEnabled IsMapMarkerVisible IsMenuControlsEnabled IsMovementControlsEnabled IsObjectiveCompleted IsObjectiveDisplayed IsObjectiveFailed IsPlayerExpelled IsPlayersLastRiddenHorse IsPlayerTeammate IsPlaying IsProtected IsRunning IsSameLocation IsSneaking IsSneakingControlsEnabled IsSprinting IsStageDone IsStartin IsStarting IsStopped IsStopping IsTrespassing IsUnconscious IsUnique IsWeaponDrawn IsWordUnlocked KeepOffsetFromActor Kill KillSilent KnockAreaEffect LearnAllEffects LearnEffect LearnNextEffect Lock MessageBox ModActorValue ModAV ModCrimeGold ModFactionRank ModFavorPoints ModFavorPointsWithGlobal ModReaction ModRegard MoveTo MoveToInteractionLocation MoveToMyEditorLocation MoveToNode MoveToPackageLocation MoveToWhenUnloaded Mute Notification OpenInventory OpenUserLog OverBudget PathToReference Pause PlaceActorAtMe PlaceAtMe Play PlayAndWait PlayAnimation PlayAnimationAndWait PlayerKnows PlayerMoveToAndWait PlayerPayCrimeGold PlayGamebryoAnimation PlayIdle PlayIdleWithTarget PlayImpactEffect PlaySubGraphAnimation PlaySyncedAnimationAndWaitSS PlaySyncedAnimationSS PlayTerrainEffect PopTo pow PrecacheCharGen PrecacheCharGenClear ProcessTrapHit PushActorAway QueryStat QuitGame QuitToMainMenu RadiansToDegrees RandomFloat RandomInt RegisterForAnimationEvent RegisterForLOS RegisterForSingleLOSGain RegisterForSingleLOSLost RegisterForSingleUpdate RegisterForSingleUpdateGameTime RegisterForSleep RegisterForTrackedStatsEvent RegisterForUpdate RegisterForUpdateGameTime ReleaseOverride RemoteCast Remove RemoveAddedForm RemoveAllInventoryEventFilters RemoveAllItems RemoveCrossFade RemoveDependentAnimatedObjectReference RemoveFromAllFactions RemoveFromFaction RemoveHavokConstraints RemoveInventoryEventFilter RemoveItem RemovePerk RemoveShout RemoveSpell RequestAutoSave RequestModel RequestSave Reset ResetHealthAndLimbs ResetHelpMessage RestoreActorValue RestoreAV Resurrect Revert Say SendAnimationEvent SendAssaultAlarm SendPlayerToJail SendStealAlarm SendStoryEvent SendStoryEventAndWait SendTrespassAlarm SendWereWolfTransformation ServeTime Set SetActive SetActorCause SetActorOwner SetActorValue SetAlert SetAllowFlying SetAlly SetAlpha SetAngle SetAnimationVariableBool SetAnimationVariableFloat SetAnimationVariableInt SetAttackActorOnSight SetAV SetBeastForm SetBribed SetCameraTarget SetCleared SetCrimeFaction SetCrimeGold SetCrimeGoldViolent SetCriticalStage SetCurrentStageID SetDestroyed SetDoingFavor SetEnemy SetEssential SetFactionOwner SetFactionRank SetFogPlanes SetFogPower SetFootIK SetForcedLandingMarker SetFrequency SetGhost SetGodMode SetHeadTracking SetHudCartMode SetInChargen SetINIBool SetINIFloat SetINIInt SetINIString SetInstanceVolume SetIntimidated SetInvulnerable SetKeywordData SetLockLevel SetLookAt SetMotionType SetNoBleedoutRecovery SetNoFavorAllowed SetNotShowOnStealthMeter SetObjectiveCompleted SetObjectiveDisplayed SetObjectiveFailed SetOpen SetOutfit SetPlayerAIDriven SetPlayerControls SetPlayerEnemy SetPlayerExpelled SetPlayerReportCrime SetPlayerResistingArrest SetPlayerTeammate SetPosition SetProtected SetPublic SetRace SetRaction SetReaction SetRelationshipRank SetRestrained SetScale SetSittingRotation SetStage SetUnconscious SetValue SetVehicle SetVoiceRecoveryTime SetVolume ShakeCamera ShakeController Show ShowAsHelpMessage ShowBarterMenu ShowFirstPersonGeometry ShowGiftMenu ShowRaceMenu ShowRefPosition ShowTitleSequenceMenu ShowTrainingMenu sin SplineTranslateTo SplineTranslateToRefNode sqrt Start StartCannibal StartCombat StartFrameRateCapture StartObjectProfiling StartScriptProfiling StartStackProfiling StartTitleSequence StartVampireFeed Stop StopCombat StopCombatAlarm StopInstance StopObjectProfiling StopScriptProfiling StopStackProfiling StopTranslation TakeScreenshot tan TeachWord TetherToHorse ToggleAI ToggleCollisions ToggleMenus Trace TraceConditional TraceStack TraceUser TranslateTo TrapSoul TriggerScreenBlood TryoEnable TryToAddToFaction TryToDisable TryToKill TryToMoveTo TryToRemoveFromFaction TryToReset TryToStopCombat UnequipAll UnEquipItem UnequipItem UnequipShout UnequipSpell UnLockOwnedDoorsInCell UnlockWord UnMute UnPause UnregisterForAnimationEvent UnregisterForLOS UnregisterForSleep UnregisterForTrackedStatsEvent UnregisterForUpdate UnregisterForUpdateGameTime UpdateCurrentInstanceGlobal UsingGamepad Wait WaitForAnimationEvent WaitGameTime WaitMenuMode WillIntimidateSucceed WornHasKeyword</Keywords>
                <Keywords name="Words2">OnActivate OnAnimationEvent OnAttachedToCell OnBeginState OnCellAttach OnCellDetach OnCellLoad OnClose OnCombatStateChanged OnContainerChanged OnDeath OnDying OnDestructionStageChanged OnDetachedFromCell OnEffectFinish OnEffectStart OnEndState OnEnterBleedout OnEquipped OnGainLOS OnGetUp OnGrab OnHit OnInit OnItemAdded OnItemRemoved OnLoad OnLocationChange OnLockStateChanged OnLostLOS OnMagicEffectApply OnObjectEquipped OnObjectUnequipped OnOpen OnPackageChange OnPackageEnd OnPackageStart OnRaceSwitchComplete OnRead OnRelease OnReset OnSell OnSleepStart OnSleepStop OnStoryActivateActor OnStoryAddToPlayer OnStoryArrest OnStoryAssaultActor OnStoryBribeNPC OnStoryCastMagic OnStoryChangeLocation OnStoryCraftItem OnStoryCrimeGold OnStoryCure OnStoryDialogue OnStoryDiscoverDeadBody OnStoryEscapeJail OnStoryFlatterNPC OnStoryHello OnStoryIncreaseLevel OnStoryIncreaseSkill OnStoryInfection OnStoryIntimidateNPC OnStoryJail OnStoryKillActor OnStoryNewVoicePower OnStoryPayFine OnStoryPickLock OnStoryPlayerGetsFavor OnStoryRelationshipChange OnStoryRemoveFromPlayer OnStoryScript OnStoryServedTime OnStoryTrespass OnTrackedStatsEvent OnTranslationAlmostComplete OnTranslationComplete OnTranslationFailed OnTrapHit OnTrapHitStart OnTrapHitStop OnTrigger OnTriggerEnter OnTriggerLeave OnUnequipped OnUnload OnUpdate OnUpdateGameTime OnWardHit</Keywords>
                <Keywords name="Words3">Action Activator ActiveMagicEffect Actor ActorBase Alias Ammo Apparatus Armor AssociationType Book Cell Class ConstructibleObject Container Debug Door EffectShader Enchantment EncounterZone Explosion Faction Flora Form FormList Furniture Game GlobalVariable Hazard Idle ImageSpaceModifier ImpactDataSet Ingredient Key Keyword LeveledActor LeveledItem LeveledSpell Light Location LocationAlias LocationRefType MagicEffect Math Message MiscObject MusicType ObjectReference Outfit Package Perk Potion Projectile Quest Race ReferenceAlias Scene Scroll Shout SoulGem Sound SoundCategory Spell Static TalkingActivator Topic TopicInfo Utility VisualEffect VoiceType Weapon Weather WordOfPower WorldSpace</Keywords>
                <Keywords name="Words4">As Auto AutoReadOnly Bool Conditional Debug Else ElseIf EndProperty Extends False Float Game Global Hidden Import Int Length New None Parent Property Return ScriptName Self String True Utility</Keywords>
            </KeywordLists>
            <Styles>
                <WordsStyle name="DEFAULT" styleID="11" fgColor="000000" bgColor="FFFFFF" fontName="" fontStyle="0" />
                <WordsStyle name="FOLDEROPEN" styleID="12" fgColor="0000FF" bgColor="FFFFFF" fontName="" fontStyle="1" />
                <WordsStyle name="FOLDERCLOSE" styleID="13" fgColor="0000FF" bgColor="FFFFFF" fontName="" fontStyle="1" />
                <WordsStyle name="KEYWORD1" styleID="5" fgColor="000000" bgColor="FFFFFF" fontName="" fontStyle="1" />
                <WordsStyle name="KEYWORD2" styleID="6" fgColor="800000" bgColor="FFFFFF" fontName="" fontStyle="1" />
                <WordsStyle name="KEYWORD3" styleID="7" fgColor="008000" bgColor="FFFFFF" fontName="" fontStyle="1" />
                <WordsStyle name="KEYWORD4" styleID="8" fgColor="0000FF" bgColor="FFFFFF" fontName="" fontStyle="1" />
                <WordsStyle name="COMMENT" styleID="1" fgColor="000000" bgColor="FFFFFF" fontName="" fontStyle="3" />
                <WordsStyle name="COMMENT LINE" styleID="2" fgColor="000000" bgColor="FFFFFF" fontName="" fontStyle="2" />
                <WordsStyle name="NUMBER" styleID="4" fgColor="0000FF" bgColor="FFFFFF" fontName="" fontStyle="0" />
                <WordsStyle name="OPERATOR" styleID="10" fgColor="000000" bgColor="FFFFFF" fontName="" fontStyle="1" />
                <WordsStyle name="DELIMINER1" styleID="14" fgColor="000000" bgColor="FFFF00" fontName="" fontStyle="2" />
                <WordsStyle name="DELIMINER2" styleID="15" fgColor="000000" bgColor="FFFFFF" fontName="" fontStyle="0" />
                <WordsStyle name="DELIMINER3" styleID="16" fgColor="000000" bgColor="FFFFFF" fontName="" fontStyle="0" />
            </Styles>
        </UserLang>
    </NotepadPlus>
    
  2. Open Notepad++
  3. Open the "User Defined Language" window via View -> User-Defined Dialogue...
  4. Select "Import..."
  5. Select the XML file you created earlier.
  6. If the import was successful, you should see a notification saying "Import successful."

Now, when you open up Papyrus source files (with the extension .psc) Notepad++ will automatically highlight them for you.

If you are creating your own script from scratch, you'll need to select the language manually. "Papyrus" should be available near the bottom of the Language menu in Notepad++.

Darker Syntax Highlighting

If the above is too bright for your eyes then you can try a darker approach which can be found here User:PROXiCiDE/Notepad++_Dark.xml

Papyrus Source code Beautifier

  1. Can be found here User:PROXiCiDE/SkyIndent.lua
  2. This script requires LUA to be installed for it to work http://www.lua.org/download.html
  3. To get this to work with Notepad++ just press F5 then type
  4. Copy & Paste the following below in the RUN box
  5. lua "[install path]\skyindent.lua" -b "$(FULL_CURRENT_PATH)"
    
  6. [install path] is the directory where you placed the SkyIndent.lua example "C:\SkyIndent\"
  7. Select Save
  8. Name it: SkyIndent
  9. Select a keyboard shortcut example: CTRL+F6
  10. Usage skyindent.lua [options] [script.psc]
    Available options are:
            -s[number]  Spacing to indent, TAB spacing is default
            -b          Backup the Papyrus Script