Adventure Game Studio

AGS Support => Advanced Technical Forum => Topic started by: drewbian on Sat 18/06/2011 16:50:15

Title: Trouble with cEgo.SetIdleView() script
Post by: drewbian on Sat 18/06/2011 16:50:15
I have two questions, one being which script do I put this in, the global script or the room script? And the other being how do I get this particular piece of script to work correctly. I am sort of a scripting noob but this has me completely stumped, after following the topic on the AGS wiki (http://americangirlscouts.org/agswiki/Scripting,_Code_%26_Interaction#Having_a_character_continuously_animated_in_the_background)

I have placed:

cNorberty.SetIdleView(17,10)

into the global script (my characters name is cNorberty and has his idle animation set to 17, with the number 10 referring to the a delay of 10 seconds i want between animations) but I am not sure if this is the correct area to be typing the script into as the tutorial is somewhat vague, and I am unsure as to whether or not I need to type function or another item to get the script to read the particular line I have entered. Any help would be greatly appreciated, thanks!
Title: Re: Trouble with cEgo.SetIdleView() script
Post by: Khris on Sat 18/06/2011 17:38:16
One-time setup stuff like that usually goes into game_start (a function that is called only once at the start of the game, before the first room is loaded), you could put it in the first room's "first time player enters", "before fadein" or "after fadein", too, it doesn't really matter.

Just don't put it directly in the script, it has to go between a function's { and }:

function game_start() {

 cNorberty.SetIdleView(17,10);
}


And don't forget the semicolon at the end of the line.

Btw, you said "trouble" and posted here, so I gather you got an error message. Always post those verbatim when you're asking for help.
Title: Re: Trouble with cEgo.SetIdleView() script
Post by: drewbian on Sat 18/06/2011 17:42:54
Thank you so much this worked perfectly. Will keep a note of 'trouble' in the title next time. Cheers for your help!
Title: Re: Trouble with cEgo.SetIdleView() script
Post by: Khris on Sat 18/06/2011 19:35:17
I didn't mean you should put "trouble" in the title, I just wanted to know if you have received an error message.