-
Notifications
You must be signed in to change notification settings - Fork 35
Utility Methods
Saves a message to a dialog of the effect. Logs are typically used to keep better track of your variables and specific method behavior, such as debugging. It behaves like println in other programming languages.
Log(string message)
You can find the content of the log by clicking the leaf icon next to the script's name in the effect list (It will be replaced by a bug icon if the script failed to execute).
An assertion is a statement that expects a condition – if the condition is false, then the effect will fail execution and throw an exception at the offending line. You can also add a custom message to provide more details for the failure.
Assert(bool condition)
Assert(bool condition, string message)
storybrew also supports loading image files, called Bitmaps, or arbitrary files. These methods are instrumental in that.
storybrew can load up an image file and convert it to the Bitmap class as specified in System.Drawing. For more details about the class and what can be manipulated, refer to MSDN's documentation. The supported file types are BMP, GIF, JPEG, PNG, TIFF.
Image files can be obtained from the project or mapset folder. These methods return Bitmaps, so be sure to have an appropriate variable to assign them.
GetProjectBitmap(string path)
GetMapsetBitmap(string path)
Normally, with file loading, the file must be disposed after you finish using it. However, there is no need to dispose the bitmap after you finish, as the script will do that for you.
The script will refresh automatically if a bitmap opened this way is modified.
Opens a file in read-only mode.
The script will refresh automatically if a file opened this way is modified.
OpenProjectFile(string path)
OpenMapsetFile(string path)
Contrarily to bitmaps, you are responsible for disposing them. Here's an example:
using (var file = OpenProjectFile("file.txt"))
{
...
}
Need help with something that isn't in the wiki? Try contacting Damnae in osu! or Discord.