Giter VIP home page Giter VIP logo

tecext's Introduction

TEC Extender

Extensions and goodies for The Eternal City's Orchil client: http://client.eternalcitygame.com/tec/tec.htm.

If you're looking to check out the game, the best place to start is the wiki: http://eternal-city.wikidot.com/. Here you'll find links to the community Discord, and information on how to get started.

Installation

Walkthrough & Guide

Here's a GREAT walkthrough written by JagerBtFM which does a much better job than the descriptions below of explaining how to get up and running with the extension. Thanks Jager!

https://docs.google.com/document/d/1s0jJVMRsAlHK2J7mT21lr1SA6segsAIY/edit

Note: The manual installation process has changed since this document was written, please see Manual Installation Instructions for more details.

Chrome Web Store

The TEC Extender is now on the Chrome Web Store! Grab it here if you prefer to have it auto update over time and not manually install a specific version: https://chrome.google.com/webstore/detail/tec-extender/aegdmagbofbclblaidikleeophbplmad

Note: As it takes time for new versions to be approved on the web store, this version may be behind compared to what can be found here on GitHub. If you find it's missing features, you can always uninstall it temporarily and grab the latest version here instead.

Manual Installation Instructions

Updated 04/13/2024
These instructions have been updated, see below for updated steps to install the extension manually from this repository.

  1. Navigate to https://github.com/jdalley/tecext/releases and download the latest release's tecext_<version>.zip file, and extract it.
  2. Navigate to chrome://extensions
  3. Make sure Developer Mode is turned on in the top right.
  4. Click Load unpacked in the top left.
  5. In the file browser, navigate to the folder you extracted in step 1 and then click Ok.
  6. The extension is now installed - and it can be accessed by the TEC icon in the extension icon area, or by right clicking anywhere in the Orchil client and clicking '[TEC] Open UI...'

You should see something like this under chrome://extensions if all goes well:

Extensions

UI and Scripts

The UI for the extension's popup (after clicking on its icon in the Chrome extension menu bar in the top right), looks like this:

Extension UI

Configuration Tabs

  • The Comms tab configures the feature where a window is added to the top of Orchil, and communications are added to it (and optionally removed from the main window) based on your choices. Thoughts, OOC, and Speech are supported at the moment. You can also set the size of the window's height in pixels, and optionally provide a comma-separated list of player names to mute from Thoughts & OOC.
  • The Combat tab contains some options used specifically while running combat scripts:
    • Use kill on KO: This does what you'd expect, if you're using a combat script and you want it to automatically use 'kill' when something goes unconscious, it'll do so.
    • Continue on 'walks in': Again, does what you'd expect; for combat scripts it attempts to detect if something walks in/arrives, so if you're in a single combat area waiting for spawns it can continue on its own.
      • Similar to use kill on KO, this will get triggered if ANYTHING walks in or arrives, even another player. It will not target that player - and the worst case scenario here is it just resumes the script with your intended target. So you'll see it try to use the next move even if no target is there. I could fix this similarly to use kill on KO eventually.
    • Use Backwards Rise to stand: this will use the brise command to stand (instead of stand) if you have this skill trained up enough to use it reliably.
    • Use Melee Advance (instead of engage): this will use the advance command instead of engage if you have enough ranks to use it effectively.
  • The General tab contains options not specific to the other categories:
    • Cmd Delay Range (ms): this range is the number of milliseconds the script running code will use between sending commands. This helps avoid the server swallowing commands that would otherwise be sent too quickly after one another. This can be adjusted higher if you're on a bad or unreliable internet connection.
    • Dark Mode: this enables poor man's dark mode for the extension windows (sorry, not super visually appealing, but at least it won't blind you as much).

Main Input and Control

  • Send command does exactly what you'd think, you can enter commands to be sent to the server. Typing in this box and hitting enter will send, then clear the input so you can use it like the normal input in Orchil. If you leave something in the box, then click send - it stays in the box.

  • Repeat will take whatever command you input, and repeat it on 'No longer busy'. Useful for simple stuff.

  • Edit Scripts opens up another window with a really simple JSON editor; you can make your changes to scripts, add new ones etc. When you click Save, it will write the whole script to local storage in chrome, and next time you launch it it'll check there before loading the scriptCollection.json.

    • After Save is clicked, the Choose a script to run dropdown is now updated with your new or updated script.

    Edit Scripts UI

  • The Choose a script to run dropdown starts off with a list of script examples that I continually update, found in this repo at scripts/scriptCollection.json.

    • Weapon/item name: this input is used in scripts as the name of your weapon in case you drop it - it will pick it back up and wield it.
    • Shield: this input is similar to weapon/item, and is used to identify the name of your shield so it can be picked up & wielded when disarmed or knocked away.
    • Target name: this input is used in two different ways:
      • With combat scripts, it will be added to the end of your commands: slash target, ie: slash dog|rat.
      • With any script, you can place <target> anywhere in a command, and it will be replaced by whatever is in the target input. ie: if 'right arm' is in the input, "command": "bandage <target> with bandages" will be: bandage right arm with bandages.
  • Run Script: clears all current values of any in-progress scripts, and uses the weapon/target to start the selected script from scratch.

  • Pause/Resume Script: self explanatory, for pausing and resuming the current script.

  • Stop Script: stops the currently running script, and clears all current values set by that script.

You can also get to the 'Edit Scripts' popup by clicking on the following button that appears above the macro section:

image

Script Syntax

The following are example scripts of each type (Combat and Non-Combat), with comments above the keywords to explain their usage. Note that the best way to practice and learn how to utilize these is to reference existing default scripts while experimenting with your own!

Combat Script

Combat scripts have special handling logic, which has automatic handling for certain scenarios like:

  • dropping your weapon or shield; picks it up and wields it
  • being unable to perform an attack due to being entangled; sends free
  • automatically engage enemies when they aren't close enough to hit
    • will use melee advance instead if turned on in settings
  • continuing the script if you get stunned
  • being knocked down; stands you up using either stand or brise
  • correctly wielding weapons when told You must be wielding...
  • if melee advance is turned on, uses it when told You'll have to retreat first
  • handles moving you into a normal stance if told you're in berserk/defensive
    • this may happen if trying to do a stance-changing attack and failing
{
  // Adds the innate `attack` command to your rotation, useful if you don't know many 
  // attacks yet.
  "addAttack": false,
  // The list of commands you want to run, in the order they'll run
  // Note: all scripts loop unless you add a command: `"/stop"`
  "commandList": [
    {
      // The text that will be sent to the game when this command runs.
      // Note: the use of `<target>` here is not the in-game target - but the one you set
      // when starting your script using the extension. It will be replaced and is often
      // used if you want to add it in the middle of a command instead of at the end 
      // (where it's added automatically).
      "command": "pslash <target> high",
      // One or more set of outcomes that the script will look for in the game's output
      // in order to decide when to move to the next command.
      // Note: some `parse`s have square brackets (denoting a list) like this one. This
      // is to tell the script to check more than one possible outcome to check for
      // the command.
      "parse": [
        {
          // If the `outcome` below this has happened already, this is the text that
          // actually causes the script to move to the next command.
          "moveNextWhen": "You are no longer busy",
          // The text the script is looking for from the game output to flag that it's
          // now time to begin moving to the next command.
          "outcome": "Sliding your front leg back"
        },
        {
          "moveNextWhen": "You are no longer busy",
          "outcome": "You start to fumble"
        }
      ]
    },
    {
      // This is an example of a command that doesn't need to aim high, and without 
      // including `<target>`, the script will add the target after the command 
      // automatically when it sends it to the game.
      "command": "upslash",
      // This is an example of a single parse outcome to check.
      "parse": {
        "moveNextWhen": "You are no longer busy",
        "outcome": "You twist your wrists"
      }
    },
    {
      "command": "strike <target> high",
      "parse": [
        {
            "moveNextNow": true,
            "outcome": "is not wielding anything"
        },
        {
            "moveNextWhen": "You are no longer busy",
            "outcome": "With a quick snapping motion, you"
        }
      ]
      }
  ],
  // If this is true, the script will run the current command when an enemy walks into
  // the area, arrives, or appears in some other fashion. Without this, the script 
  // will essentially stop until it finds the current 'outcome' it's looking for. 
  "continueOnWalkIn": true,
  // This appears as the longer name in the UI describing the purpose of your script.
  "scriptFriendlyName": "Spear Hunting - Aim High",
  // Short name for the script used in slash commands and internally to identify the 
  // script. This must be unique among all scripts.
  "scriptName": "spearHuntHigh",
  // Denotes this as a combat script
  "scriptType": "combat",
  // If true, the script sends the `kill` command when your target falls unconscious.
  "shouldKill": true,
  // This is the `outcome` the script looks for to identify when you've successfully
  // killed a target with the `kill` command, and will continue the next command.
  "shouldKillParse": "You thrust your",
  // If you don't have stance mastered so it auto-assumes, this command will be used
  // to enter your stance when the game tells you `You are not in the correct stance`.
  "stanceCommand": "scorpion",
  // If this command is used in a script, it will replace the usage of the `free` 
  // command when your weapon is entangled.
  // The commands work in the following ways:
  //  - Note: `fling` is an example, you would replace this with your freeing ability.
  //  - "fling <weapon>": You need to literally use <weapon> here, and it'll be replaced
  //    dynamically with what is entered as your weapon name when starting the script.
  //  - "fling gladius": You can 'hard-code' the name of your weapon here and it'll use it.
  //  - "fling": This will work as expected if the ability doesn't need to also target
  //    your weapon by name.
  "entangledCommand": "fling <weapon>"
},

Non-Combat Scripts

The Non-Combat script type shares most of the commands/syntax and interpretations with the combat scripts. However, you'll note there is some combat-script specific syntax in the above examples that are not used in nonCom scripts, like addAttack, continueOnWalkIn, shouldKill, and shouldKillParse.

These scripts are more simplistic and generic, and don't have all the automatic scenario handling that combat scripts have.

Note that all of the syntax/features mentioned below are also available for Combat scripts, I'm just separating the explanations as the Combat example is very busy.

{
  "commandList": [
    {
      "command": "bait pole with worm",
      // This causes a 5 second delay (in milliseconds) before running the next command after
      // the `outcome` conditions of this command are met.
      "delayBeforeNext": 5000, 
      "parse": [
        {
          "moveNextWhen": "You are no longer busy",
          "outcome": "You bait a"
        },
        {
          // This causes the script to immediately send the next command after it detects
          // the `outcome` below, as opposed to waiting for `moveNextWhen`.
          // Note: this replaces the use of `moveNextWhen`, and they shouldn't be used
          // together inside any one `parse`.
          "moveNextNow": true,
          "outcome": "is already baited"
        }
      ]
    },
    {
      "command": "cast pole",
      "parse": {
        "moveNextWhen": "You are no longer busy",
        "outcome": "no longer has any bait on it"
      }
    }
  ],
  "scriptFriendlyName": "Fish With Worms",
  "scriptName": "fishworms",
  // Denotes this as a Non-Combat script
  "scriptType": "nonCom"
},
{
  "commandList": [
    {
      "command": "echo <target>",
      "parse": {
        "moveNextWhen": "Now you repeat it",
        // If you leave outcome empty like this, the script will not try to check for an outcome, 
        // and will just immediately move to the next command when it detects `moveNextWhen`.
        // This is useful if your intent is to immediately repeat a command or move to the next
        // one without needing to wait for a second condition like "You are no longer busy".
        "outcome": ""
      }
    }
  ],
  "scriptFriendlyName": "Language Echo",
  "scriptName": "languageEcho",
  "scriptType": "nonCom"
},
{
  "commandList": [
    {
      "command": "palm",
      "parse": [
        {
          "moveNextWhen": "You are no longer busy",
          // Players will be aware you can use the | character in game to collect multiple
          // things to look for into one command, this works similarly. Adding | between
          // outcomes is a replacement for having multiple parses in some cases. In this
          // specific case I'm using a mix of `moveNextWhen` and `moveNextNow`, so I still
          // need multiple parses, but otherwise I could use this feature to shorten my 
          // script to one parse!
          "outcome": "You very nimbly palm|You barely manage to palm|You nearly drop a|You manage to palm"
        },
        {
          "moveNextNow": true,
          "outcome": "You are already palming that"
        }
      ]
    },
    {
        "command": "unpalm",
        "parse": {
            "moveNextNow": true,
            "outcome": "You flip your wrist"
        }
    }
  ],
  "scriptFriendlyName": "Palming",
  "scriptName": "palming",
  "scriptType": "nonCom"
},
{
  "commandList": [
    {
      "command": "wait for ferry",
      "parse": [
        {
          "moveNextNow": true,
          // `<target>` can also be used in `outcome`, again this is the script target not
          // the in-game target.
          "outcome": "Next destination is <target>"
        },
        {
          "moveNextNow": true,
          "outcome": "You arrive at an a small river ferry"
        }
      ],
      // This tells the script not to add your current script-set `target` to the end of the
      // command. This is useful for commands that do not need a target at the end or 
      // anywhere in the middle using `<target>`.
      // Note: this works with combat scripts as well, and can be seen by example in the
      // default archery scripts for loading a bow.
      "targetRequired": false
    },
    {
      "command": "wait for dock",
      "parse": [
        {
          "moveNextNow": true,
          "outcome": "You arrive at"
        }
      ],
      "targetRequired": false
    },
    {
      // This is a good example of some extra flexibility that the extension's slash commands
      // offer. In this case we're stopping the script (it won't loop) after we get to this 
      // command, but you can imagine instead using `/start` to chain into a second script!
      "command": "/stop",
      "parse": {
        "moveNextWhen": "Never",
        // When stopping a script like this, I've opted to put text I don't expect to be 
        // read from the game in here so things don't break, this isn't strictly necessary
        // however.
        "outcome": "Nothing"
      },
      "targetRequired": false
    }
  ],
  "scriptFriendlyName": "Ferry To <target>",
  "scriptName": "ferry",
  "scriptType": "nonCom"
},

Slash Commands

Additionally, there are some slash commands you can enter in the game input to take advantage of some features without leaving the input. Type /help to view available command information, where you'll get output like this in red text:

The /help slash command output

You can get a list of current scripts available with /scripts:

Example available scripts list from /scripts command

Here are a few examples for the /start command:

  • /start twohandcore dog|rat two-handed
  • /start outdoorsBasic
    • In this case you can see the target/weaponItemName are not added, this is because they aren't required for nonCom type scripts (check the example scripts for an example of nonCom vs combat). Any command starting with a forward slash is not sent to the TEC server, instead it's interpreted by the extension. Additionally, all messages from the extension will be in a consistent red text with a smaller font size to distinguish it.

tecext's People

Contributors

jdalley avatar jdalley-dominos avatar

Stargazers

 avatar  avatar

Watchers

 avatar

Forkers

tscheer86 zuzu350

tecext's Issues

Add a toggle to use 'brise' instead of 'stand' when knocked down

While we're here, let's move some config around:

  • Add a new configuration tab for Combat
  • Move existing combat toggles for kill and continue on walks in into this new tab.
  • Add a new toggle to use brise instead of stand when knocked down. It should be off by default.

Add a setting to define a custom command time delay range

It was suggested that a custom delay could be added to commands within a script to buffer time before going to the next action.

{
    "command": "echo <target>",
    "delayNextCommand": "5",
    "parse": {
        "moveNextWhen": "Now you repeat it",
        "outcome": ""
    }
}

Update:
I decided to instead add a global delay range that's configurable in the client, with a fallback to 900 - 1100 milliseconds. This will be added in a new config tab General.

Optimistically change targets when out of range

For combat scripts, in the following scenarios, we want to run the command ac <target>, where <target> is the internally tracked target entered when the script was started (not the TEC concept of a for macros).

  1. You'll have to retreat first
  2. There aren't that many there

Might have to check the exact wording on those, but in both cases we want to take the results of ac <target>, and track an attempt to move to the next on the list. For example: change the to 2 <target>, then 3 <target> etc, with logic for a reset back to just <target>

Expanded Detail After Investigation

Here is what we get back in a single block from the server when we use the command ac <target>, ie: ac man|rat:

</pre><pre><font size=+1><b>Checking the approach status of &quot;man|rat&quot;</b></font></font>
<hr>
1: a dirt-caked man with milky-white eyes and greasy hair(unconscious)
2: a gaunt rat with milky-white eyes (engaging) 
3: a filthy man with milky-white eyes and pale skin (engaging) 
<hr>
</pre>

Regex psuedo:

  • Starts with a number and a :, ends with (engaging). Capture the group between the two.
  • After capture, use the first one found (first (engaging));

Steps:

  1. Move any other out of range related code into this function to handle it centrally.
  2. When you get the message: You'll have to retreat first, it's time to switch targets.
  3. Run the ac ${target} command, and parse the output to find the first (highest number) target on the list that is (engaging).
  4. Add a new variable to track ${targetOverride}, and add support in the main attack loop targeting code.
  5. Determine when to reset ${targetOverride} (set it to ''); likely when you get one of these messages:
    • There aren't that many there
    • You can't
  6. Add support in command parsing to handle having a number before a target, ie: 2 man|rat.

Allow multiple 'outcome' statements in a single parse

Right now you have to provide an array of parses when you have multiple outcomes for a given command. It was suggested that instead we could make an or syntax.

What it's like today:

{
    "command": "sbash",
    "parse": [
        {
            "moveNextWhen": "You are no longer busy",
            "outcome": "You bash"
        },
        {
            "moveNextWhen": "You are no longer busy",
            "outcome": "with your shield bash!"
        }
    ]
},

Perhaps it could be something like:

{
    "command": "sbash",
    "parse": {
        "moveNextWhen": "You are no longer busy",
        "outcome": "You bash|with your shield bash!"
    }
},

Add global parses and actions

It would be useful to be able to define, either by variables in the UI/settings or in the script itself, a way to have global (parse -> action)s defined.

For example:

  • Stop/pause script execution if someone walks into your area.
  • Stand if you are knocked down (without having to rely the function in combat scripts that will stand if you try an action that says you must be standing - this wastes time).

Adding a Shield box under weapons

For folks who use both a weapon and a shield, adding in shields as a separate field in addition to the weapon would be helpful. Then when the code can't conduct an attack due to non-wielding, have it attempt to wield both fields

Add thoughts, says, and whispers to a separate window

Suggestion from JagerBtFM from Discord:

Is there any chance you could make the extension box bigger OR make a second window pop up, which would just show tells, says, whispers and thinks in it? Kinda like the communications box from the mIRC client? I hate missing speech and thinks during multiple opponent combat.

Implementation thoughts:

  • Could add this in the TEC window itself, pinned to the top of the screen with adjustable size. This may not work too well with the way the core Orchil display renders.
  • Adding it to the pop-out window for the extension would probably be fine, it's certainly due for an overhaul in general.

AIM'ing Breaks kill command

When attacking a specific area of the body...

i.e. /start archshot "sea|sail neck"
Result: "When the TARGET falls unconscious: "Neck" is not necessary; try again without it."

The desire is for the TARGET to be killed regardless of the AIM.

@jdalley

Add config for custom approach command

The idea would be to have a text box where you could enter your preferred approach command if your weapon set has an attack that approaches ie: Falcata Tumble Slash.

If a value exists here we'd use it instead of advance or engage.

Implement a 'travel' script type

It might be useful to have a type of script with a different notation for inputting a terse, comma-delimited list of directions for getting from point A to B.

{
  "directions": "e-5, s-10, e-4, n-3, se-2, up, 2 door, down",
  "scriptType": "travel"
}

Support a Macro Rotation

Right now it's not possible to just specify a combat script that calls macros after setting a target using the in-game target command.

It would be cool to create a script possibility like this with a new scriptType, combatMacro:

 {
        "addAttack": false,
        "commandList": [
            {
                "command": "fe1",
                "parse": {
                    "moveNextWhen": "You are no longer busy"
                }
            },
            {
                "command": "fe2",
                "parse": {
                    "moveNextWhen": "You are no longer busy"
                }
            },
            {
                "command": "fe3",
                "parse": {
                    "moveNextWhen": "You are no longer busy"
                }
            },
            {
                "command": "fe4",
                "parse": {
                    "moveNextWhen": "You are no longer busy"
                }
            },
            {
                "command": "fe5",
                "parse": {
                    "moveNextWhen": "You are no longer busy"
                }
            }
        ],
        "scriptFriendlyName": "Macro: fe1-fe5",
        "scriptName": "macroRotation2ha",
        "scriptType": "combatMacro",
        "shouldKill": true,
        "shouldKillParse": "With massive force",
        "stanceCommand": "wgrip"
    },

The script should take the target you want to set as target in-game, and set that target as the script begins.

'walks in/arrives' Break

Mostly seen in high spawn areas such as Signal Tower Island or the Rat Pits. If a target arrives just as the, "You are no longer busy" displays then the script will stall until the next, "walks in/arrives" or manual /resume. @jdalley

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.