Module: Credits 1.19, by SSH
Credits script module, to replace the plugin
Download Credits 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 scrolling credits of text or images
Dependencies
AGS 2.71RC2 or later
Functions
Credits[n].AddTitle(String t, optional int x, optional int font, optional int colour)
This adds a line to the credits in the "Title" style, with x position,
font and colour optional overrides.
Properties DefaultTitleX, DefaultTitleFont and DefaultTitleColour set the
charactersitics of the Title style.
eCreditCentred can be used as x for centered text
eCreditXDefault can be used as x to pick up the default x position for titles
eCreditFontDefault can be used for font to pick up the default font
eCreditColourDefault can be used for colour to pick up the default colour
Credits[n].AddCredit(String t, optional int x, optional int font, optional int colour);
This adds a line to the credits in the "Credit" style, with x position,
font and colour optional overrides.
Properties DefaultCreditX, DefaultCreditFont and DefaultCreditColour set the
charactersitics of the Credit style.
enumerated constants can be used as with AddTitle
Credits[n].AddImage(int sprite, optional int x, optional int valign)
This adds an image to the credits, with optional x position and alignment
specified. x defaults to Centred, valign defaults to "next credit comes at
bottom". Specifying a number for valign will make the next credit line appear
that many pixels below the top of the image.
Credits[n].Run();
This starts the credit sequence off rolling. The credits will appear at Y
position Credit[n].StartY and scroll up until they pass Credit[n].MinY. These
properties default to the top and bottom of the screen.
Credits[n].Pause();
This will pause a running credit scroller or restart a paused one.
Credits[n].IsRunning();
This function returns a value of type CreditRunning_t, which will be equal to
eCreditFinished when the sequence has finished.
Credits[n].Stop();
Terminate credit sequence early: e.g. skipping or abort, etc.
Configuration
The Credits module operates in one of two modes:
Credits[n].CreditStyle=eCreditScrolling; // (Default)
or
Credits[n].CreditStyle=eCreditStatic; // (Default)
Scrolling Mode:
The speed of scrolling can be configured with Credit[n].Delay. This determines
the number of cycles between each pixel moves by the scrolling credits.
The spacing between text lines can be changed by using Credits[n].LineSeparation
which sets the number of pixels after a text line before the next credit item.
Static Mode:
Static mode has a variety of transitions for the text or image entering and
leaving the screen:
eCreditSimple Instant appearing or disappearing
eCreditTypewriter (text appear only) Typewriter simulation
eCreditSlideLeft Slide text in from/out to the left of screen
eCreditSlideRight Slide text in from/out to the right of screen
eCreditSlideTop Slide text in from/out to the top of screen
eCreditSlideBottom Slide text in from/out to the bottom of screen
In the middle of a credit, a '[' means a line break, but text will be left-aligned
within the same credit, so centering can be messed up by this.
Also in static mode, a '[' character at the end of a credit line means that the
line will not disappear before the next line arrives. All such lines will be cleared
by the next line with no special character at the end. You can manually clear any
such uncleared lines by putting a '[' as the first character of a line. If you wish
to have a linebreak at the beginning of text, preceed it with a space: e.g.
" [my text".
By default, the ']' character can also be used at the end of a line in a similar
way, except that such lines are not cleared by following lines with no special
characters: a manual clear by using an initial ']' must be done to clear the line.
By changing the Credits[n].StaticSpecialChars variable, you can add extra characters
with the same behaviour, each one only being cleared by the special character
appearing at the start of a following line. Multiple special characters may appear
at the start of a line until the first non-special character. Only one special
character at the end of the line applies, however.
General:
Credits come in two "styles": titles and credits. The default settings for these
can be configured separately and the functions AddCredit and AddTitle use the
appropriate templates.
The DefaultCreditN and DefaultTitleN properties set those templates, where N can
be X, Colour, Font and in the case of static credits, Y, StartTransition and
EndTransition.
More advanced configuration involves changing CREDIT_MAX_LINES to have more lines
per credit sequence, changing CREDIT_MAX_SEQUENCES to have more different
sequences and if you for some reason want the string "<img>" as a credit, change
CREDIT_IMAGE to be some other string that you do not use.
The property Credits[n].JumpToRoomAtEnd can be set to a room number or -1 if no
room jump is required at the end of the credits.
Example
Credits[0].DefaultCreditFont=3;
Credits[0].DefaultTitleFont=3;
Credits[0].DefaultTitleColour=65000;
Credits[0].DefaultCreditColour=15;
Credits[0].Delay=1;
Credits[0].AddTitle("Scripting by");
Credits[0].AddCredit("SSH");
Credits[0].AddImage(12, eCreditCentred, eCreditAlignBelow);
Credits[0].AddTitle("Credit Module by");
Credits[0].AddCredit("SSH again!");
Credits[0].Run();
Caveats
If more lines of credit are onscreen than AGS allows overlays, then this module
will crash. Use a bigger font.
Not extensively tested: please report bugs on the AGS forums
Revision History
22 Sep 05: v1.0 First release of Scrolling Credits module
26 Oct 05: v1.1 First release of full Credits module
26 Oct 05: v1.11 Added word wrap to typewriter mode
27 Oct 05: v1.12 Fixed debug code left in and 800x600 compatibility
28 Feb 06: v1.13 Added property to jump to new room at end of credits
18 Apr 06: v1.14 Added Stop function to allow credit termination
25 Jul 06: v1.15 Tried to fix the problems with simple start transitions
26 Jul 06: v1.16 Another attempt at fixing top, etc.
27 Jul 06: v1.17 Added extra, programmable, static special characters
16 Feb 07: v1.18 Added translation support and use new strings only
26 Oct 07: v1.19 Actually made translations work!
Licence
Credits AGS script module
Copyright (C) 2005-2007 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.

This work is licenced under a Creative Commons Licence.