MODULE: Credits v1.19

Started by SSH, Thu 22/09/2005 16:22:54

Previous topic - Next topic

SSH

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:

Code: ags

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 (Requires AGS v2.71!)
View Full instructions
12

Pumaman

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  :)

vampyredcs

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

SSH

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:

Code: ags

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!
12

Bleckman1974

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 :-*
Narcolepsy (BACK IN PRODUCTION)
Story (50%)
Graphics (5%)
Puzzles(20%)
Programming(15%)

Still Reading Commercial Emails For Free?
Receive Emails On Topics That Interests You
And Get Paid For It! Get $10 Just to signup!
http://hits4pay.com/members/index.cgi?bleckman1974

Candle

#5
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.

Ashen

#6
In the repeatedly_execute function for the room, just put:
Code: ags

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


At least, that works in the version I have.
I know what you're thinking ... Don't think that.

Peder 🚀

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

SSH

#8
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!
12

The_Creep

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?
If you had nothing left, would you risk it all to change everything?

SSH

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?
12

The_Creep

#11
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.
If you had nothing left, would you risk it all to change everything?

SSH

#12
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!
12

Alynn

#13
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
Code: ags

//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
Code: ags
Adventure Game Studio
by Chris Jones


What I would like to see is
Code: ags
Adventure Game Studio
Ã,  Ã, by Chris Jones

SSH

Top slide is definately fixed now. And the simple credits with a [ works in the demo included in the zip file...
12

Alynn

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.

SSH

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 ;)
12

joelphilippage

#17
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!



Khris

#18
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.

SSH

v1.18 is up to fix a translation-related problem that Cinfa found.
12

SMF spam blocked by CleanTalk