Adventure Game Studio

AGS Support => Beginners' Technical Questions => Topic started by: sloppy on Wed 11/01/2006 04:14:13

Title: Idle ignored... (Solved)
Post by: sloppy on Wed 11/01/2006 04:14:13
I've got an idle view that continues until I move the character.  It works, but sometimes I'll get an error that says " SetCharacterIdle view called while character view locked with SetCharacterView; idle ignored."

I think I know what causes that, but I can't figure out how to stop it.

Is there a way to stop that from happening?
Title: Re: Idle ignored...
Post by: Ashen on Wed 11/01/2006 11:01:40
Well, have you used SetCharacterView in your script anywhere? If so, be sure to call ReleaseCharacterView once you're done with it (Use ChangeCharacterView to perminantly alter the view.) (Character.LockView, Character.ReleaseView, and Character.ChangeView - repectively - in 2.7+)
Title: Re: Idle ignored...
Post by: sloppy on Wed 11/01/2006 13:32:52
I've used the Character.UnlockView whenever it's necessary.  But for the idle view I have it in Repeatedly_execute_always:


#sectionstart repeatedly_execute_always
function repeatedly_execute_always() {
  if (cGuy.View == cGuy.IdleView && idlewait == 1) {
     cGuy.SetIdleView(23, 0);
  idlewait = 0;
}
else if (cGuy.View != cGuy.IdleView && idlewait == 0) {
  cGuy.SetIdleView(23, 40);
  idlewait = 1;
}
}


If I make the character walk after the idle view there's no problem.  But if he talks right after the idle view, that's when there's the problem.
  Do I have to put the CharacterUnlockView somewhere in there?
(BTW, how do you highlight code?)
Title: Re: Idle ignored...
Post by: ManicMatt on Wed 11/01/2006 14:11:55
Wait, you mean to say it's your main character that's in idle mode all the time?

I'm an amateur here, but I think you shouldn't put it in repeatedly execute. have you tried it in the "before fade in"?
Title: Re: Idle ignored...
Post by: sloppy on Wed 11/01/2006 16:12:52
I put it there so that the idle animation would run continually until called to do something else. This was the advice from Ashen a few months ago:

QuoteYou could either move the code to repeatedly_execute_always which will run during blocking commands (you'll have to create it yourself, if you haven't already), or perhaps copy the cGuy.SetIdleView(2, 10); idlewait = 1; part into on_mouse_click - which'll reset it everytime you click a mouse button, where ever it is on screen (you could limit it to just the left button though, obviously). Personally, I'd recommend rep_ex_always.

It works okay except for the problem I mentioned.
Title: Re: Idle ignored...
Post by: ManicMatt on Wed 11/01/2006 16:25:35
Hmmm yes I see, I just tried the idle command in a room with the repeatedly execute function, and it works, in fact even talking to an NPC works too. So something's not right.
Title: Re: Idle ignored...
Post by: sloppy on Sat 14/01/2006 13:49:01
My question was going to the second page still not solved so I thought I'd bump it back to the first page.

I'm really hoping to get an answer to this, especially from Ashen as he was so helpful in getting this to work in the first place.  Or anyone else that may know for that matter....
Title: Re: Idle ignored...
Post by: Ashen on Sat 14/01/2006 14:24:39
OK, sorry I wasn't much help before - I was in a hurry to catch a train, and only covered the basics. (Besides which, you left out all the important details in your first post.)

Now, it looks like the change to Speech view is blocking the SetIdle. Odd that. So, try adding a check to the conditon, to make it wait untill after the speech is done:

function repeatedly_execute_always() {
  if (cGuy.View == cGuy.IdleView && idlewait == 1) {
     cGuy.SetIdleView(23, 0);
  idlewait = 0;
}
else if (cGuy.View != cGuy.IdleView && cGuy.Speaking == false && idlewait == 0) {
  cGuy.SetIdleView(23, 40);
  idlewait = 1;
}
}


That seems to work, as far as I can see - you'll have to try it, and see if it works in-game.

Off topic:
Quote(BTW, how do you highlight code?)

Follow the 'Help' link at the top of every page for a full list of usable tags (http://www.adventuregamestudio.co.uk/yabb/Themes/default/help/posting.english.html#bbcref). (Also linked just above where you type your message.)
To highlight your code as above, use the [c0de] tags (with an 'o' rather than a '0').
Title: Re: Idle ignored...
Post by: sloppy on Sun 15/01/2006 03:24:29
I wish I could say this worked but the same thing happens.  Any other idea I could try?
Title: Re: Idle ignored...
Post by: Ashen on Sun 15/01/2006 11:24:03
Did you spot my typo? cEgo.Speaking should be cGuy.Speaking.
Other than that, I don't know what to suggest - when the character's typed properly, that stops the error for me.
Title: Re: Idle ignored...
Post by: sloppy on Sun 15/01/2006 13:47:12
Yes, there was an error in my script and I fixed it.  Now it works just fine.
Thanks again for your help!