Adventure Game Studio | Forums

AGS Support => Modules, Plugins & Tools => Topic started by: SSH on Thu 22/09/2005 16:22:54

Title: MODULE: Credits v1.19
Post by: SSH on Thu 22/09/2005 16:22:54
The normal download now includes the source for a demo game. Demo game requires 2.72beta7 but the module should work with AGS v2.71 or later. Version 1.19 now makes translations work properly (which 1.18 failed at).

Credits module.

I never used the Creditz plugin, but I read the help file and tried to match its functionality.

Where n is credit seuqence number, staring with 0
//   Credit[n].AddTitle(const string t, optional int x, optional int font, optional int colour)
//   Credit[n].AddCredit(const string t, optional int x, optional int font, optional int colour);
//   Credit[n].AddImage(int sprite, optional int x, optional int valign)
//   Credit[n].Run();
//   Credit[n].Pause();
//   Credit[n].Stop();
//   Credit[n].IsRunning();

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("ScrollingCredit Module by");
Credits[0].AddCredit("SSH again!");
Credits[0].Run();


Have fun!

Download Credits module here (http://www.ssh.me.uk/modules/Credits.zip) (Requires AGS v2.71!)
View Full instructions (http://ssh.me.uk/moddoc/Credits)
Title: Re: MODULE: ScrollingCredits v1.0
Post by: Pumaman on Sat 24/09/2005 12:34:29
Good stuff -- I haven't had time to try it out yet, but having a module alternative to the Creditz plugin will be very handy  :)
Title: ScrollCredits question using ScrollingCredits module 1.0
Post by: on Mon 24/10/2005 10:54:53
I have switched from the plugin to the module because I was getting an error about "const string" and was unable to find a work around. (Using AGS v2.71 RC2 and Credtis plugin v2.0.0.6).

Credits run but I am unsure how to change rooms after said sequence finishes.Ã,  AJA's plugin had a 'IsCreditsFinished' function.Ã,  Is there such a feature in the new module by SSH?

Thanks
Title: Re: ScrollCredits question using ScrollingCredits module 1.0
Post by: SSH on Mon 24/10/2005 11:12:54
Hey, I'm glad someone's using this. I guess if the plugin doesn't work with AGS 2.71 then it will be used a lot more... but maybe CJ should put something in that makes older plugin APIs work with the new strings, otherwise everything will need to be recompiled.

The answer is:


if (Credits[n].IsRunning == eCreditFinished) {

}


as described in the script module README and in the module header:

//   Credit[n].IsRunning();
//      This function returns a value of type CreditRunning_t, which will be equal to
//      eCreditFinished when the sequence has finished.

although, now I notice that this says Credit rather than Credits: another thing to fix in the next version!

Edit:

So, I've fixed most of the problems with the Static credits and now both versions should work. See top post for details

I've also included a function that inserts linebreaks into typewriter credits to make the wordwrap look better

Edit 2:

Please feel free to suggest improvements or note bugs, although I don't promise to fix any!
Title: Re: MODULE: Credits v1.12
Post by: Bleckman1974 on Sun 13/11/2005 04:07:43
Yo, SSH!

This is awesome!, I like this better than Aja's

much eaiser to use, too!

i can't get his to work for NOTHING!

;D ;D ;D ;D ;D ;D ;D :-*
Title: Re: MODULE: Credits v1.12
Post by: Candle on Sun 13/11/2005 11:07:26
How to add player.ChangeRoom(player.PreviousRoom); so at the end it will return to last room? I get an overlay error now when I add that to the end of the credits lines.
Title: Re: MODULE: Credits v1.12
Post by: Ashen on Sun 11/12/2005 22:25:58
In the repeatedly_execute function for the room, just put:

if (Credits[0].IsRunning() == eCreditFinished){
  player.ChangeRoom(player.PreviousRoom);
}


At least, that works in the version I have.
Title: Re: MODULE: Credits v1.13
Post by: Peder 🚀 on Thu 23/03/2006 22:09:32
so, I had this error:

"Error (line 116): type 'string' is no longer supported; use String instead"

If I changes it to "String" I get an error on the next line instead...
Title: Re: MODULE: Credits v1.13
Post by: SSH on Fri 24/03/2006 09:48:54
Hmmm, I thought I'd documented that the "Enforce new style Strings" checkbox in the General settings of the editor needed to be unchecked... sorry!
Title: Re: MODULE: Credits v1.13 (new dl site)
Post by: The_Creep on Mon 17/04/2006 21:09:31
Great Module SSH thanks! I just have one question, and I feel kind of silly asking, I have my messages displayed in a custom textbox (GUI 3) and the credits also display in this textbox (and the textbox size stretches all the way to the right hand edge of the screen), do you know how I can make the credits just display as plain text?
Title: Re: MODULE: Credits v1.13 (new dl site)
Post by: SSH on Tue 18/04/2006 13:58:24
Not sure I understand the question: the Credits are displayed using Text Overlays and shouldn't be affected by any custom textboxes (I assume you mean one used for the Display() function).

Can you give a screenshot or source code of the issue?
Title: Re: MODULE: Credits v1.13 (new dl site)
Post by: The_Creep on Tue 18/04/2006 15:39:45
Yup, the one used for Display(); I have since come across the source of the problem, my game 's speech style is set to "Sierra Style with Background" if I turn  this to just plain sierra style, or lucasarts, it works perfectly,  but I would really like to keep my style as it is and have my credits, so if you can think of a workaround let me know :)

I will post screenshots shortly, and as for the sourcecode, I copy pasted the example from the readme, so there should not be any errors there.

Edit:

Fixed it!

The problem WAS the speech style,  (Sierra with Background), for some reasons dumps the custom textbox behind the credits (and distorts it).

So I just put

SetSpeechStyle(Lucasarts);
*Your credits code here*

then when the Credits returned the value that they were finished I just set the style back with:

SetSpeechStyle(eSpeechSierraWithBackground);

Thanks again for an excellent module!

Edit 2:

ey, sorry I know I'm being a pest, and I know I will kick myself when I see the solution

I want to make it so that the player can click the mouse or press esc to end the credit sequence, but I'm damned if I can figure out how, what I have done is filled the room with hotspot1, and said that anyclick will move player to room1, but the game crashes out and gives me the error message: Invalid Overlay ID specified. so obviosly before I change rooms, I need to tell the credits that they are finished, and to cease and desist, how I would I do this? I'm sure its a similar piece of code to the one you put in the repeatedly_execute room, but I just cant figure it out.
Title: Re: MODULE: Credits v1.13
Post by: SSH on Tue 18/04/2006 17:32:56
1) Don't triple-post: edit your previous entries
2) No, actually, there isn't currently a way to do this! I need to add some code to the module for this and I will try and do this ASAP: watch this space!
3) Please make a thread in Tech Forum reporting the bug you found with that speech mode!

EDIT:
Well, actually, you could use the SkipCutscene thing to zip through it and then chnage, I guess...

However, I've now updated the module to have a Stop function for just this case. Thanks for pointing out this deficiency!
Title: Credits 1.14 (nevermind SSH issue)
Post by: Alynn on Sun 16/07/2006 13:26:18
Sorry, after playing around for a bit it's something with SSH's code, it seems that using the [ character at the end of a Title or Credit that has a StarTransition of simple never disappears, but any other kind of start transition it will display that line and the next line.

There also seems to be an issue with scrolling from top.

Sorry I've just been working on this thing for hours now and I was getting frustrated...

Edit:
Ok code snippet

//Credits[0].DefaultTitleStartTransition = eSlideTop;

Credits[0].addTitle("A Game By[");
Credits[0].addCredit("Yellow Eyed Studio");


Note: Doing this from memory, so the eSlide may be wrong. but that's the general idea of the code. The only Credits code above the first line I posted was the default font settings and default color settings.

Leaving the comment in the credits will start displaying "A Game By" in the correct font, howver that font will never leave and the rest of the credits will never run.

If you remove the comment it will work, but not as expected. There is a brief flash of the Title line in the center of the screen, then it will appear in the correct location, the credit text appears as well. Both are then removed correctly.

Any other DefaultStartTransition and it will work as expected. With the text scrolling in from the sides or the bottom. The issues seem to stem about removing the text with there is a [ present at the end of the string, and with top down sliding.

What I am shooting for is this
Ã,  Ã,  A Game By
Yellow Eyed Studio

That appears at the same time, both go away and the next title and credit are displayed. From what I thought putting [ at the end of the title line, and setting both start and end transitions to simple (which is the default so I never actually set them).

Yet another edit...
Suggestion: Is there any way to center the text when using a breakline? IE "Adventure Game Studio[by Chris Jones". Currently it shows text as
Adventure Game Studio
by Chris Jones


What I would like to see is
Adventure Game Studio
Ã,  Ã, by Chris Jones
Title: Re: MODULE: Credits v1.16
Post by: SSH on Wed 26/07/2006 08:08:30
Top slide is definately fixed now. And the simple credits with a [ works in the demo included in the zip file...
Title: Re: MODULE: Credits v1.16
Post by: Alynn on Wed 26/07/2006 19:37:18
Ok now it werkies for me... After commenting out all of your debug label code you left in :P

Now that that is setup, could you perhaps add functionality that only removes a Credit if another Credits is up, and only gets rid of titles if a new title is to be loaded...

What I'm looking for is the title text to be static, while the credits for that particular title scroll from the left pause briefly under the title and then scroll right, the title only scrolling off after the last  credit for that title has passed.

For an example haveing both the credits and the titles slide from the left, and slide out to the right.

Credits[0].setTitle("In association with:");
Credits[0].setCredit("Skytower Games");
Credits[0].setCredit("twIg");

In association with: and Skytowergames would slide in together, Skytower Games would slide out twIg will slide in, and then both Title and Credit will slide out at the same time...

I know I know it's probably easier said than done, but I've looked over your code, and the complete lack of any kind of comments makes it cryptic to decipher :P. Since Obviously I couldn't see what the origional problem was with static creds and all that...

Anyway if you can't add that it's not a huge deal, but thanks for your work getting the rest up and running.
Title: Re: MODULE: Credits v1.16
Post by: SSH on Thu 27/07/2006 12:27:48
Well, I've got something that might work for you... now you can keep credits on screen by putting any of a set of user-defined characters at the end of the line, and putting the same character at the beginning of the line will clear any old lines with that character on.

So, if you download the zip and look at the included "game" you'll see how it works, I hope. And the debug code should get automatically left out, too ;)
Title: Credits module error
Post by: joelphilippage on Wed 11/10/2006 03:19:24
When I try to run the credits module i get an error saying "x is a global var; cannot use as a name for local."

Edit:

Thanks KhrisMUC, I've found a global variable called x and renamed it. It's fixed!
Title: Re: Credits module error
Post by: Khris on Wed 11/10/2006 03:21:30
Are you using a variable called "x" in any of your functions or even as a global variable?
If you need it, rename it, if not, find the line where it says "int x;" and remove it.

Are you using another plugin or a module perhaps? Anything else that might use a variable called x?

If not, check if the module supports your version of AGS.
Title: Re: MODULE: Credits v1.18
Post by: SSH on Fri 16/02/2007 13:22:36
v1.18 is up to fix a translation-related problem that Cinfa found.
Title: Re: MODULE: Credits v1.18
Post by: Candle on Sat 10/03/2007 03:45:18
Whats the limit on overlays on one screen? I'm getting a to many overlays error then it crashes on me.
about 19 lines in the credits. more or less one or two.
Title: Re: MODULE: Credits v1.18
Post by: SSH on Sat 10/03/2007 08:27:07
I'm afraid that's an AGS limit (around 20 or so), so you'll just have to have fewer credits onscreen at once: increase the spacing or make font bigger
Title: Re: MODULE: Credits v1.18
Post by: joelphilippage on Mon 20/08/2007 13:29:59
Hey Ive got another problem with this module. When I try to run the game it says "Local variable cannot have the same name as an import" On this line of script:
int n=this.find_free();
By the way im using the beta version of ags 2.8.
Title: Re: MODULE: Credits v1.18
Post by: SSH on Tue 21/08/2007 08:10:12
Are you using another module that declares a global n and exports it? Change one or the other..
Title: Re: MODULE: Credits v1.18
Post by: Gord10 on Thu 30/08/2007 15:10:06
I want to share something:

I am using the Credits module for the end game credits and the 'About' section of my game. When the credits were run more than once, it would give the "Credit Module has reached maximum 100 lines, contact game author and tell them to increase CREDIT_MAX_LINES" error.

I have changed the main module codes from

if (i==CREDIT_MAX_LINES)
Display("Credit Module has reached maximum %d lines, contact game author and tell them to increase CREDIT_MAX_LINES", CREDIT_MAX_LINES);
else return i;

into

if (i==CREDIT_MAX_LINES)
i=0;
else return i;


So the 'i' variable gets reseted.
I am not doing something wrong, am I?
Title: Re: MODULE: Credits v1.18
Post by: SSH on Thu 30/08/2007 15:39:20
Yeah, there seems to be a problem with trying to run the Credits more than once.

Could you try doing a Credits[0].Reset(0) before you run the second time?

the number passed to Reset must match the first number, so it would be: Credits[1].Reset(1) or Credits[2].Reset(2)

Title: Re: MODULE: Credits v1.18
Post by: Gord10 on Thu 30/08/2007 16:04:05
Now I changed the main code into the original one

(the
if (i==CREDIT_MAX_LINES)
Display("Credit Module has reached maximum %d lines, contact game author and tell them to increase CREDIT_MAX_LINES", CREDIT_MAX_LINES);
else return i;

)  and used the Credits[0].Reset(0); for both the hotspot that makes the player leave and the credit ending codes on repeatedly_execute; but it still gave the same error for me. And I am sure Credits[0].Reset(0); is for the correct credits (Credits[0]).

But when I changed the main module code into if (i==CREDIT_MAX_LINES)
i=0;
else return i;

, it began to run successfully again. The credit screen can be run multiple times now with my codes.
Title: Re: MODULE: Credits v1.18
Post by: SSH on Thu 30/08/2007 17:32:43
The problem is that you are adding the credits twice. You should only use Credits[0].Run() twice and all the Credits[0].AddTitle etc. once.
Title: Re: MODULE: Credits v1.19
Post by: headphone on Sun 28/10/2007 23:01:20
Hey sorry to bump such an old topic, but I'm having a lot of trouble with this module and there doesn't seem to be anywhere around where I can find the answers. I've looked at the demo game and I've read the documentation but I can't find anywhere that explains how I set the speed of my credits.

I'm using the eCreditTypewriter thing and it displays everything so fast it is barely readable. I would like it to display a lot slower and to pause between the displaying of each credit. The only two things I found were Credits.Pause() which I don't know how to use properly at all. If I insert it as it is nothing happens and if I put something in the brackets like a number then I get an error message. Nowhere in the documentation does it really explain how to use the commands, it just lists them so it is pretty hard for someone who is new to AGS like me.

And the other command was the Credit[n].Delay which apparently controls the speed of the scrolling but 1. I am using the static typewriter and 2. no matter what value I set it still blitzes all the text off faster than you can read it.

Can anyone help?
Title: Re: MODULE: Credits v1.19
Post by: SSH on Mon 29/10/2007 11:25:02
My bad, I haven't documented the speed controls for Typewriter mode properly:

Credits[n].TypeDelay set the delay between individual characters of the typing and
Credits[n].TypeRandom can be set to give a random element to the above delay to make it more "realistic".

There's also SpaceSound, TypeSound and EOLSound which can be set to sound numbers for the space bar, normal keys and End of Line "ding" for the typewriter.

I'll try and go through all these settings and make sure they're properly documented soon.
Title: Re: MODULE: Credits v1.19
Post by: Rui 'Trovatore' Pires on Mon 29/10/2007 11:28:17
Your module does all that? Nice work, it's more than it says on the label. It stands as a "typewriter module" on its own.
Title: Re: MODULE: Credits v1.19
Post by: riseryn on Mon 10/12/2007 19:59:06
HI

if my credit is something like " ags"

first time it show
ags

second time it show
ags
ags

third time
ags
ags
ags

etc..
 
i try
Credits[0].Reset(0);
at the beginning of the script but it dont works.
Any idea?


Thanks                             
Title: Re: MODULE: Credits v1.19
Post by: SSH on Mon 10/12/2007 20:21:50
Let me guess: do you re-add the credits when you run them again? It the same problem Gord10 had...
Title: Re: MODULE: Credits v1.19
Post by: riseryn on Mon 10/12/2007 21:38:55
ok i solve the problem with globalint


#sectionstart room_a  // DO NOT EDIT OR REMOVE THIS LINE
function room_a() {
// script for Room: Player enters room (after fadein)

if(getglobalint(1) ==0)
   {
    credit stuff
    ...
    SetGlobalInt(1,1);
    }

Credits[0].Run();

}
#sectionend room_a  // DO NOT EDIT OR REMOVE THIS LINE



thanks


Title: Re: MODULE: Credits v1.19
Post by: SSH on Mon 10/12/2007 22:05:25
Put the code to RUN the credits there. Put the code to ADD the criedts in game_start or in the first time player enters room, so it only gets run once.
Title: Re: MODULE: Credits v1.19
Post by: riseryn on Mon 10/12/2007 22:06:47
ok your solution is better  :)

re thanks  :)
Title: Re: MODULE: Credits v1.19
Post by: AntmanJB on Sat 09/02/2008 04:21:37
Since I haven't been able to find detailed explanation of the typewriter settings, I'll ask my questions here so everyone can learn.

Basically, I can't make heads or tails of it. Check out this script I've whipped up:
function room_AfterFadeIn()
{
Credits[0].CreditStyle=eCreditTypewriter;
Credits[0].DefaultCreditFont=3;
Credits[0].DefaultCreditColour=15;
Credits[0].TypeDelay=10;
Credits[0].AddCredit("Hello[[this is the credits module[[goodbye");
Credits[0].Run();
}


All it does is scroll the text upwards like normal credits, it doesn't do the typrewriter thing. I don't get it. I could use a how-to.

Thanks
Title: Re: MODULE: Credits v1.19
Post by: SSH on Sun 10/02/2008 22:53:27
You need to set CreditStyle to eCreditStatic and set DefaultCreditStartTransition and DefaultTitleStartTransition to eCreditTypewriter
Title: Re: MODULE: Credits v1.19
Post by: AntmanJB on Mon 11/02/2008 04:12:05
Okay thanks, that worked. I didn't bother with the Title command though, because I'm not using it.

What's the difference between the titles and credits anyway?

But my real question is this: Seeing as the JumpToRoomAtEnd does not work when the message has a "[" at the end of it, how can I keep the message onscreen and only change the room when the player has clicked anywhere on the screen?
Title: Re: MODULE: Credits v1.19
Post by: SSH on Mon 11/02/2008 09:52:33
Check for Credits[n].IsRunning() in repeatedly_execute and then when it stops being true, run your end-code.
Title: Credits module questions - wait to scroll; GUIs being used for text
Post by: paolo on Sun 03/05/2009 13:20:33
Hm, I'm not sure whether this should go here or in the modules forum, or whether I should just contact SSH directly, but anyhow...

So, I'm using SSH's credits module, and two things aren't working as I want them to.

1. The first thing in the credits is an image, and I'd like this to stay fixed in position for a second or two before scrolling up to show the rest of the credits. Is it possible to do this within the credits module, or do I need to script this separately (which shouldn't be too hard to do). If I have to do it myself, then how do I get the credits to pause for a certain time before starting?

2. When my credits come up, all of the text appears in boxes of solid colour. It looks like these boxes are the GUI I am using for the text displayed when I use the "Think" command, but if I set the game not to use this GUI for Think before displaying the credits, the boxes still appear.

Can anyone help? Thanks.
Title: Re: Credits module questions - wait to scroll; GUIs being used for text
Post by: SSH on Tue 05/05/2009 17:11:07
Module problems are usually best in the module thread, I think, then anyone else with the same problem can find it easily. But anyway:

1. I think is probably easier done separately.

2. Can you upload an example game, or ideally your who game dir (you can send it to me in PM if you prefer)
Title: Re: MODULE: Credits v1.19
Post by: paolo on Wed 20/05/2009 09:25:15
I found out what the problem was in the end - the credits use the speech GUI (GUI number 3) and I had modified this. I changed it to use an invisible sprite, and now everything works fine.
Title: Re: MODULE: Credits v1.19
Post by: DCS78 on Sat 01/08/2009 03:54:39
Using Credits Module v1.19 with AGS 3.2 Beta 2 and had to make a few changes to "credits.asc" to get it to work:

changed
this.fontimage[ln]

to
eFontNormal

Not sure if this is proper or if I changes the intent of the code but it compiles without error.

The problem I am having is that each title/credit has a white bar under the text.

Any idea how to make it transparent?
Title: Re: MODULE: Credits v1.19
Post by: Joe on Thu 13/08/2009 11:27:25
Broken link?

EDIT: Nevermind, I downloaded it from your website
Title: Re: MODULE: Credits v1.19
Post by: pcj on Wed 31/08/2011 14:46:23
With CreditStyle eCreditStatic and eCreditCentered, the credit text doesn't appear to be centered properly in the x-axis.  The game's resolution is 800x600. Is this related to the use of GetTextWidth, which apparently returns the width in 320-resolution pixels, or some other problem?  Is there a fix?  Thanks.
Title: Re: MODULE: Credits v1.19
Post by: MyEakinBack on Sat 25/04/2015 05:07:06
Hi all, I guess I'm bringing up an old topic, but that's what us newbies do. I was looking for a way to easily add credits at the end of a game. This module seemed like the answer, but the link is broken. Maybe somebody has this laying around. :-D
Title: Re: MODULE: Credits v1.19
Post by: abstauber on Sat 25/04/2015 16:38:22
Here's a working link:
http://duals.agser.me/Modules/Credits_v1.19.rar
Title: Re: MODULE: Credits v1.19
Post by: Julius Dangerous on Tue 02/06/2015 22:05:08
Thanks for the Link  :)
Title: Re: MODULE: Credits v1.19
Post by: Akril15 on Sat 31/10/2015 07:11:12
Sorry for digging up this topic, but is there a way of displaying credits in more than one column? I tried something like this:
Code (ags) Select
Credits[0].AddCredit("line 1",30);
Credits[0].AddCredit("line 2",300);

This makes the two lines appear at the same time, but "line 2" one line lower than "line 1", not on the same level like I want it to.
Title: Re: MODULE: Credits v1.19
Post by: Cassiebsg on Fri 27/05/2016 13:21:43
Uhm... I was going to use this module for my MAGS game, but all the links to it seem to be broken. :~(

Anyone has a new & working link to it?
Title: Re: MODULE: Credits v1.19
Post by: Slasher on Fri 27/05/2016 17:39:11
http://www.mediafire.com/download/6m081dw4e07aojm/Credits_v1.19.rar
Title: Re: MODULE: Credits v1.19
Post by: Cassiebsg on Fri 27/05/2016 20:27:05
Thank you! (nod)

EDIT: Crap! How do I remove the background from the text?!
I'm using Sierra With Background style and have a background text gui, and it's using that one. :(
I just want a transparent BG and the text scrolling, with the color I wish (it's also using the color of the Speech text gui).

I can't find anything setting in the module that is referring to speech or gui (even just searching for the gui number doesn't help) that is relevant. :/

EDIT 2:
Okay! For others that may have the same problem:
I created a new Text Window GUI, made the BG color 0 and all the 8 borders to a dummy invisible sprite.
Then added the following line just before running the credits:
Code (ags) Select

game.speech_text_gui=x; // replace the x with your new dummy GUI.

Problem solved. :-D Remember to change it back to your normal GUI after the credits are over.

PS - The PlaySound gives an error (using 3.4.07) I just commented the 4 lines out.
Title: Re: MODULE: Credits v1.19
Post by: Crimson Wizard on Fri 27/05/2016 22:16:21
Quote from: Cassiebsg on Fri 27/05/2016 20:27:05
PS - The PlaySound gives an error (using 3.4.07) I just commented the 4 lines out.
What error?
Title: Re: MODULE: Credits v1.19
Post by: Cassiebsg on Fri 27/05/2016 22:30:11
Okay, had to create a new project and import the module, to be sure... (roll)

Undefined token 'PlaySound'
Title: Re: MODULE: Credits v1.19
Post by: Crimson Wizard on Fri 27/05/2016 23:48:09
Quote from: Cassiebsg on Fri 27/05/2016 22:30:11
Okay, had to create a new project and import the module, to be sure... (roll)

Undefined token 'PlaySound'

This is because PlaySound is a deprecated function. To enable it you need to turn "Enforce new Audio scripting" off in the Backwards-compatibility settings of your project.
Title: Re: MODULE: Credits v1.19
Post by: Cassiebsg on Sat 28/05/2016 01:02:28
Okay, thanks for the info CW, will be handy if I decide to use it.
Title: Re: MODULE: Credits v1.19
Post by: Cassiebsg on Sun 15/10/2017 19:52:15
Okay, me again with a new old problem...

I need to add the credits more than once! 8-0 Is there a way to clear the array(?), so I can then add them again?

Reason for this, is that I decided to add an option to let the player change translations in game, not just via winsetup, and since the Credits are being loaded at Game_Startup, this is not working desirable. :-\ So ideally, I would like to reset/clear them and then add them again in the the proper language, so that they display correctly.

Is this possible?

EDIT: I solved my "problem" without needing to clear the credits, but there's still a problem when using a translation. Which might have been solved with a clear command. (wtf)

Anyway, right now the problem only happens when I load the game with a translation selected and I then wish to return to the default (english) language. If I change it from the games settings GUI (not winsetup), the credits are still displayed in the original translated language. ???
This problem does not happen when I  start the game with the default language selected, I then have no problem changing the text in game from one language to the other and back and the credits will be displayed in the current "selected language".

Any idea why it might be messing up when I start the game in another language? ???
Title: Re: MODULE: Credits v1.19
Post by: Nishuthan on Fri 27/10/2017 06:34:51
I cant download the plugin Help
Title: Re: MODULE: Credits v1.19
Post by: Cassiebsg on Fri 27/10/2017 17:52:14
If you go 7 posts up, you'll find the link... but I'll make it easier for you: http://www.adventuregamestudio.co.uk/forums/index.php?topic=28659.msg636536414#msg636536414
Title: Re: MODULE: Credits v1.19
Post by: Nishuthan on Sun 29/10/2017 10:54:41
Thanks
Title: Re: MODULE: Credits v1.19
Post by: Nishuthan on Sun 29/10/2017 11:06:54
I have a Error I'm using AGS 3.4.0.
The Error is  "Credits.asc(80): Error (line 80): Undefined token 'StrCopy' "
How do i correct it ?
Title: Re: MODULE: Credits v1.19
Post by: Crimson Wizard on Sun 29/10/2017 12:07:11
Quote from: Nishuthan on Sun 29/10/2017 11:06:54
The Error is  "Credits.asc(80): Error (line 80): Undefined token 'StrCopy' "

StrCopy is an obsolete function which works with old-style AGS strings, it has been abandoned like 10 years ago.

Looks like this module may use an upgrade...

As the last resort, if there is no modern version of this module, go to the General Settings page in the editor, find "Backwards Compatibility" section and set "Enforce new-style strings" to FALSE.
Title: Re: MODULE: Credits v1.19
Post by: arj0n on Sun 29/10/2017 13:14:29
@Nishuthan:
You're using the credits module v1.17 or older (which does contain the - as Crimson Wizard said - obsolete StrCopy).
Download v1.19 here (http://www.mediafire.com/download/6m081dw4e07aojm/Credits_v1.19.rar), which works fine.

With v1.19 you might bump into an Undefined token 'PlaySound' error though.
I just quote the solution to this, as stated by Crimson Wizard earlier in this thread:
"this is because PlaySound is a deprecated function. To enable it you need to turn "Enforce new Audio scripting" off in the Backwards-compatibility settings of your project."
Title: Re: MODULE: Credits v1.19
Post by: Lurdiak on Thu 25/01/2018 02:13:44
I'm still fairly new to using AGS so it's possible I'm simply missing something obvious here... even after importing the main script directly copying the room script from the example game into the room script of my own game, no credits appear when I'm in that room... no errors appear either, so I've no clue as to what I'm doing wrong, exactly.
Title: Re: MODULE: Credits v1.19
Post by: arj0n on Thu 25/01/2018 23:54:48
@Lurdiak:

Here's 2 examples:

Scrolling example:
Credits[0].DefaultCreditColour=15;
Credits[0].DefaultCreditFont=2;
Credits[0].DefaultCreditX=eCreditCentred;

Credits[0].DefaultTitleColour=3;
Credits[0].DefaultTitleFont=0;
Credits[0].DefaultTitleX=eCreditCentred;

Credits[0].CreditStyle=eCreditScrolling;

Credits[0].DefaultCreditStartTransition=eCreditScrolling;
Credits[0].DefaultTitleStartTransition=eCreditScrolling;
Credits[0].TypeDelay=2;

Credits[0].AddTitle("Programming by:");
Credits[0].AddCredit("name1[[name3[[name3");
Credits[0].AddTitle("Testing by:");
Credits[0].AddCredit("name1[[name2[[name3");
Credits[0].Run();


Typing example:
Credits[0].DefaultCreditColour=15;
Credits[0].DefaultCreditFont=2;
Credits[0].DefaultCreditX=eCreditCentred;

Credits[0].DefaultTitleColour=3;
Credits[0].DefaultTitleFont=0;
Credits[0].DefaultTitleX=eCreditCentred;

Credits[0].CreditStyle=eCreditStatic;

Credits[0].DefaultCreditStartTransition=eCreditTypewriter;
Credits[0].DefaultTitleStartTransition=eCreditTypewriter;
Credits[0].TypeDelay=2;

Credits[0].AddTitle("Programming by:");
Credits[0].AddCredit("name1[[name3[[name3");
Credits[0].AddTitle("Testing by:");
Credits[0].AddCredit("name1[[name2[[name3");
Credits[0].Run();
Title: Re: MODULE: Credits v1.19
Post by: Lurdiak on Fri 26/01/2018 01:18:47
Those certainly are examples, but it doesn't help me understand how I'm supposed to use the code at all.
Title: Re: MODULE: Credits v1.19
Post by: arj0n on Fri 26/01/2018 01:30:56
works fine when placing it in the room_AfterFadeIn function
Title: Re: MODULE: Credits v1.19
Post by: Lurdiak on Fri 26/01/2018 02:28:40
Ah, I see. So if the room script is

Code (ags) Select
function room_AfterFadeIn()
{
      Credits[0].DefaultCreditColour=15;
    Credits[0].DefaultCreditFont=2;
    Credits[0].DefaultCreditX=eCreditCentred;
     
    Credits[0].DefaultTitleColour=3;
    Credits[0].DefaultTitleFont=0;
    Credits[0].DefaultTitleX=eCreditCentred;
     
    Credits[0].CreditStyle=eCreditScrolling;
     
    Credits[0].DefaultCreditStartTransition=eCreditScrolling;
    Credits[0].DefaultTitleStartTransition=eCreditScrolling;
    Credits[0].TypeDelay=2;
     
    Credits[0].AddTitle("Programming by:");
    Credits[0].AddCredit("name1[[name3[[name3");
    Credits[0].AddTitle("Testing by:");
    Credits[0].AddCredit("name1[[name2[[name3");
    Credits[0].Run();
     
}


I should be seeing the default credits scrolling in as soon as I enter it?
Title: Re: MODULE: Credits v1.19
Post by: arj0n on Fri 26/01/2018 10:21:43
Yes, sir.
Title: Re: MODULE: Credits v1.19
Post by: Lurdiak on Fri 26/01/2018 16:38:23
It still isn't working for some reason. :(
Title: Re: MODULE: Credits v1.19
Post by: Cassiebsg on Fri 26/01/2018 17:22:42
Make sure that you have LINKed the event in the editor, and did not just copy/pasted "function room_AfterFadeIn()" into the script (it won't work!).
Title: Re: MODULE: Credits v1.19
Post by: viktor on Wed 06/01/2021 15:39:12
Sorry for digging up this corpse but does this still work? It's the only credits plugin I could find. I imported the script but when I try to compile the game I get this error:

Credits.asc(100): Error (line 100): undefined symbol 'system'
Title: Re: MODULE: Credits v1.19
Post by: eri0o on Wed 06/01/2021 16:39:17
This is a super old module, you will have to update the source code yourself. Here's the table of things that were obsoleted, you can see that system became System and also what was system.ViewportHeight is now Screen.Height and other changes.

https://adventuregamestudio.github.io/ags-manual/ObsoleteScriptAPI.html

You can also use the compatibility settings in general settings to allow really old code to run - it's mentioned above in this thread.

If you do update the code for 3.5.0 , I recommend sharing here so that others can use it too. :)

I personally just use a GUI with labels and Tween (https://edmundito.gitbook.io/ags-tween/) it.

Edit: actually I may have a working version (below is untested code I found in my phone):
Spoiler

Header
Code (ags) Select
// Script header for module 'Credits'
//
// 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
//=========================================================

#define CREDIT_MAX_LINES 100
#define CREDIT_MAX_SEQUENCES 4
#define CREDIT_IMAGE "<img>"
#define CREDIT_DEFAULTSTATICSPECIAL "[]"

// Fake enumerations and make them autocomplete
#define eCreditCentred -1 
// import int eCreditCentred;
#define eCreditXDefault -2 
#define eCreditYDefault -2 
// import int eCreditXDefault;
// import int eCreditYDefault;
#define eCreditFontDefault -1 
// import int eCreditFontDefault;
#define eCreditColourDefault -1
// import int eCreditColourDefault;
#define eCreditAlignBelow -1
// import int  eCreditAlignBelow;
#define eCreditTransDefault -1
// import int  eCreditTransDefault;

enum CreditRunning_t { eCreditWait, eCreditRunning, eCreditFinished};
enum CreditStyle_t { eCreditScrolling, eCreditStatic };
enum CreditTransition_t {eCreditSimple=0, eCreditTypewriter,
eCreditSlideLeft, eCreditSlideRight, eCreditSlideTop, eCreditSlideBottom };
// Fades not possible with overlays, because of lack of transparency
// However we could maybe take a colour to fade to and gradually morph the RGB values
// to the next colour?


struct CreditSequence {
  import function AddTitle(String t, int x=-2, int font=-1, int colour=-1, int y=-2, CreditTransition_t start=-1, CreditTransition_t end=-1);
  import function AddCredit(String t, int x=-2, int font=-1, int colour=-1, int y=-2, CreditTransition_t start=-1, CreditTransition_t end=-1);
  import function AddImage(int sprite, int x=-1, int valign=-1, CreditTransition_t start=-1, CreditTransition_t end=-1);
 
  import function Run();
import function Pause();
import function IsRunning();
import function Stop();

  int LineSeparation;
  int Delay;
  int DefaultTitleX;
  int DefaultTitleY;
  int DefaultTitleFont;
  int DefaultTitleColour;
  CreditTransition_t DefaultTitleStartTransition;
  CreditTransition_t DefaultTitleEndTransition;
  int DefaultCreditX;
  int DefaultCreditY;
  int DefaultCreditFont;
  int DefaultCreditColour;
  CreditTransition_t DefaultCreditStartTransition;
  CreditTransition_t DefaultCreditEndTransition;
  CreditTransition_t DefaultImageStartTransition;
  CreditTransition_t DefaultImageEndTransition;
  int StartY;
  int MinY;
  CreditStyle_t CreditStyle;
  int SpaceSound;
  int TypeSound;
  int EOLSound;
  int TypeDelay;
  int TypeRandom;
  int SlideSpeed;
  int ExitDelay;
  int InterDelay;
  int JumpToRoomAtEnd;
  String StaticSpecialChars;

// Not protected, but please don't touch or use
  import function rep_ex();
import function Reset(int id=-1);

  // Internal stuff
  protected import function find_free();
  protected import function scroll();
  protected import function checkline();
  protected import function update();
  protected import function type();
  protected import function endprev(int n, char c='[');
  protected import function cleartrans(int inc);
  protected import String wordwrap(String s, int font, int width);
  protected String line[CREDIT_MAX_LINES];
  protected int x_pos[CREDIT_MAX_LINES];
  protected int fontimage[CREDIT_MAX_LINES];
  protected int colour[CREDIT_MAX_LINES];
  protected Overlay *ol[CREDIT_MAX_LINES];
  protected int oh[CREDIT_MAX_LINES];
  protected int ow[CREDIT_MAX_LINES];
  protected CreditTransition_t starttrans[CREDIT_MAX_LINES];
  protected CreditTransition_t endtrans[CREDIT_MAX_LINES];
  protected int y_pos[CREDIT_MAX_LINES];
protected CreditRunning_t Running;
  protected int maxy;
  protected int nextline;
  protected int timer;
  protected int ID;
  protected String typet;
};

import CreditSequence Credits[CREDIT_MAX_SEQUENCES];


Code (ags) Select
// Main script for module 'Credits'

int CreditShow; // which one are we showing now?

CreditSequence Credits[CREDIT_MAX_SEQUENCES];
export Credits;

// Make getting sprite sizes work across v2.71 and v2.72
function GetSpriteHeight(int slot) {
  DynamicSprite *tmp=DynamicSprite.CreateFromExistingSprite(slot);
  int height=tmp.Height;
  tmp.Delete();
  return height;
}

function GetSpriteWidth(int slot) {
  DynamicSprite *tmp=DynamicSprite.CreateFromExistingSprite(slot);
  int width=tmp.Width;
  tmp.Delete();
  return width;
}


protected function CreditSequence::find_free() {
  int i=0;
  while ((i<CREDIT_MAX_LINES) && (this.line[i] != null)) {
    i++;
  }
  if (i==CREDIT_MAX_LINES)
    Display("Credit Module has reached maximum %d lines, contact game author and tell them to increase CREDIT_MAX_LINES",
CREDIT_MAX_LINES);
else return i;
}

// TODO in add functions: add linebreaks for word-wrapping typed text

protected String CreditSequence::wordwrap(String s, int font, int width) {
  String t=s;   // input
  String l="";  // line
  String wl=""; // wrapped line
  String w="";  // word
  String o="";  // output
  int i=0;
  while (i<t.Length) {
    char c=t.Chars[i];
    l=l.AppendChar(c);
    if (c=='[') {
      o=o.Append(l);
      w="";
      l="";
      wl="";
    } else {
if (GetTextWidth(l, font)>=width) {
o=o.Append(wl);
o=o.AppendChar('[');
wl="";
if (c==' ') {
wl=wl.Append(w);
  l=w;
w="";
} else {
  w=w.AppendChar(c);
l=w;
}
} else {
if (c==' ') {
if (wl!="") wl=wl.AppendChar(' ');
wl=wl.Append(w);
w="";
} else {
  w=w.AppendChar(c);
}
      }
     
    }
     
    i++;
  }
  o=o.Append(l);
  return o;
}

function CreditSequence::AddTitle(String t, int x, int font, int colour, int y, CreditTransition_t start, CreditTransition_t end) {
int n=this.find_free();
  t=GetTranslation(t);
  this.line[n]=t;
if (font<0) this.fontimage[n]=this.DefaultTitleFont;
else this.fontimage[n]=font;
if (x < -1) this.x_pos[n]=this.DefaultTitleX;
  else this.x_pos[n]=x;
if (y < -1) this.y_pos[n]=this.DefaultTitleY;
  else this.y_pos[n]=y;
  if (start < 0) this.starttrans[n]=this.DefaultTitleStartTransition;
  else this.starttrans[n]=start;
  if (end < 0) this.endtrans[n]=this.DefaultTitleEndTransition;
  else this.endtrans[n]=end;
if (colour < 0) this.colour[n]=this.DefaultTitleColour;
  else this.colour[n]=colour;
  if (this.starttrans[n]==eCreditTypewriter) {
    int width=Screen.Width;
    if (this.x_pos[n]!=eCreditCentred) width=width-this.x_pos[n];
this.line[n]=this.wordwrap(t, this.fontimage[n], width);
}
}

function CreditSequence::AddCredit(String t, int x, int font, int colour, int y, CreditTransition_t start, CreditTransition_t end) {
int n=this.find_free();
  t=GetTranslation(t);
this.line[n]=t;
if (font<0) this.fontimage[n]=this.DefaultCreditFont;
else this.fontimage[n]=font;
if (x < -1) this.x_pos[n]=this.DefaultCreditX;
  else this.x_pos[n]=x;
if (y < -1) this.y_pos[n]=this.DefaultCreditY;
  else this.y_pos[n]=y;
  if (start < 0) this.starttrans[n]=this.DefaultCreditStartTransition;
  else this.starttrans[n]=start;
  if (end < 0) this.endtrans[n]=this.DefaultCreditEndTransition;
  else this.endtrans[n]=end;
if (colour < 0) this.colour[n]=this.DefaultCreditColour;
  else this.colour[n]=colour;
  if (this.starttrans[n]==eCreditTypewriter) {
    int width=Screen.Width;
    if (this.x_pos[n]!=eCreditCentred) width=width-this.x_pos[n];
this.line[n]=this.wordwrap(t, this.fontimage[n], width);
}
}

function CreditSequence::AddImage(int sprite, int x, int valign, CreditTransition_t start, CreditTransition_t end) {
int n=this.find_free();
this.line[n]=CREDIT_IMAGE;
this.fontimage[n]=-sprite;
  this.x_pos[n]=x;
  this.y_pos[n]=valign;
  if (start < 0) this.starttrans[n]=this.DefaultImageStartTransition;
  else this.starttrans[n]=start;
  if (end < 0) this.endtrans[n]=this.DefaultImageEndTransition;
  else this.endtrans[n]=end;
}

function CreditSequence::Pause() {
  if (CreditShow==this.ID) CreditShow=-1;
  else if ((CreditShow!=this.ID) && (this.Running == eCreditRunning))
CreditShow=this.ID;
}

function CreditSequence::Reset(int id) {
  this.DefaultCreditColour=0;
  this.DefaultCreditFont=0;
  this.DefaultCreditX=eCreditCentred;
  this.DefaultCreditY=eCreditCentred;
  this.DefaultTitleColour=0;
  this.DefaultTitleFont=0;
  this.DefaultTitleX=eCreditCentred;
  this.DefaultTitleY=eCreditCentred;
  this.LineSeparation=8;
  if (id>=0) this.ID=id;
  this.line[0]=null;
  this.Running=eCreditWait;
  this.StartY=Screen.Height;
  this.MinY=0;
  this.CreditStyle=eCreditScrolling;
  this.EOLSound=-1;
  this.SpaceSound=-1;
  this.TypeSound=-1;
  this.SlideSpeed=1;
  this.JumpToRoomAtEnd=-1;
  this.StaticSpecialChars=CREDIT_DEFAULTSTATICSPECIAL;
  // TBD: add more resets
  // Go through overlays and remove?
}

protected function CreditSequence::endprev(int n, char c) {
  int i=0;
 
  while (i<n) {
    char e=this.line[i].Chars[this.line[i].Length-1];
    String s=String.Format("%c", e);
    if (e==c || (this.StaticSpecialChars.Contains(s)<0)) {
this.starttrans[i]=eCreditTransDefault;
}
    i++;
  }
}

protected function CreditSequence::cleartrans(int inc) {
  int ln=this.nextline;
String nl=this.line[ln];
String s=nl.Substring(nl.Length-1, 1);
char c=s.Chars[0];
if (this.StaticSpecialChars.Contains(s)<0) {
this.starttrans[ln]=eCreditTransDefault;
  this.endprev(ln, '[');
} else {
  this.nextline+=inc;
}
}

protected function CreditSequence::checkline() {
  int ln=this.nextline;
  int id=this.ID;
String nl=this.line[ln];
int x=this.x_pos[ln];
int y=this.y_pos[ln];
if (nl==null) {  return 0; }
if (this.CreditStyle==eCreditStatic) {
  if (this.ol[ln]==null) {
    if (nl==CREDIT_IMAGE) {
int spr=-this.fontimage[ln];
this.oh[ln]=GetSpriteHeight(spr);
this.ow[ln]=GetSpriteWidth(spr);
if (x==eCreditCentred) x=(Screen.Width-this.ow[ln])/2;
if (y==eCreditCentred) y=(Screen.Height-this.oh[ln])/2;
this.x_pos[ln]=x;
this.y_pos[ln]=y;
      if (this.starttrans[ln]==eCreditSlideBottom) {
this.ol[ln]=Overlay.CreateGraphical(x, Screen.Height, spr, true);
this.timer=0;
} else if (this.starttrans[ln]==eCreditSlideTop) {
this.ol[ln]=Overlay.CreateGraphical(x, 0, spr, true);
this.ol[ln].Y=-this.oh[ln];
this.timer=0;
} else if (this.starttrans[ln]==eCreditSlideLeft) {
this.ol[ln]=Overlay.CreateGraphical(0, y, spr, true);
this.ol[ln].X=-this.ow[ln];
this.timer=0;
} else if (this.starttrans[ln]==eCreditSlideRight) {
this.ol[ln]=Overlay.CreateGraphical(Screen.Width, y, spr, true);
this.timer=0;
} else {
  // Simple
this.ol[ln]=Overlay.CreateGraphical(x, y, spr, true);
this.timer=this.ExitDelay;
//this.starttrans[ln]=eCreditTransDefault;
this.cleartrans(0);
}
  } else {
    while (nl.Length>0 && this.StaticSpecialChars.Contains(nl.Substring(0, 1))>=0) {
this.endprev(ln, nl.Chars[0]); // Clear all old lines that ended with that char
this.line[ln]=this.line[ln].Substring(1, nl.Length-1); // Chop it off
nl=this.line[ln];
}
    // Remove terminal [ or ] from that to be displayed (not from array, though)
    if (nl.Length>0) {
String lc=nl.Substring(nl.Length-1, 1);
if (this.StaticSpecialChars.Contains(lc)>=0) nl=nl.Truncate(nl.Length-1);
}
this.oh[ln]=GetTextHeight(nl, this.fontimage[ln], Screen.Width);
this.ow[ln]=GetTextWidth(nl, this.fontimage[ln]);
if (nl.Length!=0) {
if (x==eCreditCentred) x=(Screen.Width-this.ow[ln])/2;
  if (y==eCreditCentred) y=(Screen.Height-this.oh[ln])/2;
this.x_pos[ln]=x;
this.y_pos[ln]=y;
if (this.starttrans[ln]==eCreditSlideBottom) {
this.ol[ln]=Overlay.CreateTextual(x, Screen.Height, Screen.Width, this.fontimage[ln], this.colour[ln], nl);
this.timer=0;
} else if (this.starttrans[ln]==eCreditSlideTop) {
this.ol[ln]=Overlay.CreateTextual(x, 0, Screen.Width, this.fontimage[ln], this.colour[ln], nl);
this.ol[ln].Y= -this.oh[ln];
this.timer=0;
} else if (this.starttrans[ln]==eCreditSlideLeft) {
this.ol[ln]=Overlay.CreateTextual(0, y, Screen.Width, this.fontimage[ln], this.colour[ln], nl);
this.ol[ln].X= -this.ow[ln];
this.timer=0;
} else if (this.starttrans[ln]==eCreditSlideRight) {
this.ol[ln]=Overlay.CreateTextual(Screen.Width, y, Screen.Width, this.fontimage[ln], this.colour[ln], nl);
this.timer=0;
  } else if (this.starttrans[ln]==eCreditTypewriter) {
    this.typet=String.Format("%c", nl.Chars[0]);
this.ol[ln]=Overlay.CreateTextual(x, y, Screen.Width, this.fontimage[ln], this.colour[ln], this.typet);
this.timer=this.TypeDelay+Random(this.TypeRandom);
} else {
// Simple
this.ol[ln]=Overlay.CreateTextual(x, y, Screen.Width, this.fontimage[ln], this.colour[ln], nl);
this.timer+=(((nl.Length / game.text_speed) + 1) * GetGameSpeed())+this.ExitDelay;
//this.starttrans[ln]=eCreditTransDefault;
this.cleartrans(0);
}
    } else {
      this.timer=this.InterDelay;
      this.nextline++;
    }
  }
}
  } else {
if (this.maxy<=this.StartY) {
if (nl==CREDIT_IMAGE) {
// Add an image in
int spr=-this.fontimage[ln];
//this.oh[ln]=GetGameParameter(GP_SPRITEHEIGHT, spr, 0, 0);
//this.ow[ln]=GetGameParameter(GP_SPRITEWIDTH, spr, 0, 0);
this.oh[ln]=GetSpriteHeight(spr);
this.ow[ln]=GetSpriteWidth(spr);
if (x==eCreditCentred) x=(Screen.Width-this.ow[ln])/2;
this.ol[ln]=Overlay.CreateGraphical(x, this.maxy, spr, true);
if (this.y_pos[ln]==eCreditAlignBelow)
this.maxy+=this.oh[ln];
else
this.maxy+=this.y_pos[ln];
} else {
this.oh[ln]=GetTextHeight(nl, this.fontimage[ln], Screen.Width);
this.ow[ln]=GetTextWidth(nl, this.fontimage[ln]);
if (nl.Length!=0) {
if (x==eCreditCentred) x=(Screen.Width-this.ow[ln])/2;
this.ol[ln]=Overlay.CreateTextual(x, this.maxy, Screen.Width, this.fontimage[ln], this.colour[ln], nl);

} else {
// Skip overlay for blank line, and just increment y pos
nl="A";
}
this.maxy+=(this.oh[ln]+this.LineSeparation);
}
this.nextline++;
}
}
  return 1;
}
 

protected function CreditSequence::scroll () {
  // move all overlays up
  int anyleft=0;
  int i=0;
  while (i<this.nextline) {
    if (this.ol[i]!=null) {
this.ol[i].Y--;
if ((this.ol[i].Y+this.oh[i])<this.MinY) {
this.ol[i].Remove();
this.ol[i]=null;
}
else anyleft=1;
}
i++;
  }
  this.maxy--;
  this.checkline();
  if (!anyleft) {
    this.Running=eCreditFinished;
CreditShow=-1;
if (this.JumpToRoomAtEnd>=0) player.ChangeRoom(this.JumpToRoomAtEnd);
}
}

function CreditSequence::Run() {
CreditShow=this.ID;
this.Running=eCreditRunning;
this.nextline=0;
  this.maxy=this.StartY;
  this.checkline();
}


function CreditSequence::Stop() {
  int i=0;
  while (i<CREDIT_MAX_LINES) {
    if (this.ol[i]!=null && this.ol[i].Valid) this.ol[i].Remove();
    this.ol[i]=null;
    i++;
  }
  this.timer=0;
this.Running=eCreditFinished;
CreditShow=-1;
}


function CreditSequence::IsRunning() {
  return this.Running;
}


protected function CreditSequence::type() {
  int ln=this.nextline;
String nl=this.line[ln];
String tl=this.typet;
if (tl==nl) {
this.timer=this.ExitDelay;
//if (this.EOLSound>=0) PlaySound(this.EOLSound);
this.cleartrans(0);
this.nextline++;
this.typet="";
} else {
  char c=nl.Chars[tl.Length];

  tl=tl.AppendChar(c);
  this.typet=tl;
  this.ol[ln].SetText(Game.Camera.Width, this.fontimage[ln], this.colour[ln], tl);
  if (c == ' ') {
//if (this.SpaceSound>=0) PlaySound(this.SpaceSound);
  } else if (c == '[') {
    //if ((tl.Length!=nl.Length) && (this.EOLSound>=0)) PlaySound(this.EOLSound);
  } else {
//if (this.TypeSound>=0) PlaySound(this.TypeSound);
  }
this.timer=this.TypeDelay+Random(this.TypeRandom);
}
}

protected function CreditSequence::update() {
  // move all overlays up

  int anyleft=0;
  int nl=this.nextline;
  int i=0;
  //if (this.CreditStyle==eCreditStatic) nl++;
  while (i<=nl) {
    if (this.ol[i]!=null) {
      if (this.starttrans[i]==eCreditTransDefault) {
        // exit transition
        if (this.endtrans[i]==eCreditSlideBottom) {
          this.timer=0;
          this.ol[i].Y+=this.SlideSpeed;
          if ((this.ol[i].Y)>this.StartY) {
this.ol[i].Remove();
this.ol[i]=null;
if (i==nl) {
this.nextline++;
if (!anyleft) this.timer=this.InterDelay;
  }
}
  } else if (this.endtrans[i]==eCreditSlideTop) {
          this.timer=0;
          this.ol[i].Y-=this.SlideSpeed;
          if ((this.ol[i].Y+this.oh[i])<this.MinY) {
this.ol[i].Remove();
this.ol[i]=null;
if (i==nl) {
this.nextline++;
if (!anyleft) this.timer=this.InterDelay;
  }
}
  } else if (this.endtrans[i]==eCreditSlideLeft) {
          this.timer=0;
    this.ol[i].X-=this.SlideSpeed;
          if ((this.ol[i].X+this.ow[i])<0) {
this.ol[i].Remove();
this.ol[i]=null;
if (i==nl) {
this.nextline++;
if (!anyleft) this.timer=this.InterDelay;
  }
}
  } else if (this.endtrans[i]==eCreditSlideRight) {
          this.timer=0;
    this.ol[i].X+=this.SlideSpeed;
          if ((this.ol[i].X)>=Screen.Width) {
this.ol[i].Remove();
this.ol[i]=null;
if (i==nl) {
this.nextline++;
if (!anyleft) this.timer=this.InterDelay;
  }
}
  } else {
          this.timer=this.InterDelay;
this.ol[i].Remove();
this.ol[i]=null;
if (i==nl) this.nextline++;
}
  } // if starttrans==default
      anyleft=1;
} // if overlay null
i++;
  } //while
  i=nl;
  if (this.ol[i]!=null) {
    // Incoming
        if (this.starttrans[i]==eCreditSlideBottom) {
          if (this.ol[i].Y<=this.y_pos[i]) {
this.ol[i].Y=this.y_pos[i];
this.cleartrans(1);
          this.timer+=(((this.line[i].Length / game.text_speed) + 1) * GetGameSpeed())+this.ExitDelay;
} else {
this.ol[i].Y-=this.SlideSpeed;
this.timer=0;
}
  } else if (this.starttrans[i]==eCreditSlideTop) {
          if (this.ol[i].Y>=this.y_pos[i]) {
this.ol[i].Y=this.y_pos[i];
this.cleartrans(1);
          this.timer+=(((this.line[i].Length / game.text_speed) + 1) * GetGameSpeed())+this.ExitDelay;
} else {
this.ol[i].Y+=this.SlideSpeed;
this.timer=0;
}
  } else if (this.starttrans[i]==eCreditSlideLeft) {
          if (this.ol[i].X>=this.x_pos[i]) {
this.ol[i].X=this.x_pos[i];
this.cleartrans(1);
          this.timer+=(((this.line[i].Length / game.text_speed) + 1) * GetGameSpeed())+this.ExitDelay;
} else {
this.ol[i].X+=this.SlideSpeed;
this.timer=0;
}
  } else if (this.starttrans[i]==eCreditSlideRight) {
          if (this.ol[i].X<=this.x_pos[i]) {
this.ol[i].X=this.x_pos[i];
this.cleartrans(1);
          this.timer+=(((this.line[i].Length / game.text_speed) + 1) * GetGameSpeed())+this.ExitDelay;
} else {
this.ol[i].X-=this.SlideSpeed;
this.timer=0;
}
  } else if (this.starttrans[i]==eCreditSimple) {
    this.cleartrans(1);
  } else if (this.starttrans[i]==eCreditTypewriter) {
    this.type();
    }
  }
  if (this.nextline!=nl) {
      anyleft+=this.checkline();
  }
  if (!anyleft ) {
    this.Running=eCreditFinished;
CreditShow=-1;
if (this.JumpToRoomAtEnd>=0) player.ChangeRoom(this.JumpToRoomAtEnd);
}
}

function CreditSequence::rep_ex () {
#ifdef CREDITDEBUG
  dbgLabel.Text=String.Format("%4d %4d %s",  this.nextline,  this.timer,  this.line[this.nextline]);
#endif 
  if (this.timer==0) {
    if (this.CreditStyle==eCreditScrolling ) {
// Do scroll
this.scroll();
this.timer=this.Delay;
} else if (this.CreditStyle==eCreditStatic ) {
  this.update();
}
  } else {
    this.timer--;
  }
}

function game_start () {
  int i=0;
  while (i<CREDIT_MAX_SEQUENCES) {
    Credits[i].Reset(i);
    i++;
  }
CreditShow=-1;
}

function repeatedly_execute () {
if (CreditShow >= 0) {
  Credits[CreditShow].rep_ex();
  }
}

int ee;

function on_key_press (int keycode) {
  if ((keycode=='S') && (ee<2)) ee++;
  else if ((keycode=='H') && (ee==2)) ee++;
  else if ((keycode=='?') && (ee==3)) {
Overlay *cmee=Overlay.CreateTextual(2, 2, 300, 1, 60000, Credits_get());
Wait(40);
cmee.Remove();
}
}

[close]
Title: Re: MODULE: Credits v1.19
Post by: viktor on Wed 06/01/2021 18:43:31
Just tried out your code. It doesn't compile. The error is:

Credits.asc(558): Error (line 558): undefined symbol 'Credits_get'
Title: Re: MODULE: Credits v1.19
Post by: Crimson Wizard on Wed 06/01/2021 18:59:28
Quote from: viktor on Wed 06/01/2021 15:39:12
Sorry for digging up this corpse but does this still work? It's the only credits plugin I could find. I imported the script but when I try to compile the game I get this error:

Credits.asc(100): Error (line 100): undefined symbol 'system'

Set "Script compatibility level" to lowest possible. This is a usual solution when old functions are not found. Also for the old module to work you need to disable "Enforce new style strings".

Actually there's a slightly newer module posted by arj0n in the thread above: https://www.adventuregamestudio.co.uk/forums/index.php?topic=28659.msg636573826#msg636573826
Title: Re: MODULE: Credits v1.19
Post by: eri0o on Wed 06/01/2021 19:41:59
Viktor, you can replace that function call with any string, it was "Credits module 1.13 by SSH" in the original code - by comparison with the downloaded scm.
Title: Re: MODULE: Credits v1.19
Post by: Dave Gilbert on Wed 13/12/2023 17:14:30
Hi all. I know this module is super old but it's also super useful! I was wondering if it's at all possible to make the credits move faster than a delay of "0"? For my high-res game it seems to be going a bit slower than I'd like. Any suggestions on how to speed it up? I tried going below 0 but as expected that didn't work. :)
Title: Re: MODULE: Credits v1.19
Post by: eri0o on Wed 13/12/2023 18:35:18
Dave, try setting the SlideSpeed of it to 2, it will be twice as fast. (I haven't tested and am not in the computer, just reading the module code in the spoiler I posted above...)
Title: Re: MODULE: Credits v1.19
Post by: Crimson Wizard on Wed 13/12/2023 18:42:54
From my understanding this is simply a collection of texts and images drawn on screen and moved up?

Someone should write a new module where credits are moved using Tween (at least in time represented by milliseconds, with floating point math etc).
Title: Re: MODULE: Credits v1.19
Post by: Dave Gilbert on Thu 14/12/2023 20:15:09
The slide speed setting worked! Thanks!