# Bos Wars Scripting API: Save Game Files

Stratagus FAQ PREV NEXT LUA Index

SaveGame SlotUsage

## Intro - Introduction to savegame functions and variables

Everything around save games. All of the functions below are primarily used in the creation and loading of saved games.

## Functions

### SaveGame({SyncHash = x, SyncRandSeed = y, SaveFile = "file"})

Basic outline of the savegame, include hashs for syncrand and where to load the rest of the game information from when loading. More information is planed for implementation, but currently only the above are used.

SyncHash = x
  integer setting the Hash of the current game for Sync Purposes
SyncRandSeed = y
  integer of the next value to be used when calling SyncRand
SaveFile = "file"
  String containing the name of the file to load to get the rest of the gamedata

#### Example

    SaveGame({
    ---  "comment", "Generated by Stratagus Version 2.0",
    ---  "comment", "Visit http://Stratagus.Org for more informations",
    ---  "comment", "$Id: savegame.html 8569 2007-02-10 23:21:43Z feb $",
    ---  "type",    "single-player",
    ---  "date",    "Mon May 10 19:19:38 2004",
    ---  "map",     "",
    ---  "media-version", "Undefined"---  "engine",  {2, 0, 0},
         SyncHash = 196009203,
         SyncRandSeed = -220040269,
         SaveFile = "data.wc2//campaigns/human/level13h.cm"

    ---  "preview", "/home/devil/.stratagus/wc2/save/current-game.sav.pam",
    } )

### SlotUsage(MaxSlot, [{Slot = Slot1, FreeCycle = Freecycle1}, ..])

Allows reloaded Save games to be replayed in sync by reloading the released units back into the queue they were in when a game was saved.

MaxSlot
  The total Number of slot used.
Slot
  The Slot Number for the unit that was in the release Queue
FreecCycle
  The Cycle that this unit is/was released in

#### Example

        SlotUsage(5, {2, 855})

Last changed: $Id: savegame.html 8569 2007-02-10 23:21:43Z feb $
All trademarks and copyrights on this page are owned by their respective owners.