SSH Productions: Module documentation for ComboLock.zip

Module: CombinationLock 1.01, by SSH

Functions for use in a combination lock

Download CombinationLock as a zip file

Author

Andrew MacCormack (SSH)

Please use the PM function on the AGS forums to contact

me about problems with this module

Abstract

Provides a framework for implementing a combination lock

Dependencies

AGS 2.71RC3 or later

Keypad GUE

Functions

ComboLock.Press(String s);

This function is called by the GUI to add a single character

to the current entry for the keypad.

ComboLock.Status();

This function returns the current status of the lock:

either no full code entered yet (eLockStatusPending),

bad code entered (eLockStatusWrong) or correct

(eLockStatusCorrect). This can be used to code up an

action as soon as a bad code occurs or just to wait

until a good code occurs.

Configuration

ComboLock.Combination="your combination here";

To reset the current entered numbers, do ComboLock.entered="";

Hotspots or objects could be used instead of the Keypad GUE

The Status function can be run immediately after the Press

function, or in repeatedly_execute

Example

function room_a() {
   // script for Room: Player enters room (before fadein)
   ComboLock.Combination="1337";
   gKeypad.Centre();
   gKeypad.Visible=1;
 }
 function room_b() {
   // script for Room: Repeatedly execute
   if (ComboLock.Status()==eLockStatusCorrect) Display ("Woot!");
   else if (ComboLock.Status()==eLockStatusWrong) Display ("You die!");
 }

Caveats

None yet

Revision History

17 Nov 05: v1.0 First release of CombinationLock module

23 Nov 05: v1.01 Fixed cut/paste errors in documentation

Licence

CombinationLock AGS script module

Copyright (C) 2005 Andrew MacCormack

This library is free software; you can redistribute it and/or

modify it under the terms of the GNU Lesser General Public

License as published by the Free Software Foundation; either

version 2.1 of the License, or (at your option) any later version.

This library is distributed in the hope that it will be useful,

but WITHOUT ANY WARRANTY; without even the implied warranty of

MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU

Lesser General Public License for more details.

You should have received a copy of the GNU Lesser General Public

License along with this library; if not, write to the Free Software

Foundation, Inc, 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA

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.