Adventure Game Studio

AGS Support => Beginners' Technical Questions => Topic started by: Grapefruitologist on Wed 27/12/2006 02:08:39

Title: Error updating AGS, const string
Post by: Grapefruitologist on Wed 27/12/2006 02:08:39
Ok, so when I was trying to install a module, it wouldn't work, and I realized that I only had version 2.70 of AGS, which is why the module wouldn't work. So I tried updating to 2.72 and everything seemed to be going fine, I moved my game's folder to the new updated version of AGS, and when I tried to open it, it went fine, but when I tried saving the game, it gave me this error:
QuoteError (line 631): Type mismatch: cannot convert "const string" to "string"
Title: Re: Error updating AGS, const string
Post by: FSi++ on Wed 27/12/2006 10:58:33
As shorthand solution I'd suggest you to uncheck "Enorce new-style Strings" in Game Settings.
Title: Re: Error updating AGS, const string
Post by: Khris on Wed 27/12/2006 14:54:37
Post line 631 and its surroundings already, will you?
There are no telepathic people on this forum, you know.
Title: Re: Error updating AGS, const string
Post by: Grapefruitologist on Thu 28/12/2006 02:14:55
Uh, sorry I just read the rules when I logged in that says to include the entire error message. The entire error message is:
QuoteThere was an error compiling your script. The problem was: In: 'Global script'

Error (line 631): Type mismatch: cannot convert "const string" to "string"

Do you want to fix the script now? (Your game has not been saved).

Line 631:
QuoteDefineMode(      WALK,      "Walk to",   9,    0 );//The template uses AGS mode 9 for walk modes, instead of 0.
Line 629 to 639:
Quote//Normal modes:      MODE   "name"       AGS   Extension   
//                  cursor
//                  mode
Ã,  DefineMode(      WALK,      "Walk to",   9,    0 );//The template uses AGS mode 9 for walk modes, instead of 0.
Ã,  DefineMode(      LOOK,      "Look at",   1,   'l');
Ã,  DefineMode(      TALK,      "Talk to",   3,   't');
Ã,  DefineMode(      PICKUP,   "Pick up",   5,   'p');
Ã,  DefineMode(      OPEN,      "Open",         8,   'o');
Ã,  DefineMode(      CLOSE,   "Close",      8,   'c');
Ã,  DefineMode(      PUSH,      "Push",         8,   's');
Ã,  DefineMode(      PULL,      "Pull",         8,   'y');
Ã,  DefineMode(      SAIL,      "Sail to",   9,    0 );//you can delete this one, its just for the little demo game.
Title: Re: Error updating AGS, const string
Post by: Khris on Thu 28/12/2006 02:33:49
Even if it didn't say so in the rules, how are we supposed to help you without seeing at least line 631 of the actual code...?

Ok, search the global script for the function declaration of DefineMode, the line will probably look like this:
function DefineMode(int x, string y, int z, char c) {
Like suggested in the manual (http://www.adventuregamestudio.co.uk/manual/UpgradingTo271.htm), add the keyword "const" right before "string".
Title: Re: Error updating AGS, const string
Post by: Grapefruitologist on Thu 28/12/2006 02:47:59
Ok, it was on line 83 and it says:
Quotefunction DefineMode(int mode, string name, int AGSmode, char extension){
I changed it to:
Quotefunction DefineMode(int mode, const string name, int AGSmode, char extension){
But I still get the same error message when attempting to save the game and quit.
EDIT: However, now it says that the error is on line 644, which is:
QuoteÃ,  DefineInvMode(   USE,   "Use",      "with",   0,   1,   'u');
EDIT2: I tried checking "Enforce new-style Strings" (as it was unchecked) to see what it would do, and now I'm getting this error message instead:
QuoteThere was an error compiling your script. The problem was: In: 'Global script'

Error (line 544): Type mismatch: cannot convert "String*" to "string"

Do you want to fix the script now? (Your game has not been saved).
Line 544:
Quoteint dir=ExtensionEx(2,GSlocname);
Title: Re: Error updating AGS, const string
Post by: Khris on Thu 28/12/2006 06:35:59
-Uncheck "Enforce new style strings".
-look for "function DefineInvMode(int mode, string name, string ...) {" in the global script
-add "const" to the string parameters.

Gee, that was easy, wasn't it...
Title: Re: Error updating AGS, const string
Post by: Grapefruitologist on Thu 28/12/2006 08:05:36
Enforce new style strings is already unchecked; just added const to the script and all that, but I still get this error message. "There was an error compiling your script. The problem was: In: 'Global script'

Error (line 544): Type mismatch: cannot convert "String*" to "string"

Do you want to fix the script now? (Your game has not been saved)."
Title: Re: Error updating AGS, const string
Post by: SSH on Thu 28/12/2006 13:59:42
That template has already been translated to AGS 2.72. How hard would it be to recreate the game from the beginning? It might be easier to do that than try and fix the script piecemeal. Or, you could create a dummy game with the new template then cut-and-paste the global script across...
Title: Re: Error updating AGS, const string
Post by: Grapefruitologist on Fri 29/12/2006 06:55:10
When I try to make a new game, I get this same error message:
QuoteThere was an error compiling your script. The problem was: In: 'Global script'

Error (line 631): Type mismatch: cannot convert "const string" to "string"

Do you want to fix the script now? (Your game has not been saved).
Title: Re: Error updating AGS, const string
Post by: SSH on Fri 29/12/2006 09:28:13
Have you downloaded the updated 2.71/2.72 version of the template from http://ssh.me.uk/MI2forags271.zip ?
Title: Re: Error updating AGS, const string
Post by: Grapefruitologist on Sat 30/12/2006 07:08:04
I hadn't, just tried now (I replaced the old template with the new, I renamed it I hope that's okay)
And I still get the same error message.
EDIT: However, when I make a new game, it works fine. I tried copying and pasting the global script from the new game that works but now I get this error when trying to save my old game:
QuoteThere was an error compiling your script. The problem was: In: 'Global script'

Error (line 236): Parameter type does not match prototype

Do you want to fix the script now? (Your game has not been saved).
Title: Re: Error updating AGS, const string
Post by: strazer on Sat 30/12/2006 16:51:36
You also have to copy the script header over.
Title: Re: Error updating AGS, const string
Post by: Grapefruitologist on Sun 31/12/2006 01:31:31
Ok, thanks. Well, now I get this error:
QuoteThere was an error compiling your script. The problem was: In: 'Global script'

Error (line 724): undefined symbol 'MainInventory'

Do you want to fix the script now? (Your game has not been saved).
I appreciate all the help and everything, but maybe I should just start over, or is there really a cure for this?
Sorry for wasting your time and all with this.
Title: Re: Error updating AGS, const string
Post by: Grapefruitologist on Wed 03/01/2007 07:09:21
Okay, so... I'm thinking that I'll just use AGS v2.70 instead of 2.72 to finish my game, rebuilding it is proving to be far more difficult than I thought. I won't be able to use the Queued Background Speech module though, so I'm wondering if there's another way to make two characters talk while the player does other stuff?
P.S. This is my first real game, so sorry if I ask something that's too obvious.
EDIT: And also I'm sorry about posting twice in a row, the thread was old and I had to bump it.
Title: Re: Error updating AGS, const string
Post by: Lazarus on Fri 05/01/2007 08:16:51
With regards to the "MainInventory" error you will need to give the inventory box on the maingui (gui 1, control 11)a script name called MainInventory.

Also I'm using the module QueuedSpeech version 2.1 by monkey_05_06. Which works with ags 2.70 + for background speech
Title: Re: Error updating AGS, const string
Post by: Grapefruitologist on Sun 07/01/2007 00:46:08
Ok. I downloaded it. But... how do you use modules? Sorry, this is my first game, I know pretty much nothing about modules. I imported it into the module manager... now what?
Also... how do you turn objects on, then wait a while, and turn more objects on, etc. and not make the player have to wait for it to finish?
Title: Re: Error updating AGS, const string
Post by: Lazarus on Mon 08/01/2007 08:46:29
This is what I use, under the room settings open up the room interactions editor and under "repeatedly execute"
create a new action and select "run script".

In this you can then add the following:

if ((cTom.Room == 10) && (cJohn.Room == 10)) {
// This is to check that both characters are in the same room (10).
// If either characters are not in the room the speech is stopped.

Ã,  if ((QueuedSpeech.GetID(cTom, "Hi John nice to see you") == 0) && (!QueuedSpeech.IsTalking())) {
// This needs to have the first line of speech copied here.

Ã,  Wait(1);
Ã,  QueuedSpeech.ClearQueue();
Ã,  }

Ã,  QueuedSpeech.Say(cTom, "Hi John nice to see you");
Ã,  QueuedSpeech.AddDelay(80);Ã, // adds a pause in this case of 80
Ã,  QueuedSpeech.Say(cJohn, "Hi Tom I'm fine thanks");
Ã,  QueuedSpeech.Say(cTom, "Did you hear about Roger?");
Ã,  QueuedSpeech.AddDelay(80);Ã, 
Ã,  QueuedSpeech.Say(cJohn, "Roger ...");
Ã,  QueuedSpeech.Say(cJohn, "is he the badly drawn character from Roger Wilco?");

}
else QueuedSpeech.ClearQueue();


Hope this example helps you.
Title: Re: Error updating AGS, const string
Post by: Grapefruitologist on Tue 09/01/2007 06:47:54
Thanks. But I just noticed that I have version 2.2 of the module, and that apparently doesn't work with AGS 2.70, and the link to download 2.1 doesn't work.
Title: Re: Error updating AGS, const string
Post by: Lazarus on Tue 09/01/2007 08:23:07
Here try this
QueuedSpeech21.zip (http://www.fileden.com/files/2006/9/4/202394/AGS%20Modules/QueuedSpeech21.zip)
Title: Re: Error updating AGS, const string
Post by: Grapefruitologist on Wed 10/01/2007 05:03:31
Thanks!! It works. =D
EDIT: Just one more question. This keeps repeating the conversation over and over, is it possible to make it stop after the conversation is over?
Title: Re: Error updating AGS, const string
Post by: Lazarus on Wed 10/01/2007 10:04:26
If it's just the once then add the script to first time player enters screen or where ever the trigger could be to start the speech:

if ((cTom.Room == 10) && (cJohn.Room == 10)) {
// This is to check that both characters are in the same room (10).
// If either characters are not in the room the speech is stopped.

Ã,  QueuedSpeech.Say(cTom, "Hi John nice to see you");
Ã,  QueuedSpeech.AddDelay(80);
Ã,  QueuedSpeech.Say(cJohn, "Hi Tom I'm fine thanks");
Ã,  QueuedSpeech.Say(cTom, "Did you hear about Roger?");
Ã,  QueuedSpeech.AddDelay(80);Ã, 
Ã,  QueuedSpeech.Say(cJohn, "Roger ...");
Ã,  QueuedSpeech.Say(cJohn, "is he the badly drawn character from Roger Wilco?");

}
else QueuedSpeech.ClearQueue();


Title: Re: Error updating AGS, const string
Post by: Grapefruitologist on Wed 10/01/2007 20:13:20
Thanks!! But... Sorry, just ONE more question, heh. I want the characters to stay where they are until the conversation ends, and then start following the player. How do I do that?