Skip to content

Repository files navigation

!!! WARNING !!!

This repository's code is broken and you shouldn't use it. I'm probably never going to come back and work on this either. If you want to make a pull request to fix this code, that pull request must contain a library loading mechanism that:

  • Loads every library in a user-defined order
  • Has some sort of symbol export mechanism (e.g. an expression as the last statement of an eval'd string which returns an object containing a library's API)
  • Transparently presents symbols from a certain library to its corresponding hook when that hook eventually executes
  • Reverses the order of output hooks

These criteria are to preserve backwards compatability and create a stack-based resolution order.

Example loading order:

Library 1
Library 2
...
Input Hook 1
Input Hook 2
...

Example loading order:

Library 1
Library 2
...
Output Hook n-1
Output Hook n-2
...

So,

If Library 1 contains the code:

// This module is named 'Mod1'
const pi = 3.14159 // etc.

{ pi } // Export `pi`

Then Input Hook 1 should be able to use it like so:

// This module is named 'Mod1'
const modifier = (text) => {
	return pi.toString() + text // This should work regardless of whether `pi` was explicitly exported or not for backward compatability reasons
}

modifier(text)

And any other module loaded after should be able to use it like so:

// This module is named 'Mod57'
// blah blah blah code code code
doSomething(Mod1.pi)
// blah blah blah code code code

AI Dungeon (programming Aid)

Just a few things that can make scenario coding more flexible, and can allow you to run and manage JavaScript code from within individual adventures.

Features:

  • Support for modules
    • You can (easily?) import someone else's Library.js, Input.js, Context.js, and Output.js as a module to use in your own scenario, or even adventure
    • Tired of not being able to use more than one person's scripts at a time? This is the workaround. (hopefully they don't make each other explode tho lmao)
  • Basic support for chat commands (singleplayer only for now - will be updated soon)
    • Submit a do or a say action with the command /help to list all available commands and see a brief description of each
    • Run /js <YOUR CODE HERE> to see immediate code execution
    • Chat commands to manage modules
    • Chat commands are automatically removed from the context and are hidden from the AI
    • You can make your own chat commands! (tho it's a little janky rn)
  • Edit the context easier using the splatContext, inject, and unsplatContext functions

About

Code for AI Dungeon Stuff

Resources

Stars

1 star

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages