Adventure Game Studio

AGS Support => Beginners' Technical Questions => Topic started by: fiaschetta on Tue 14/11/2006 01:58:45

Title: Error in characterview
Post by: fiaschetta on Tue 14/11/2006 01:58:45
The script, when i look an inventory item, is:


ChangeCharacterView (PG, 38);
character[PG].Animate(0, 40);
character[PG].ChangeView(1);
DisplaySpeech (PG, "It's a beautiful book");



But, when i test the game, when i exit, go out a windows that says:

"ChangeCharacterView was used while the view fixed - call ReleaseCharView first"

Where is my error?
Title: Re: Error in characterview
Post by: SSH on Tue 14/11/2006 09:31:35
You must have locked the character view in some other script run previously somewhere...
Title: Re: Error in characterview
Post by: fiaschetta on Tue 14/11/2006 15:46:06
Quote from: SSH on Tue 14/11/2006 09:31:35
You must have locked the character view in some other script run previously somewhere...

I don't find the error
Title: Re: Error in characterview
Post by: Scorpiorus on Wed 15/11/2006 15:39:07
You should not use ChangeCharacterView() command to switch to another view just for animation, use a combination of Character.LockView() and Character.UnlockView() commands instead:


ChangeCharacterView (PG, 38); character[PG].LockView(38);
character[PG].Animate(0, 40);
character[PG].ChangeView(1); character[PG].UnlockView();
DisplaySpeech (PG, "It's a beautiful book");

And each LockView call should be followed by UnlockView one.

If you forget to call UnlockView command for some LockView and use ChangeCharacterView the warning you got may be generated when you exist the game.

So browse you scripts and make sure each LockView has a corresponding UnlockView.

Note: In older versions of AGS LockView was known as SetCharacterView andÃ,  UnlockView was known as ReleaseCharacterView, so check those too in case you use old-style scripting function names.