---
# System prepended metadata

title: Aliases

---

# Aliases

In Tower Networking inc, **aliases** are custom commands you create and save for future use. 
They persist between sessions, so once added, they’ll always be available the next time you run a different senario or restart the game.

All alias settings are stored in:
> %APPDATA%\Godot\app_userdata\Tower Networking Inc\settings.json

## Adding Aliases

You can create new aliases directly from within the game using the `alias` command. 
However, this means you must type the full command manually each time you add one, which can be slow during gameplay.

This guide will show you how to streamline the process by:
- Installing PowerShell
- Setting up a PowerShell function to quickly add aliases outside the game
- Provide ready-to-use example aliases you can copy into your game

### Installing powershell

1. **Open a terminal** 
Press `Win + X` and select **Windows Terminal** or **PowerShell**.

2. **Check if winget is available** 
```powershell
winget --version
```

3. **Install PowerShell Core (latest stable)**

```
winget install --id Microsoft.Powershell --source winget; pwsh --version
```

4. **Install Tower Network Alias Helper Commands**

```
iwr "https://gist.github.com/Cliftonz/a36c3661afff555fe21dd7834db05236/raw/install-addntalias.ps1" | iex
```

## AddNtAlias Module - Usage Guide

This module manages `cmd_alias` entries in your Godot `settings.json` file  
and **self-updates** from its GitHub Gist when any command runs.

### 🛠 Commands

#### Add-NtAlias

Adds or updates a `cmd_alias` entry.

```powershell
Add-NtAlias -AliasName <alias> -AliasCommand '<command>'
```

**Example:**

```powershell
Add-NtAlias -AliasName cc -AliasCommand 'cron add */5 try ping $1 else notify cant connect to $1 from debugger'
```


#### Get-NtAlias

Lists aliases, or shows one specific alias.

```powershell
Get-NtAlias
Get-NtAlias -AliasName <alias>
```

**Example:**

```powershell
Get-NtAlias
Get-NtAlias -AliasName cc
```


#### Remove-NtAlias

Removes a specific alias.

```powershell
Remove-NtAlias -AliasName <alias>
```

**Example:**

```powershell
Remove-NtAlias -AliasName cc
```


### Notes

* Use **single quotes** around commands containing `$1`, `$2`, etc., to prevent PowerShell from expanding variables.
* The module modifies:

  ```
  %APPDATA%\Godot\app_userdata\Tower Networking Inc\settings.json
  ```


## Alias Library


### Placeholder Rules & How Aliases Work

- `$1`, `$2`, `$3` … are **positional inputs** you supply when running an alias. 
  Example: `watchhost @dns` → `$1 = @dns` 
  Example: `setstatic @dns true` → `$1 = @dns`, `$2 = true`
  
> **Note:** Alias replacement currently does **not** support inline substitutions like `f1/$1`. 
> Placeholders such as `$1`, `$2`, etc. must be used as separate arguments or tokens, 
> not embedded directly within another word or path.

- Aliases are **word replacements**, not just shortcuts at the start of a command. 
  Anywhere the alias trigger word appears in your input, it will be replaced with the alias body. 

For example, if you have:
```

Alias sn net a set $1 

```
Then typing:
```

sn @abc on 123

```
will become:
```

net a set @abc on 123

```


> **Tip:** In PowerShell, wrap commands in **single quotes** when adding to `cmd_alias` so placeholders like `$1` are preserved and not expanded prematurely.

---
### 🧪 Copy-Paste: Adding these aliases to `cmd_alias` (PowerShell)

If you use the module above, here are all of the copy-ready commands to register each alias (run in PowerShell) to add to your game.
> Important: Use **single quotes** so `$1`, `$2`, `$3` are preserved.

```
# Install the cli commands 
iwr "https://gist.github.com/Cliftonz/a36c3661afff555fe21dd7834db05236/raw/install-addntalias.ps1" | iex

# Add all commands listed below
Add-NtAlias -AliasName 'q'             -AliasCommand 'quit'
Add-NtAlias -AliasName 'watchhost'     -AliasCommand 'cron add */15 try ping $1 else notify cant connect to $1 from debugger'
Add-NtAlias -AliasName 'dnscheck'      -AliasCommand 'cron add */15 try dns map test.test as @test on $1 else notify dns is down on $1'
Add-NtAlias -AliasName 'tcpdump'       -AliasCommand 'pcap exclude =tcp/23 on $1'
Add-NtAlias -AliasName 'nodhcp'        -AliasCommand 'net dhcp disable on $1'
Add-NtAlias -AliasName 'setstatic'     -AliasCommand 'try net a set $1 on $2 then dhcp disable on \$2'
Add-NtAlias -AliasName 'ra'            -AliasCommand 'route add'
Add-NtAlias -AliasName 'rr'            -AliasCommand 'route remove'
Add-NtAlias -AliasName 'na'            -AliasCommand 'net a set $1 on $2'
Add-NtAlias -AliasName 'backuprouterjob' -AliasCommand 'cron add */15 try sftp cp /etc/routes.conf on $1 to $2 rename $4 else try sftp cp /etc/routes.conf on $1 to $3 rename $4 else notify backup failed on $1'
```

---

### q — Quit

**What it does:** Exits the current interface/session.

**Usage:**
```
q
```

**Command**
```
Add-NtAlias -AliasName 'q' -AliasCommand 'quit'
```

---

### watchhost — Ping monitor

**What it does:** Every 15 minutes, tries to `ping $1`. If it fails, sends a notification that the host is not reachable from the “debugger”.

\* requires cron to be unlocked

**Alias body:**
```
cron add */15 try ping \$1 else notify cant connect to $1 from debugger
```

**Usage:**
```
watchhost <hdaddr-or-netaddr>
```

**Examples:**
```
watchhost @d0
watchhost 3016
```
**Command**
```
Add-NtAlias -AliasName 'watchhost' -AliasCommand 'cron add */15 try ping $1 else notify cant connect to $1 from debugger'
```

---

### dnscheck — DNS health monitor

**What it does:** Every 15 minutes, attempts to resolve a test mapping via your DNS on target `$1`. Notifies if DNS is down.

\* requires cron to be unlocked

**Alias body:**
```
cron add */15 try dns map test.test as @test on $1 else notify dns is down on $1
```

**Usage:**
```
dnscheck <hdaddr-or-netaddr>
```

**Examples:**
```
dnscheck @d0
dnscheck 30634
```
**Command**
```
Add-NtAlias -AliasName 'dnscheck' -AliasCommand 'cron add */15 try dns map test.test as @test on $1 else notify dns is down on $1'
```

---

### tcpdump — Packet capture excluding host

**What it does:** Starts a packet capture with an exclusion for `$1`.

**Alias body:**
```
pcap exclude =tcp/23 on $1
```

**Usage:**
```
tcpdump <hdaddr-or-netaddr>
```

**Examples:**
```
tcpdump @eth
```
**Command**
```
 Add-NtAlias -AliasName 'tcpdump' -AliasCommand 'pcap exclude =tcp/23 on $1'
```
---

### nodhcp — Disable DHCP on an interface

**What it does:** Turns off DHCP on `$1`.

**Alias body:**
```
net dhcp disable on $1
```

**Usage:**
```
nodhcp <hdaddr-or-netaddr>
```

**Examples:**
```
nodhcp @wan0
```
**Command**
```
Add-NtAlias -AliasName 'nodhcp' -AliasCommand 'net dhcp disable on $1'
```
---
### setstatic — Set static IP and disable DHCP

**What it does:** Sets `$1` netaddr on hdaddr `$2`, then disables DHCP on `$2`.

**Alias body:**
```
try net a set $1 on $2 then dhcp disable on $2
```

**Usage:**
```
setstatic <new-netaddr> <hdaddr-or-netaddr>
```

**Examples:**
```
setstatic @dns 3234
```
**Command**
```
Add-NtAlias -AliasName 'setstatic' -AliasCommand 'try net a set $1 on $2 then dhcp disable on $2'
```
---

### ra — Route add

**What it does:** Adds a route to router. 

\* Just shortens the first part of the command

**Alias body:**
```
route add
```

**Usage (typical):**
```
ra <destination-cidr> via <gateway-ip> dev <interface>
```

**Examples:**
```
ra @d0 via por5 on @d0r1
```

**Command**
```
Add-NtAlias -AliasName 'ra' -AliasCommand 'route add'
```

---

### rr — Route remove

**What it does:** Removes a route.

\* Just shortens the first part of the command

**Alias body:**
```
route remove
```

**Usage:**
```
rr #3 on @d0r1
```

**Command**
```
Add-NtAlias -AliasName 'rr' -AliasCommand 'route remove'
```


---

### na — Assign address to interface

**What it does:** Sets address `$1` on interface `$2`.

**Alias body:**
```
net a set $1 on $2
```

**Usage:**
```
na <new-netaddr> <hdaddr-or-netaddr>
```

**Examples:**
```
na @d0 1342
```

**Command**
```
 Add-NtAlias -AliasName 'na' -AliasCommand 'net a set $1 on $2'
```

---

### backuprouterjob — Recurring config backup with fallback

**What it does:** Every 15 minutes, tries to SFTP copy `/etc/routes.conf` from `$1` to `$2` (renaming to `$4`). If that fails, it tries to copy from `$1` to `$3` (renaming `$4`). If both fail, it sends a failure notification.

\* requires cron and sftp unlocked through proposals

**Alias body (formatted):**
```
cron add */15 
  try
    sftp cp /etc/routes.conf on $1 to $2 rename $4
  else
    try
        sftp cp /etc/routes.conf on $1 to $3 rename $4
    else
        notify backup failed on $1;
```

**Usage:**
```
backuprouterjob <router-addr> <nas-addr> <backup-nas-addr> <backup-name>
```

**Examples:**
```
backuprouterjob @r1 @nas1 @nas2 /r1/routes.conf
```

**Command**
```
 Add-NtAlias -AliasName 'backuprouterjob' -AliasCommand @'cron add */15 try sftp cp /etc/routes.conf on $1 to $2 rename $4 else try sftp cp /etc/routes.conf on $1 to $3 rename $4 else notify backup failed on $1'@
```

> Notes: 
> - `$4` accept whatever your SFTP target syntax requires (e.g., `/ra/routes.conf`). 

