Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

FEATURE: Custom Scripts Arguments Overhaul #101

Merged
merged 10 commits into from
May 1, 2024

Conversation

OcelotWalrus
Copy link
Member

@OcelotWalrus OcelotWalrus commented Apr 30, 2024

FEATURE

Summary

For starters, this PR is a part of a new wiki page guide, the Custom Scripting Guide which's an in-depth guide about custom scripting in Bane Of Wargs. This wiki page first introduces what a custom script and where they can be ran from the game data files, with an example of a custom script, then an explanation about arguments, and finally a detailed database about every functions of the game engine, for future content creators.

The PR first adds a set of new arguments you can choose from, whose goal is to be able to run any game engine function from a script; but it also adds a new feature, that allow data files to specify created arguments, with its custom value:

script name: my_script.py
arguments:
- player  # regular arguments
- zone
- custom_one: { first_key: ["hello", "hi"], second_key: true }  # a custom-made argument, that can be of any kind, as here it's a dictionary, that contains a boolean key and a list key

Usage examples

For example, let's say we wanna create a custom script that downloads the source/main.py file of this github repository. In the past, we'd make a specific script just to download that specific. So if later I'd want to download another file, another different script would be required. But now, you can just create a script, that passes an argument that can be "custom-made", so any file can be download:

[some event data]
actions:
  run scripts:
    - script 0:
      script name: download_fsspec.py
      arguments:
      - file_path: "source/main.py"
    - script 1:
      script name: download_fsspec.py
      arguments:
      - file_path: "source/battle.py"

The download_fsspec.py file:

from data_handling import temporary_git_file_download

def run(file_path):
    cout(  # print the file content to the console, but we could also save it to the player data so it could be used later if we want
        temporary_git_file_download(
            file_path, "https://github.com/Dungeons-of-Kathallion/Bane-Of-Wargs.git"
        )
    )

run(file_path)

Many other examples could be use to show the application of this new feature.

Testing Done

Everything tested.

Testing Method

You can try making your own custom script with the new wiki page guide.

Performance Impact

N/A

Check-List

  • Review my own code
  • Fix the workflow checks
  • Finish wiki page
  • Finish engine documentation

@OcelotWalrus OcelotWalrus added documentation Improvements or additions to documentation enhancement New feature or request labels Apr 30, 2024
@OcelotWalrus OcelotWalrus added this to the New Features milestone Apr 30, 2024
@OcelotWalrus OcelotWalrus self-assigned this Apr 30, 2024
@OcelotWalrus
Copy link
Member Author

Hey @lumbar527! Would you mind giving this PR a review, thanks! (it's mostly documentation)

.github/CONTRIBUTING.md Outdated Show resolved Hide resolved
docs/CONTRIBUTING.md Outdated Show resolved Hide resolved
docs/ENGINE_FUNCTIONS.md Outdated Show resolved Hide resolved
docs/ENGINE_FUNCTIONS.md Outdated Show resolved Hide resolved
docs/ENGINE_FUNCTIONS.md Outdated Show resolved Hide resolved
docs/ENGINE_FUNCTIONS.md Outdated Show resolved Hide resolved
docs/ENGINE_FUNCTIONS.md Outdated Show resolved Hide resolved
docs/ENGINE_FUNCTIONS.md Outdated Show resolved Hide resolved
Thanks for your review!

Co-authored-by: lumbar527 <125756761+lumbar527@users.noreply.github.com>
@OcelotWalrus OcelotWalrus merged commit ee5eafe into master May 1, 2024
12 checks passed
@OcelotWalrus OcelotWalrus deleted the scripts-arguments-overhaul branch May 1, 2024 17:14
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
documentation Improvements or additions to documentation enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants