Problem with credits... once again

Started by Magus, Fri 29/09/2006 23:56:15

Previous topic - Next topic

Magus

Hello all.

Ok, I have done what I planned to do for my first little game, and now the time for the end credits has come. And here I stuck desperately...

First of all, I tried both a plug-in and a module. Then I searched through ALL the relevant topics looking for similar problems. It did't help. Then I tried to read the manuals, but my scripting skills are so lame that those tons of code nearly made me faint. Then I tried to experiment... And here I am: almost blind (2.47 am) and exhausted and the problem is still laughing in my face.

As far as I am concerned, the plug-in doesn't work with AGS 2.72. So, I attempted using the Credits module instead. It installed just ok, but when I tried to run the game (without ANY changes in my initial code), it displayed this message: Error(line 80): Undefined token 'StrCopy'. What is it??

Also, if you have some free time, please give me some step-by-step instruction on how to do credits with this module. I want them to run from the bottom of the screen to its top, one by one, with some gaps between them. The thing is, I have a melody that runs about 1 min, so that I want all these credits (about 10 lines) to fit into this melody's duration.

Thanks in advance!

Ashen

I think you've petty much hit the nail on the head yourself -  the plugin doesn't run under 2.72. (Although the newest version of the module should - are you sure you have it?)
In theory, however, you should be able to bypass any errors by un-checking the 'Enforce object-based scripting' and/or 'Enforce new-style Strings' options on the General Settings window. The String one, at least, should be documented in the module. (The error you get is because the StrCopy function - along with all the old-style string functions - is obsolete. You can look them up in the manual to find the current versions to use.)

As to how to make the module do exactly what you want - can't help you there, sorry, but again it should be documented in the module's Script Header.
I know what you're thinking ... Don't think that.

Magus

#2
Quote from: Ashen on Sat 30/09/2006 01:57:20
I think you've petty much hit the nail on the head yourself -  the plugin doesn't run under 2.72. (Although the newest version of the module should - are you sure you have it?)

Ashen, thanks for the reply. As I said, I have already figured that the plug-in doesn't work - that's why I switched to the module. And yes, I have the latest edition...
But what I didn't notice is that this version had some working example in it. I will try to examine its code now and adopt it for my needs. We'll see if it helps...

EDIT:
Ok, I copied the code from the example and tried to run my game. Now the mistake is: 'CreditSequence::AddTitle^7'. Any ideas?

Here is the code that I use (although I believe you're pretty familiar with it):

// room script file

#sectionstart room_a  // DO NOT EDIT OR REMOVE THIS LINE
function room_a() {
  Debug(4, 1);
  // script for Room: Player enters room (after fadein)
  Credits[0].CreditStyle = eCreditStatic;
  Credits[0].DefaultTitleY = 95;
  Credits[0].DefaultCreditY = 125;
  Credits[0].DefaultCreditFont = 6;
  Credits[0].DefaultTitleFont = 4;
  Credits[0].DefaultTitleColour = 51200;
  Credits[0].DefaultCreditColour = 1280;
  Credits[0].DefaultTitleStartTransition = eCreditSimple;
  Credits[0].DefaultCreditStartTransition = eCreditSimple;
  Credits[0].DefaultTitleStartTransition = eCreditSlideTop;
  //Credits[0].DefaultTitleStartTransition = eCreditSlideLeft;
  //Credits[0].DefaultCreditStartTransition = eCreditSlideLeft;
  //Credits[0].DefaultTitleEndTransition = eCreditSlideRight;
  //Credits[0].DefaultCreditEndTransition = eCreditSlideRight;

   Credits[0].StaticSpecialChars="[]~";

  Credits[0].AddTitle("In association with]");
  Credits[0].AddCredit("Potatotower Games");
  //Credits[0].AddTitle("In association with[");
  Credits[0].AddCredit("and Stick");

  Credits[0].AddTitle("]Story[");
  Credits[0].AddCredit("SSH the Red Eyed");

  Credits[0].AddTitle("Scripting[");
  Credits[0].AddCredit("SSH the Red Eyed");

  Credits[0].AddTitle("Helpful AGS Community Members~");

  Credits[0].AddTitle(" [Modules]");
  Credits[0].AddCredit("Credits 1.17 by SSH");
  Credits[0].AddCredit("Description 1.02 by SSH");
  Credits[0].AddCredit("Some other stuff");
  Credits[0].AddCredit("and another thing");

  Credits[0].AddTitle("] [Fonts]");
  Credits[0].AddCredit("http://www.twin-fonts.com");
  Credits[0].AddCredit("and http://www.dafont.com");

  Credits[0].AddTitle("] [Music]");
  Credits[0].AddCredit("SSH the Red Eyed");
  Credits[0].AddCredit("Teh Interwebs");
  Credits[0].AddCredit("random noises");

  Credits[0].AddTitle("]~Clay[");
  Credits[0].AddCredit("Van Morrison Clay");

  Credits[0].AddTitle("Created With[");
  Credits[0].AddCredit("AGS by Chris Jones");

  Credits[0].Run();



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

#sectionstart room_b  // DO NOT EDIT OR REMOVE THIS LINE
function room_b() {
  // script for Room: Repeatedly execute

if (Credits[0].IsRunning()==eCreditFinished) {
  Wait(100);
  cEgo.ChangeRoom(2);
}
}
#sectionend room_b  // DO NOT EDIT OR REMOVE THIS LINE

//

Once again, this is the code by SSH, I am just trying to adopt it. But how? What should I redefine, add, alter to make it work within my game?

Candle

#3
Be nice to see this work as I could not get it to work.

This does work for me :
In theory, however, you should be able to bypass any errors by un-checking the 'Enforce object-based scripting' and/or 'Enforce new-style Strings' options on the General Settings window.

Magus


Ashen

Is there anything more to the error message? I've tried the module in 2.72 with exactly that code (which looks like just the default demo-code anyway, right?) and it works perfectly.
I know what you're thinking ... Don't think that.

Candle

I used this and it work fine when i untick the two that Ashen said to.
Credits[0].DefaultCreditFont=2;
Credits[0].DefaultTitleFont=2;
Credits[0].DefaultTitleColour=65000;
Credits[0].DefaultCreditColour=15;
Credits[0].Delay=1;

Credits[0].AddTitle("Scripting by");
Credits[0].AddCredit("SSH");
Credits[0].AddImage(10, eCreditCentred, eCreditAlignBelow);
Credits[0].AddTitle("ScrollingCredit Module by");
Credits[0].AddCredit("SSH again!");
Credits[0].Run();

SilverWizard_OTF

I thought a bit simple idea. You can create a text (your credits) in a paint program (like windows' MS-Paint) to a white background, of course. Then import this image (Grap entire image option) to AGS engine. Now you can create an object which will have this text-image, and with a object[].move(..) script command, you can move it down-->up. Then, because maybe if texts are very much and AGS engine doesn't allow to grap so big image, you can have another object for the rest of the text.
  I hope you got what i want to say. It's a simple solution which doesn't include any Modules or advanced scripting.
"All we have to decide is what to do, with the time that is given to us"

SSH

The demo game uses an older version of the module. Try loading up the demo game, then re-importing the module from the latest zip into the demo game.
12

Magus

#9
Yes, thanks, guys, it finally worked. I don't know why and how, but the credits appeared. Now I will try to figure out how to change the colors and sizes of fonts, but now that the whole thing works I don't expect it to be much of a problem.

SilverWizard_OTF, it seems to be a reasonable idea (importing the whole image made in some paint program) but I think that the whole process is too complicated. Why trying to do all this stuff if we already have a ready-made module that works with texts alone just fine? Although, in theory, your approach surely might work. Well, I think so.

Before managine to make this module work, I was even thinking of putting each credit into separate screens and changing them one by one in order to create an illusion that it is the text-lines move - not the screens. But if so, I'd have to add about 10 new screens to the game, which also seemed to be too complicated for such an easy task.

Well, anyroad, now the credits run smooth and fine. Thanks!

Edit:
Oh, blast. Another problem. The module doesn't seem to be working with the Russian language. In the game my font works just fine though.

Is there any way to overcome this problem in the credits sequence?

//
Modified:

The mistake is 'Error (line12): Parse error in expr near "here is my Russian title"'

I tried to fix it with the ' Credits[1].DefaultCreditFont = 0;' expression (0 is my default Russian font), but the error persists.

Ashen

What does line 12 look like? It's possible (but I don't know how likely) that it's not the font that causing the error, but some mistake you've made with the code. Can you show us line 12 and the ones around it? (Lines 11 - 13 should do.)

Also, don't double post - you use the 'Modify' button sometimes, please keep it up.
I know what you're thinking ... Don't think that.

Magus

#11
Quote from: Ashen on Sun 01/10/2006 12:21:35
What does line 12 look like?

Ok, it goes like this:


  Credits[1].DefaultCreditFont = 1;
  Credits[1].DefaultTitleFont = 2;
  Credits[1].CreditStyle=eCreditScrolling;
  Credits[1].DefaultCreditColour=60000;
  Credits[1].DefaultTitleColour=15;
 
Credits[1].AddTitle("Новый мир" представляет:); // The translation for Ashen: 'The New World presents'
Credits[1].AddCredit("НАЗВАНИЕ ИГРЫ"); // 'The Game's name'

and so on.

The thing is that when I replace the Russian letters with any English letters the whole thing works. So the problem is definitely in the language.

Quote from: Ashen on Sun 01/10/2006 12:21:35
Also, don't double post - you use the 'Modify' button sometimes, please keep it up.

Ok, sorry, I didn't even notice that I did so... Gotta be more attentive :)

Ops. The smile icon above (in the line with 'Новый мир представляет') is not supposed to be there. It shoud be ':' and ')', but the forum engine replaced it with the smile.

So that that line should read Credits[1].AddTitle("Новый мир" представляет: );

Edit:

Ashen, I finally got it what you meant by 'Don't double post'. Sorry, I just made the same mistake. I will not repeat it anymore.

Ashen

#12
So line 12 would be one of these:

Code: ags

Credits[1].AddTitle("Новый мир" представляет:); // The translation for Ashen: 'The New World presents'
Credits[1].AddCredit("НАЗВАНИЕ ИГРЫ"); // 'The Game's name'


I guess?
That first line looks wrong to me. I'm not very familiar with the Credits module, but the parameters might be off. Is this a direct copy from your script, or have you re-typed it for the post? You're missing a comma after "Новый мир" - which might just be here if you retyped it - and without a translation for представляет: I can't really tell what's going on there.
The problem might be with the characters you're assuming - I think you've had to replace the 'standard' 128 characters with Russian ones, right? Some chars (e.g. % " [) have special meanings, and need to be 'masked' to appear correctly (see this link, and it's possible the Credits module has some of it's own). If you're trying to use those characters, that might be causing the error. (And might be why it looks like you've got a missing comma...)

EDIT (After KhrisMUC, below):
Thank you - That's what I meant to say. Apologies if I wasn't clear enough.


I think the Credits module allows you to use images for the credits (the Credits[n].AddImage() function) - perhaps you could use that for the Russian text? The last resort option might be to write the game in English, and create a translation to set the Russian text, since they can use the 'extended' TTF characters. Downside there is, I'm not sure if/how well the Credits module works with translations.
I know what you're thinking ... Don't think that.

Magus

Ashen, you were right. Some parameter was probably missing. I copied the initial sample code to my game once again, replaced the first line with the Russian characters and the whole thing suddently worked. I don't know what I had missed in the first place but now it runs just perfect. Sorry for all the bother and thank you thousand times. The problem is solved for now.

Khris

Just to clarify, "Parse error in expr near ..." makes perfect sense if your actual line looked like this:
Code: ags
Credits[1].AddTitle("Новый мир" представляет:);
From the example code, it looks like AddTitle wants a single string, and regardless of the russian characters or actual wanted parameters, it's "abc" def inside the (), which of course was rejected by the compiler.
It should've been:
Credits[1].AddTitle("Новый мир представляет:");

Magus

#15
Quote from: KhrisMUC on Mon 02/10/2006 08:36:13
Just to clarify

Ah... Now I see! Thank you very much for your explanation!!
So, there is no way I can use several inverted commas in such statements?

Khris

If you want to use "s inside a string, like Ashen said, you have to mask it.
Check the documentation of the module/plug-in, or try
\"
(from Ashen's link).

Magus

#17
Quote from: KhrisMUC on Mon 02/10/2006 13:59:11
\"

Got it. Thanks!

EDIT

Yes, the mask worked.

EDIT

Hello, it's me again. And here is my next question regarding the credits.

I have this mistake: "Credit Module has reached maximum 100 lines, contact game author and tell them to increase CREDIT_MAX_LINES". How can I increase them?

Khris

Check the module's header and script for a line that looks like this:

#define CREDIT_MAX_LINES 100

Then replace 100 with e.g. 150.

(Not sure this'll work, but it's worth a try.)

SSH

Yes, that is the correct solution.
12

SMF spam blocked by CleanTalk