> For the complete documentation index, see [llms.txt](https://code-after-sex.gitbook.io/script-documentation/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://code-after-sex.gitbook.io/script-documentation/cas-blackjack/configuration.md).

# Configuration

Every CAS Blackjack option in config/config.lua with its default: framework, money, admin, round timers, house rules, bet limits, keys, distances, blips and the Discord log.

Every option lives in `config/config.lua`. The tables themselves are in `config/tables.lua` (see [Tables and rules](/script-documentation/cas-blackjack/tables-and-rules.md)) and every word the players read is in `config/locale.lua`. Restart the resource after a change.

## General

| Option             | Default  | Meaning                                                                                                                                        |
| ------------------ | -------- | ---------------------------------------------------------------------------------------------------------------------------------------------- |
| `Config.Framework` | `"auto"` | `"auto"` finds `vorp_core` or `rsg-core`. `"vorp"` or `"rsg"` forces one.                                                                      |
| `Config.Locale`    | `"en"`   | The language table to use from `config/locale.lua`.                                                                                            |
| `Config.Debug`     | `false`  | Prints traces to the server console and the F8 console. Keep it off on a live server.                                                          |
| `Config.Sounds`    | `true`   | The table sounds. `false` turns off the `Minigame_Blackjack_Scene` audio scene, the table soundset and the clicks when the bet amount changes. |

## Money

| Option                  | Default  | Meaning                                                   |
| ----------------------- | -------- | --------------------------------------------------------- |
| `Config.VorpCurrency`   | `0`      | VORP only: `0` cash, `1` gold.                            |
| `Config.RsgMoneyType`   | `"cash"` | RSG only: the money type bets are taken from and paid to. |
| `Config.CurrencySymbol` | `"$"`    | Shown in front of every amount.                           |

## Admin

| Option                | Default            | Meaning                                                                                                               |
| --------------------- | ------------------ | --------------------------------------------------------------------------------------------------------------------- |
| `Config.AdminAce`     | `"command"`        | The ace a player needs for the admin command and the test commands.                                                   |
| `Config.AdminCommand` | `"blackjackadmin"` | The name of the admin command.                                                                                        |
| `Config.TestCommands` | `false`            | `true` lets every player use `/bjtp` and `/bjmoney`. Test servers only: with it on, anyone can give themselves money. |

The two test commands can be renamed by adding `Config.TeleportCommand = "yourname"` and `Config.MoneyCommand = "yourname"` to `config/config.lua` (the defaults are `bjtp` and `bjmoney`). See [Admin and exports](/script-documentation/cas-blackjack/admin-and-exports.md).

## Round timers

| Option                    | Default | Meaning                                                                                                                 |
| ------------------------- | ------- | ----------------------------------------------------------------------------------------------------------------------- |
| `Config.BetSeconds`       | `15`    | Betting stays open this long after the first bet. When every seated player has bet, the deal starts after 1.5 seconds.  |
| `Config.TurnSeconds`      | `20`    | A player's time to act on a hand. A hand that does not act in time stands.                                              |
| `Config.InsuranceSeconds` | `8`     | Time to answer the insurance offer. No answer counts as no insurance.                                                   |
| `Config.CleanupSeconds`   | `1.5`   | A short pause after the dealer has swept the cards, before the next round.                                              |
| `Config.IdleRounds`       | `4`     | A seated player who does not bet this many rounds in a row gets up and the seat is freed.                               |
| `Config.Pace`             | table   | How long the dealer's own clips take, in milliseconds, so the server waits for what the table shows. Leave it as it is. |
| `Config.CatchUpQueue`     | `6`     | A client that falls this many moves behind (after a hitch, for example) plays the rest at once to catch up.             |

`Config.Pace` is the longest the server waits. Each player's game reports when it has finished showing the deal or the settle, and the round goes on as soon as everyone in it has seen the move.

## House rules

```lua
Config.Rules = {
    decks = 6,
    penetration = 0.75,
    hitSoft17 = false,
    blackjackPays = { 3, 2 },
    insurance = true,
    doubleOn = "any",
    doubleAfterSplit = true,
    maxHands = 2,
    resplitAces = false,
    hitSplitAces = false,
    surrender = false,
}
```

| Rule               | Default    | Meaning                                                                                                                           |
| ------------------ | ---------- | --------------------------------------------------------------------------------------------------------------------------------- |
| `decks`            | `6`        | Decks in the shoe.                                                                                                                |
| `penetration`      | `0.75`     | Share of the shoe dealt before it is reshuffled. `0.75` reshuffles after three quarters.                                          |
| `hitSoft17`        | `false`    | `false`: the dealer stands on all 17s. `true`: the dealer hits a soft 17.                                                         |
| `blackjackPays`    | `{ 3, 2 }` | The blackjack payout as a ratio. `{ 6, 5 }` would pay 6:5.                                                                        |
| `insurance`        | `true`     | Offer insurance when the dealer's up card is an ace.                                                                              |
| `doubleOn`         | `"any"`    | Which first two-card totals may double: `"any"`, `"9to11"` or `"10to11"`.                                                         |
| `doubleAfterSplit` | `true`     | Allow doubling on a hand made by a split.                                                                                         |
| `maxHands`         | `2`        | Hands one seat can hold. `2` allows one split, `1` turns splitting off. The table shows two hands per seat, so keep it at 1 or 2. |
| `resplitAces`      | `false`    | Allow splitting aces again. Has no effect while `maxHands` is 2.                                                                  |
| `hitSplitAces`     | `false`    | `false`: split aces get one card each. `true`: split aces can be hit.                                                             |
| `surrender`        | `false`    | `true` lets a player give up a first two-card hand (not after a split) for half the bet back.                                     |

The rules and payouts are explained in [Tables and rules](/script-documentation/cas-blackjack/tables-and-rules.md#house-rules).

## Bet limits

```lua
Config.Limits = {
    low    = { minBet = 1,  maxBet = 50,   step = 1 },
    medium = { minBet = 5,  maxBet = 250,  step = 5 },
    high   = { minBet = 25, maxBet = 1000, step = 25 },
}
```

| Field    | Meaning                                                                       |
| -------- | ----------------------------------------------------------------------------- |
| `minBet` | The smallest bet, in the table money (dollars with the default cash setting). |
| `maxBet` | The largest bet.                                                              |
| `step`   | How much one press of raise or lower bet moves the amount.                    |

Each table picks a preset by name with its `limits` field, or gets its own limits. See [Tables and rules](/script-documentation/cas-blackjack/tables-and-rules.md#changing-the-bet-limits).

## Keys

`Config.Keys` holds the controls. They are the story mode's own minigame inputs, which answer while the blackjack HUD is up. To use another key, put another control hash in its place.

| Key         | Default hash | PC default                   | Action                                         |
| ----------- | ------------ | ---------------------------- | ---------------------------------------------- |
| `sit`       | `0xD51B784F` | E (hold)                     | Sit down at a free seat                        |
| `bet`       | `0x661D8A31` | Enter                        | Place the bet, take insurance                  |
| `alter`     | `0xBDC733EE` | Arrow Up / Down, mouse wheel | The control on the bet amount prompt           |
| `hit`       | `0xA8142713` | H                            | Hit                                            |
| `stand`     | `0x31260507` | S                            | Stand                                          |
| `double`    | `0x74486CA4` | D                            | Double down                                    |
| `split`     | `0x432B111F` | Tab                          | Split                                          |
| `decline`   | `0xCD7DDF9B` | F                            | No insurance, take the bet back, surrender     |
| `handView`  | `0x03F1E7CB` | Right mouse                  | Hand camera on / off (press, no need to hold)  |
| `tableView` | `0xADE09435` | Space                        | Table camera on / off (press, no need to hold) |
| `leave`     | `0xE9094BA0` | Backspace (hold)             | Leave the table                                |

{% hint style="info" %}
Every key is read from this table. `alter` is the control shown on the bet amount prompt, by default the story mode's change bet axis (`INPUT_MINIGAME_CHANGE_BET_AXIS_Y`). The amount itself moves with Arrow Up / Down and the mouse wheel, the same inputs as in the story mode.
{% endhint %}

## Distances

| Option                 | Default | Meaning                                                                                                                    |
| ---------------------- | ------- | -------------------------------------------------------------------------------------------------------------------------- |
| `Config.SitDistance`   | `1.4`   | How close, in meters, you must be to a free chair for the Sit Down prompt.                                                 |
| `Config.WatchDistance` | `30.0`  | Within this range a table loads its dealer, cards and chips and follows the round. It unloads again 10 meters further out. |

## Blips

```lua
Config.Blips = { enabled = true, sprite = 1243830185, scale = 0.2 }
```

| Field     | Default      | Meaning                                                                                               |
| --------- | ------------ | ----------------------------------------------------------------------------------------------------- |
| `enabled` | `true`       | Map blips for the tables. One table can hide its own blip with `blip = false` in `config/tables.lua`. |
| `sprite`  | `1243830185` | The blip sprite hash.                                                                                 |
| `scale`   | `0.2`        | The blip size.                                                                                        |

Each blip is named after the locale's `blip` word and the table label, for example "Blackjack (Blackwater Saloon)".

## Log

```lua
Config.Log = { console = false, webhook = "", username = "Blackjack tables" }
```

| Field      | Default              | Meaning                                                                                                                                                              |
| ---------- | -------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `console`  | `false`              | `true` prints a line to the server console when a player sits down, when a player leaves and for every settled hand (net result and payout).                         |
| `webhook`  | `""`                 | A Discord webhook URL. When set, the same lines are posted to Discord: every sit-down, every leave and every settled hand (table, character, net result and payout). |
| `username` | `"Blackjack tables"` | The name the webhook posts under.                                                                                                                                    |

A log line looks like this (amounts are in cents):

```
[cas-blackjack] settle char=vorp:12 net=500 payout=1000 table=blackwater
```

See [Admin and exports](/script-documentation/cas-blackjack/admin-and-exports.md#table-log) for every line the log writes.

## More

* [Buy CAS Blackjack](https://codeaftersex.com/script/blackjack)
* [Support Discord](https://discord.gg/codeaftersex)
* [All CodeAfterSex scripts](https://codeaftersex.com/scripts)
