The Misc object [E/M/W] The Misc object has some window-related and computer-related functions. Most of them are functions.

- Misc.MachineName (read-only) - Returns the name of the player's session.
- Misc.OSType - Returns Windows, Mac or Linux.
- shader Misc.ScreenShader - A shader object that affects the entire screen, instead of a single sprite.
  See The Shader Object for more information.
- Misc.ShakeScreen( durationInFrames, intensity = 3, isIntensityDecreasing = true) - Shakes the screen for durationInFrames frames, with a maximum of intensity pixels away from the normal position.
  Set isIntensityDecreasing as true to reduce the intensity over time.
- Misc.StopShake() - Stops a previous Misc.ShakeScreen call, does nothing otherwise.
- Misc.MoveCamera( x, y) - Moves the camera right x pixels and up y pixels.
- Misc.MoveCameraTo( x, y) - Moves the bottom-left of the camera directly to the point (x, y).
  (0, 0) is the starting position.
- Misc.ResetCamera() - Resets the position of the camera. Same as calling MoveCameraTo(0, 0) in battle - in the Overworld, this instead resets the camera to the Player's position.
- Misc.cameraX - Gets or sets the current x position of the bottom-left corner of the camera.
- Misc.cameraY - Gets or sets the current y position of the bottom-left corner of the camera.
- Misc.FullScreen - Gets or sets whether the user is in fullscreen mode.
- Misc.WindowWidth (read-only) - Returns the width of the game window if it were running in windowed mode (even in fullscreen). If in wide fullscreen with Misc.SetWideFullscreen, this includes the extra displayed pixels.
- Misc.WindowHeight (read-only) - Returns the height of the game window if it were running in windowed mode (even in fullscreen).
  Use Misc.WindowHeight/480 to calculate the scale at which CYF is being drawn to your window (or your screen, if in fullscreen).
- Misc.ScreenWidth (read-only) - Returns the width of the user's screen in windowed mode, or the number of displayed pixel columns when in fullscreen.
- Misc.ScreenHeight (read-only) - Returns the height of the user's screen in windowed mode, or the number of displayed pixel rows when in fullscreen.
- Misc.MonitorWidth (read-only) - Returns the width of the user's monitor, regardless of the user's settings or if Misc.SetWideFullscreen has been used.
- Misc.MonitorHeight (read-only) - Returns the height of the user's monitor, regardless of the user's settings or if Misc.SetWideFullscreen has been used.
- Misc.SetWideFullscreen( wide) - If the user is playing with an aspect ratio wider than 4:3, this function will expand the view in fullscreen to show the space to the left and right of the 640x480 screen space.
  It will only take effect when in fullscreen, and will automatically resize the view if already in fullscreen.
  If the user's aspect ratio is 4:3 or thinner, nothing will change.
  Note that object positions, such as projectiles and sprites, will remain the same.
  * NOTE: Only allowed during battles.
  You can use this code to determine how much space you have available on either side (still using the relative position system in which the screen is always assumed to be 640x480):

      local displayedWidth = Misc.MonitorHeight / 0.75
      local scale = 640 / displayedWidth
      local widthOnEachSide = math.max(scale * (Misc.MonitorWidth - displayedWidth) / 2, 0)

      CreateProjectileAbs("bullet", 0 - widthOnEachSide, 240) -- creates a bullet at the absolute left side of the screen when in wide fullscreen

  Here, if widthOnEachSide is 0, the user is using a resolution that is 4:3 or thinner. Be sure to check if this number is greater than 0 before doing operations that require fullscreen!
- Misc.DestroyWindow() - Closes the window instantly.

THE FOLLOWING VARIABLES AND FUNCTIONS ARE WINDOWS ONLY.
Don't forget to check if the user is playing with a Windows OS by using the variable windows!

- Misc.WindowName - Gets or sets the name of the window.
- Misc.WindowX - Gets or sets the X position of the bottom left corner of the window.
- Misc.WindowY - Gets or sets the Y position of the bottom left corner of the window.
- Misc.MoveWindow( X, Y) - Moves the window X pixels horizontally and Y pixels vertically.
- Misc.MoveWindowTo( X, Y) - Moves the bottom left corner of the window to the given coordinates.

### File Functions

Misc.FileExists( path) Use this function to check if a file in your Mod folder ONLY exists.
Using ../ to go up a folder is NOT allowed.

- path: Path to the file to open, relative to your Mod folder.
  Can enter subfolders such as Lua.

Use this before Misc.OpenFile if you plan to read from a file.
Misc.ListDir( path, getFolders = false) This function returns a list of either files or folders in your Mod folder ONLY.
Using ../ to go up a folder is NOT allowed.

- path: Path to the file to open, relative to your Mod folder.
  Can enter subfolders such as Lua.
- getFolders: If true, this function will return the names of all Folders in path.
  Otherwise, this function will return the names of all Files in path.

Misc.DirExists( path) Use this function to check if a folder in your Mod folder ONLY exists.
Using ../ to go up a folder is NOT allowed.

- path: Path to the file to open, relative to your Mod folder.
  Can enter subfolders such as Lua.

Misc.CreateDir( path) Attempts to create a folder with the path path relative to your Mod folder.
Using ../ to go up a folder is NOT allowed.
Returns true if the operation was successful, false otherwise.
Misc.MoveDir( path, newPath) Attempts to move a folder with the path path relative to your Mod folder to a new location newPath also relative to your mod folder.
Using ../ to go up a folder is NOT allowed.
Returns true if the operation was successful, false otherwise.
Misc.RemoveDir( path, force = false) Attempts to delete a folder with the path path relative to your Mod folder.
Using ../ to go up a folder is NOT allowed.

- force: If true, this function will forcefully remove a folder. Otherwise, a folder will only be removed if it is empty.

Returns true if the operation was successful, false otherwise.
Misc.OpenFile( path, mode = "rw") returns File This function opens a file in your Mod folder ONLY, for reading and writing.
Using ../ to go up a folder is NOT allowed.

- path: Path to the file to open, relative to your Mod folder.
  Can enter subfolders such as Lua.
- mode: Determines how the file should be opened:
  - r: The file can only be read from.
  - w: The file can only be written to.
  - rw: The file can be read from AND written to.
  Files can be created through use of File.Write (see below).

This function returns a File object representing the file:
The File object [E/M/W]

All modes
- File.openMode (read-only): Returns the file mode being used by this File object.
  This is what you entered for mode in Misc.OpenFile.
- File.lineCount (read-only): The number of lines in the file.
- File.filePath (read-only): The full file path to the opened file.
- File.Move( new_path): Moves the opened file to the path new_path.
  Can be used to rename a file.
- File.Copy( new_path, overwrite = false): Copies the opened file to the path new_path.
  If overwrite is true, a file at the target path that already exists will be replaced with the opened file.

"r"
- File.ReadLine( line): Returns the contents of line #line as a string.
- File.ReadLines(): Returns every line in the file as a separate string, all within one table.
  Same as using File.ReadLine on every line.
- File.ReadBytes(): Returns a table containing every individual byte in the file, start to finish, represented as a number.
  Be prepared for a lag spike as soon as you use this function. Depending on the size of the file, the resulting table can be very large.
"w"
- File.Write( data, append = true): Writes the text in data to the file. Supports \n.
  Creates the file if it doesn't exist.
  If append is true, the new text will be added to the end of the file (without a new line).
  Otherwise, the entire file will be replaced by data.
- File.ReplaceLine( line, data): Sets the contents of line #line in the file to data.
  Supports \n.
- File.DeleteLine( line): Removes line #line from the file.
  The line that came after it previously is now line #line.
- File.WriteBytes( data): Writes a series of bytes to a file. This will replace all contents of the file.
- File.Delete() (w): Deletes the file.
  If using "w" or "rw" mode, you can use File.Write to create the file again.

## * YOU WON!
* You earned 0 EXP and 0 gold.
* also the nav menu is broken now