[SOLVED] Error: GetGameParameter: invalid frame specified

Started by eri0o, Sat 09/12/2017 23:23:00

Previous topic - Next topic

eri0o

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

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.

eri0o

Hey, it seems I solved the error. It appears that view and loop number isn't updated in sync with frame.

Code: ags

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);
  ...
}

SMF spam blocked by CleanTalk