Module Script Template (RickJ): Difference between revisions

From Adventure Game Studio | Wiki
Jump to navigation Jump to search
*>SSH
m (cat)
No edit summary
 
Line 5: Line 5:
// *** AGS MODULE SCRIPT ***
// *** AGS MODULE SCRIPT ***
//
//
// Module: {Module's name}
// Module: <module name>
//
//
// Version: {Moduile's current version number}
// Author: <first name> <last name> (<forum name>)
//
//
// Require: {List of dependancies}
// Require: AGS 2.7, <module1>..., <moduleN>
//
//
// Author:  {First} {Last} {(ForumName)}
// 1 Abstract
//
//
// 1 Abstract
// 2 Description
// {paragraph describing what module does}
//       
// 2 Description  
// {multiple subsections describing what module does and}
// {how it works, etc.                                  }                 
//  
//  
// 4 Revision History
// 3 Revision History
// {YY-MM-dd Name item description }
// <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.
//
//
// 5 License
// This module is distributed in the hope that it will be useful, but
// This program is free software; you can redistribute it and/or
// WITHOUT  ANY  WARRANTY;  without  even  the implied  warranty  of  
// modify it under the terms of the GNU General Public License
// MERCHANTABILITY or  FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
// as published by the Free Software Foundation; either version 2
// Lesser General Public License for more details.
// of the License, or (at your option) any later version.
//  
//  
// This program is distributed in the hope that it will be useful,
// You  should  have received a copy of the GNU Lesser General Public
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// License along with this library; if not,write to the Free Software
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// Foundation, Inc, 59 Temple Place, Suite 330, Boston, MA 02111-1307  
// GNU General Public License for more details.
// USA.
//  
//  
// You should have received a copy of the GNU General Public
// Copyright (C) yyyy  <holder>
// License along with this program; if not, write to the Free
//-------------------------------------------------------------------
// Software Foundation, Inc., 59 Temple Place - Suite 330,
 
// Boston, MA  02111-1307, USA.
//-------------------------------------------------------------------
// Configuration Constants
//-------------------------------------------------------------------
 
 
//-------------------------------------------------------------------
// Static Variables
//-------------------------------------------------------------------
 
 
//-------------------------------------------------------------------
// Utility Functions
//-------------------------------------------------------------------
 
 
//===================================================================
// Static Functions
//-------------------------------------------------------------------
 
 
//===================================================================
// Member Functions
//-------------------------------------------------------------------
 
 
//===================================================================
// Ags Standard Events                   
//-------------------------------------------------------------------
//===================================================================
  function game_start() {
//
//
// Copyright (C) {yyyy} {name of copyright holder}
// This is the first event that is triggered after the game is loaded
// into memory.  It's purpose is to initialize the game. 
//-------------------------------------------------------------------
//-------------------------------------------------------------------
}


//===================================================================
//===================================================================
// Constant Definition
  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.
//-------------------------------------------------------------------
//-------------------------------------------------------------------
}


//===================================================================
//===================================================================
// Enumerated Data Types
  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.
//-------------------------------------------------------------------
//-------------------------------------------------------------------
}


//===================================================================
//===================================================================
// Static Variables
  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
//-------------------------------------------------------------------
//-------------------------------------------------------------------
}


//===================================================================
//===================================================================
// Global Variables
  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       
//-------------------------------------------------------------------
//-------------------------------------------------------------------
}


//===================================================================
//===================================================================
// Utility Functions
  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
//-------------------------------------------------------------------
//-------------------------------------------------------------------
}


//===================================================================
//===================================================================
// Application Functions
  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
//-------------------------------------------------------------------
//-------------------------------------------------------------------
}


//===================================================================
//===================================================================
// Global Functions
  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.
//-------------------------------------------------------------------
//-------------------------------------------------------------------
}
</pre>
</pre>
[[Category:Scripting]]
[[Category:Scripting]]

Latest revision as of 15:08, 29 July 2008

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. 
//-------------------------------------------------------------------
}