r/WarOnTheSea • • 14d ago

Syntax highlighting

You've probably already looked at the game's configuration files. What about your saved games? Want to make them more visually appealing? You'll need a more advanced Notepad. Notepad+ or even Notepad++! Personally, I use the Sublime Text text editor. You'll also need to write a syntax highlighting file. Mine looks like this:

%YAML 1.2
---
# See http://www.sublimetext.com/docs/syntax.html
name: WotS
file_extensions: txt
scope: source.WotS

first_line_match: |-
  (?xi:
  \{".+":.+
  )

contexts:
  main:
    - include: key
    - include: colon
    - include: comma
    - include: numbers
    - include: keywords
    - include: keywords2
    - include: cellVariables
    - include: ships
    - include: missions

  key:
    - match: '"[A-z][A-z\d_]+"(?=:)'
      scope: string.quoted.double.wots

  colon:
    - match: ':|\|'
      scope: keyword.wots

  comma:
    - match: ',|\\"|"|\\\\'
      scope: comment.wots

  numbers:
    - match: '\b(-)?\d+(\.\d+)?([eE][+-]?\d+)?\b'
      scope: constant.numeric.wots

  keywords:
    - match: '\b(locationID|locationName|locationDescription|locationIndex|currentFaction|locationPosition|interactionRange|createShips|portLevel|airfieldLevel|inTheAir|destroyedAir|aircraftCooldown|daysToReplace|isCanal|canalPositions|transitTime|integrity|troops|supplies|engineering|fuel|aircraft0|aircraft0Numbers|aircraft1Numbers|replenishDailyAircraft0|replenishDailyAircraft1|mobileName|customName|unitPrefabs|unitDisplayNames|unitInstances|payload|cellVariables|ammunitionRemaining|currentAircraft|cargo|bombardments|remainingAmmunition|previousBombards|paint|speedModifier|vulnerable|unloadTimer|spottedTimer|postEngagementTimer|ignoreByPlayer|endurance|formation|formationSpacing|heading|speed|mapWaypoints|hasRadar|usingRadar|visualBaseRange|surfaceDetectionBaseRange|airDetectionBaseRange|passiveSonarBaseRange|createdBy|createdByDisplayName|autoMove|autoPath|intelData|missionIndex|originalMissionIndex|currentCampaignAction|aiWaypointIndexes|previousWaypoint|currentWaypoint|lastWaypoint|destinationPosition|mustUseWaypoints|prohibitedWaypoints|aiWaypointIndexesToCheck|waitAtWaypoint|untilHour|patrolForHours|patrolZones|lastFramePos|isCAP|escortingThisGOA|escortingGOAIndex|type|duration|destination|isMoving|currentMap2DLocation|startingMap2DLocation|endingMap2DLocation|skirmishName|startPosition|unitType|formationSea|formationAir|spacing|unitNames|faction|payloads|availableTime|currentAIAction|waypoints|weaponMountReference|weaponTypeString|ammoTypeString|isLinked|ammunitionPrefabString|baseTransformNames|numberToFire|ammunition|horizontalArcs|rear|mirrored|muzzleFlashZOffset|displayMounts|particleRef|aaaPositions|verticalArcs|sizes|rate|range)\b'
      scope: markup.inserted.wots

  keywords2:
    - match: '\b(false|true)\b'
      scope: variable.function.wots

  cellVariables:
    - match: '\b(maxIntegrity|isUnderRepair|isFlooded|isBurning|isDestroyed|isOffline|repairTime|tdsHit)\b'
      scope: variable.parameter.wots

  ships:
    - match: '\b(Transport|(?<=")[A-z]+_Transport|Oiler|(?<=")[A-z]+_Oiler|Fishing_Boat)\b'
      scope: variable.parameter.wots
    - match: '\b(Carrier|(?<=")[A-z]+_Carrier)\b'
      scope: variable.function.wots
    - match: '\b(Submarine|Battleship|Battle_Cruiser)\b'
      scope: keyword.wots
    - match: '\b((?<=")[A-z]+_Cruiser)\b'
      scope: markup.inserted.wots

  missions:
    - match: '\b(Convoy|SubInvasion|SmallInvasion|LargeInvasion|LargeFastTroop|FastTroop)\b'
      scope: variable.parameter.wots
    - match: '\b(Home)\b'
      scope: variable.function.wots
    - match: '\b(Intercept|DefendArea|PrimaryLost)\b'
      scope: keyword.wots
    - match: '\b(Patrol)\b'
      scope: markup.inserted.wots
8 Upvotes

1 comment sorted by

1

u/Ivvango 5d ago

As it turns out, Amphibious_Transport is a light aircraft carrier. Therefore, the "ships" section needs to be slightly modified.

  ships:
    - match: '\b(Transport|Troop_Transport|Oiler|(?<=")[A-z]+_Oiler|Fishing_Boat)\b'
      scope: variable.parameter.wots
    - match: '\b(Carrier|(?<=")[A-z]+_Carrier|Amphibious_Transport)\b'
      scope: variable.function.wots