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.3 (2023/09/23)


  • Minor bugfixes
  • Fixed addEvent() not detecting addObject and addText events
  • Fixed removeEvents() not modifying leveldict
  • Fixed typo in replaceField()
  • Added logo to README

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.3.tar.gz (5.0 kB view hashes)

Uploaded Source

Supported by

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