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
toleveldict
and returns a copy ofleveldict
. - 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 insearchfor
. - For example,
searchfor={"eventType": "moveDecorations", "tag": "sampleTag"}
moveDecoration
events with tagsampleTag
. - 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
usingsearchfor
, and replaces the value infield
withnew
. - For example,
finds allreplaceField({"eventType": "Flash", "duration": 0.5}, "startColor", "800080", leveldict)
Flash
events with duration0.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 detectingaddObject
andaddText
events - Fixed
removeEvents()
not modifyingleveldict
- 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()
andreplaceField()
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()
andmoveDecorations()
- 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
Release history Release notifications | RSS feed
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)