SSH Productions: Module documentation for GameSetup.zip

Module: InGameSetup 1.0, by SSH

Modify the setup config of a game

Download InGameSetup as a zip file

Author

Andrew MacCormack (SSH)

Please use the messaging function on the AGS forums to contact

me about problems with this module

Abstract

Allow the user to change the .

Dependencies

AGS 3.1.2 or later

runAGSgame.vbs script to be used to launch game (not EXE directly)

Functions

function GameSetup.Set(String key, String value)

Sets the value of a setup key to the string value specified.

function GameSetup.Get(String key)

Returns the current value of the key specified (as a String, manual conversion

required for Integer values)

function GameSetup.Commit()

Writes any changes made to the acsetup.cfg file

function GameSetup.Restart()

Restarts the game with the new settings, automatically doing a save game before to

ensure game restarts in the same place.

Keys and Values:

WINDOWED

"0" for FullScreen, "1" for running game in a window

GFXFILTER

"None" for no filter (1x scaling). Normal scaling is "StdScale2", "StdScale3" or

"StdScale4" for 2x, 3x, 4x respectively. In 32-bit games also can be "Hq2x" or

"Hq3x"

"gfxdriver"

"Dx5" for DirectX 5, "D3D9" for Direct3D 9

"forceletterbox"

"1" to force letterbox mode, "0" for normal

"antialias"

"1" to smoothly scale sprites, "0" for off

"refresh"

"85" to force refresh rate to 85Hz, "0" for default

To check the values for other settings, load the standard winsetup.exe, edit the

settings and look in the acsetup.cfg file after saving.

Configuration

If you have multiple exes in your game directory (other than winsetup.exe) then

runAGSgame.vbs may get confused as to which one to run. In that case, edit the

runAGSgame.vbs script and uncomment and edit the line exeName="myagsgame.exe" to

point to your game's EXE name.

Example

  function buttonWindowed_OnClick(GUIControl *control, MouseButton button)
  {
    GameSetup.Set(WINDOWED, "1");
  }
  function buttonFullScreen_OnClick(GUIControl *control, MouseButton button)
  {
    gwindowed=false;
    GameSetup.Set(WINDOWED, "0");
  }
  function game_start() {   
    listboxGfxFilter.AddItem("None");
    listboxGfxFilter.AddItem("StdScale2");
    listboxGfxFilter.AddItem("StdScale3");
    listboxGfxFilter.AddItem("StdScale4");
    if (System.ColorDepth==32) {
      listboxGfxFilter.AddItem("Hq2x");
      listboxGfxFilter.AddItem("Hq3x");
    }
  }
  function buttonSetupOK_OnClick(GUIControl *control, MouseButton button)
  {
    if (listboxGfxFilter.SelectedIndex>=0) GameSetup.Set(GFXFILTER, listboxGfxFilter.Items[listboxGfxFilter.SelectedIndex]);
    GameSetup.Commit();
    GameSetup.Restart();
  }

Caveats

When a game is tested with F5 from the editor, it calls the debug EXE directly and

so the restart will not occur. Its probably best to test this part of a game

by using F7 to build the compield EXE and put the VBS file in the compiled

directory, and test by double clicking the VBS file.

You sometimes have to click in the game window again after restart. This can be

particularly odd in full-screen mode. The VBS script is suppoed to switch focus to

the

Revision History

27 Mar 09: v1.0 First release of GameSetup module

Licence

GameSetup AGS script module

Copyright (C) 2009 Andrew MacCormack

This module is licenced under the Creative Commons Attribution Share-alike

licence, (see http://creativecommons.org/licenses/by-sa/2.5/scotland/ )

which basically means do what you like as long as you credit me and don't

start selling modified copies of this module.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR

IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,

FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL

THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER

LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING

FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER

DEALINGS IN THE SOFTWARE.

In addition to the licences mentioned in the modules themselves, you may choose to use the following creative commons licence if you prefer for all AGS modules and open source code resources on my site.

Creative Commons License
This work is licenced under a Creative Commons Licence.