Skip to main content

A library that makes automating events in ADOFAI levels more convenient.

Project description

This is a library that makes automating events in ADOFAI levels more convenient.
List of Functions:


getFileString(filename : str) -> str
  • Returns the ADOFAI file as a string.
  • It is recommended to use getFileDict() instead.

getFileDict(filename : str) -> dict
  • Returns the specified file in the form of nested dictionaries and lists.
  • Refer to any .adofai file to see the structure of this dictionary.
  • Use this for any function with leveldict as an argument.

addEvent(event : dict, leveldict : dict) -> dict
  • Adds the given event to leveldict and returns a copy of leveldict.
  • Remember to reassign the output to the original dictionary!
  • Most fields can be omitted, in which case a default value is used.
  • Note: Events are always in the form of dictionaries. Their structure and field names are the same as how they appear in .adofai files.

searchEvents(searchfor : dict, leveldict : dict) -> list[dict]
  • Returns a list of all events in leveldict that match all fields in searchfor.
  • For example,
    searchfor={"eventType": "moveDecorations", "tag": "sampleTag"}
    will return a list of all moveDecoration events with tag sampleTag.
  • This function directly modifies leveldict.

removeEvents(searchfor : dict, leveldict : dict) -> list[dict]
  • Similar to searchEvents, but removes all matching events.
  • This function returns a list of removed events.
  • This function directly modifies leveldict.

replaceField(searchfor : dict, field : str, new, leveldict : dict) -> None
  • Searches for events in leveldict using searchfor, and replaces the value in field with new.
  • For example,
    replaceField({"eventType": "Flash", "duration": 0.5}, "startColor", "800080", leveldict)
    finds all Flash events with duration 0.5 and changes their start color to #800080.

writeToFile(leveldict : dict, filename : str) -> None
  • Writes the leveldict to the specified file.





Changelog

2.0.2 (2023/09/03)


  • Minor bugfix
  • Fixed markdown bug on README and CHANGELOG for real this time

2.0.1 (2023/09/03)


  • Minor bugfix
  • Fixed markdown bug on README and CHANGELOG (hopefully)

2.0.0 (2023/09/03)


  • Major update
  • Completely overhauled file reading to use dictionaries instead of strings
  • Added getFileDict()
  • Added 3 new utility functions: searchEvents(), removeEvents() and replaceField()
  • getAngles(), setAngles() and all event functions are now deprecated
  • Updated documentation
  • README and CHANGELOG now uses markdown

0.1.1 (2023/07/17)


  • Minor bugfixes
  • Fixed encoding incompatibility
  • Fixed output string for moveDecorations()

0.1.0 (2023/06/15)


  • Minor update
  • Added dynamic pivot offset, parallax offset, masking and blending fields to addDecoration() and moveDecorations()
  • Added angleOffset to setSpeed()

0.0.3 (2023/06/14)


  • Minor bugfix: fixed filename __init__.py

0.0.2 (2023/06/13)


  • Minor bugfix: 're' is no longer a dependency

0.0.1 (2023/05/28)


  • First Release

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

adofaipy-2.0.2.tar.gz (60.0 kB view details)

Uploaded Source

File details

Details for the file adofaipy-2.0.2.tar.gz.

File metadata

  • Download URL: adofaipy-2.0.2.tar.gz
  • Upload date:
  • Size: 60.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.9.6

File hashes

Hashes for adofaipy-2.0.2.tar.gz
Algorithm Hash digest
SHA256 d8ae0691d9367019136d301d10829f7490e13fdf589c6c994d1138c41ed161c5
MD5 43341714b8f5aaa95ad8ceef212576aa
BLAKE2b-256 d4cf006b7142d679fd30ad05940ca0e96cf1f52f024c29b90518b443e8fe6c77

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page