Adventure Game Studio

AGS Support => Beginners' Technical Questions => Topic started by: antineff on Thu 19/01/2006 11:03:20

Title: unexpected object (Animation)
Post by: antineff on Thu 19/01/2006 11:03:20
Hi,

I know I must have done something wrong, but I don't know what...

I try to have an animated object in my room. Therefore I defined an object (it has No. 3) and I defined a View (No. 2, loop No. 0) with the same sprite beginning and followed bei somer other frames making the animation.

Now I put the following lines at the beginning of the room script:

object[3].SetView(2);
object[3].Animate(0, 1, eRepeat, eNoBlock);

Trying to compiole the game results in the following error message:

Parse error: unexpected 'object'

It is no difference having the two line somewhere else in the  room script. I even tried to have them under 'usermode1 object' in the objects interaction pane. No chance!

Does anybody know what I did wrong?

Thanks for your help!


Title: Re: unexpected object (Animation)
Post by: Ashen on Thu 19/01/2006 11:26:20
When you say "under 'usermode1 object' in the objects interaction pane" do you mean you set a Run script interaction with that script? That should've worked.
unexpected 'whatever' errors usually mean a command had been called from a place it shouldn't have been - in this case propably outside a function (for example, you also said you put it "at the beginning of the room script" - does this just mean at the top, out of all interactions? And did you delete that bit when you put it under Usermode1?)

If you're sure it's not that - how big is the room script? Could you post it for us to check? (Or at least the lines around the error.)
Title: Re: unexpected object (Animation)
Post by: Gilbert on Thu 19/01/2006 11:27:53
(Ashen beated me to that, but I'll post anyway)

I guess you just open up the room script and put them there ?
Stuff doesn't work like that, you need to put them into event functions.

Judging from your need, you probably need the code to execute when that room is loaded, so you may:
1. invoke the interaction editor in the room screen (the big "i" button).
2. Select one of those "Player enters room..." events (one good choice is "Player enters room (before fadein)", double click on it to select the "run script" action.
3. Click "Edit script..." button and put your lines of code there.
Title: Re: unexpected object (Animation)
Post by: antineff on Thu 19/01/2006 14:59:53
Thanks and be kissed!!

Sometimes soft hits on the back of the head will help!

I didn't realize that defining the condition of an object is treated as an interaction.

Now it works! Many, many thanks!