Adventure Game Studio

AGS Support => Advanced Technical Forum => Topic started by: eri0o on Sat 09/12/2017 23:23:00

Title: [SOLVED] Error: GetGameParameter: invalid frame specified
Post by: eri0o on Sat 09/12/2017 23:23:00
Hey, I have a code as below, my character cChara is correctly shown in screen. But SOMETIMES, I get an error on the line that has Game.GetViewFrame, stating Error: GetGameParameter: invalid frame specified.

Code (ags) Select

ViewFrame * tvf;

...
function late_repeatedly_execute_always(){
  ...
  tvf = Game.GetViewFrame(cChara.View, cChara.Loop, cChara.Frame);
  ...
}


The only thing I gathered is it happens when the character is walking to some direction and I click to force him walk down, and my walking down (and up) animation has one less frame then the walking right and left.
Title: Re: Error: GetGameParameter: invalid frame specified
Post by: eri0o on Sun 10/12/2017 14:17:05
Hey, it seems I solved the error. It appears that view and loop number isn't updated in sync with frame.

Code (ags) Select

ViewFrame * tvf;
int i_view;
int i_loop;

function repeatedly_execute_always(){
  i_view = cChara.View;
  i_loop = cChara.Loop;
}

...
function late_repeatedly_execute_always(){
  ...
  tvf = Game.GetViewFrame(i_view, i_loop, cChara.Frame);
  ...
}