Module Script Template (RickJ)

From Adventure Game Studio | Wiki
Jump to navigation Jump to search
The printable version is no longer supported and may have rendering errors. Please update your browser bookmarks and please use the default browser print function instead.

RickJ's module script template:

//===================================================================
// *** AGS MODULE SCRIPT ***
//
// Module: <module name>
//
// Author: <first name> <last name> (<forum name>)
//
// Require: AGS 2.7, <module1>..., <moduleN>
//
// 1 Abstract
//
// 2 Description
// 
// 3 Revision History
// <yy-mmm-dd> <forum name>,   created original version
//
// 4 License
// This  module  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 any later version.
//
// This module 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.
// 
// Copyright (C) yyyy  <holder>
//-------------------------------------------------------------------

//-------------------------------------------------------------------
// Configuration Constants
//-------------------------------------------------------------------


//-------------------------------------------------------------------
// Static Variables 
//-------------------------------------------------------------------


//-------------------------------------------------------------------
// Utility Functions
//-------------------------------------------------------------------


//===================================================================
// Static Functions
//-------------------------------------------------------------------


//===================================================================
// Member Functions
//-------------------------------------------------------------------


//===================================================================
// Ags Standard Events                     
//-------------------------------------------------------------------
//===================================================================
   function game_start() {
//
// This is the first event that is triggered after the game is loaded
// into memory.  It's purpose is to initialize the game.  
//-------------------------------------------------------------------
}

//===================================================================
   function repeatedly_execute() {
//
// This event is triggered each game cycle. Addition of code to this 
// even should be done carefully to avoid unacceptable performance 
// degradation.  If there is way to avoid putting code in this event 
// then it is generally advisable to do so.
//-------------------------------------------------------------------
}

//===================================================================
   function repeatedly_execute_always() {
//
// This  event  is  triggered each  game cycle, even  when a blocking 
// routine (eg. speech/cutscene) is in progress.  Blocking  functions 
// cannot be called from this event handler. Addition of code to this
// event should  be  done carefully to avoid unacceptable performance 
// degradation. If there is a way to avoid putting code in this event
// then it is generally advisable to do so.
//-------------------------------------------------------------------
}

//===================================================================
   function on_event (int event, int data) {
//
// This  event  is  triggered in response to a number of standard AGS
// game events. See the AGS  manual  for more details.  The EVENT and 
// DATA parameters are used to decode the specific event as follows:
//
// EVENT                         DATA
// eEventEnterRoomBeforeFadein   new room number
// eEventLeaveRoom               room number they are leaving
// eEventGotScore                number of points they got
// eEventGUIMouseDown            GUI number
// eEventGUIMouseUp              GUI number
// eEventAddInventory            inventory item number that was added
// eEventLoseInventory           inventory item number that was lost
// eEventRestoreGame             save slot number
//-------------------------------------------------------------------
}

//===================================================================
   int      PrevKey;
   function on_key_press(int keycode) {
//
// This  event  is triggered whenever a keyboard key is pressed.  The
// parameter  KEYCODE identifies which key was pressed.  All possible
// keycodes are given below.  See the AGS manual for more details.
//
// KEYCODE   DESCRIPTION         KEYCODE   DESCRIPTION  
// 1..26     Ctrl+A .. Ctrl+Z    8         Backspace (Ctrl+H)
// 9         Tab (Ctrl+I)        13        Enter (Ctrl+M)
// 27        Escape              32        Space
// 48..57   '0' .. '9'           65..90   'A' .. 'Z' (uppercase)
// 359..368  F1 .. F10           371       Home (numeric pad)
// 372       Up arrow            373       PgUp (numeric pad)
// 375       Left arrow          376      '5'   (numeric pad)
// 377       Right arrow         379       End  (numeric pad)
// 380       Down arrow          381       PgDn (numeric pad)
// 433..434  F11 .. F12         
//-------------------------------------------------------------------
}

//===================================================================
   function on_mouse_click(int button) {
//
// This event is triggered whenever a mouse button is pressed.  The 
// button parameter identifies which mouse button was pressed as 
// follows:
//    eMouseLeft,       eMouseRight,       eMouseMiddle,
//    eMouseLeftInv,    eMouseRightInv,
//    eMouseWheelNorth, eMouseWheelSouth
//-------------------------------------------------------------------
}

//===================================================================
   function unhandled_event(int what, int type) {
//
// This  function is called when an interaction is run, but no events
// are listed  in  the  AGS  interaction  window.  The WHAT  and TYPE
// parameters tell you what the player did. Their possible values are 
// listed below:
// 
//    WHAT TYPE Hotspot Interaction     WHAT TYPE Object Interaction
//     1    1   Look at                  2    0   Look at 
//     1    2   Interact with            2    1   Interact with
//     1    3   Use inventory on         2    2   Talk to
//     1    4   Talk to                  2    3   Use inventory on 
//     1    7   Pick up                  2    5   Pick up
//     1    8   Cursor Mode 8 on         2    6   Cursor Mode 8 on
//     1    9   Cursor Mode 9 on         2    7   Cursor Mode 9 on
//
//    WHAT TYPE Character Interaction   WHAT TYPE Nothing Interaction
//     3    0   Look at                  4    1   Look at 
//     3    1   Interact with            4    2   Interact with
//     3    2   Talk to                  4    3   Use inventory with
//     3    3   Use inventory on         4    4   Talk to
//     3    5   Pick up 
//     3    6   Cursor Mode 8 on 
//     3    7   Cursor Mode 9 on 
//                                       
//    WHAT TYPE Inventory Interaction   
//     5    0   Look at 
//     5    1   Interact with (currently not possible)
//     5    2   Talk to 
//     5    3   Use an inventory item on another
//     5    4   Other click on 
//-------------------------------------------------------------------
}

//===================================================================
   function dialog_request(int parameter) {
//
// This  function is called when a dialog script line "run-script" is
// processed.  PARAMETER  is  the value  of  the number following the 
// "run-script" on that line of the dialog script. 
//-------------------------------------------------------------------
}