Adventure Game Studio

AGS Support => Beginners' Technical Questions => Topic started by: Ayato on Sat 31/05/2008 08:48:29

Title: Help: Variable 'oObject' already imported?
Post by: Ayato on Sat 31/05/2008 08:48:29
A friend and I have been reading through the AGS 3.0 tutorials, but weve run across an error when attempting to creat an animating room object.
The error is as follows:
Error (line 2): Variable 'oObject' is already imported

Weve set up the views and the loops, but we cant find the exact problem. Any suggestions?
Title: Re: Help: Variable 'oObject' already imported?
Post by: Khris on Sat 31/05/2008 10:53:11
Could you post the surrounding lines of the room script?
My guess is you didn't put the .Animate command inside the before_fadein event's function but directly into the room script.
Title: Re: Help: Variable 'oObject' already imported?
Post by: Ayato on Mon 02/06/2008 21:14:34
Quote from: KhrisMUC on Sat 31/05/2008 10:53:11
Could you post the surrounding lines of the room script?

We had to delete our code because we weren't able to save our progress. It was only two skimpy lines of code, the oObject.setview and oObject.animate functions. I remember the error referred to the line in which we put the .setview.

And yes, we put the commands inside the Room Script. We've found the before_fadein events in our first room, and we'll try writing the commands there. Thanks for the help!

I think our main problem is a lack of functional examples of these kinds of code instances. The tutorial does a good job of explaining WHAT the commands do, but doesn't give it context very well... at least not to us. We weren't able to find where these commands belonged even after consulting the tutorial and index for hours.
Title: Re: Help: Variable 'oObject' already imported?
Post by: Khris on Tue 03/06/2008 00:57:07
Well, every command has to go inside a function, otherwise how could AGS determine when to call what?
Basically, the room scripts and the global script are a collection of instructions to be executed after certain events occur, them being caused either by the player (e.g. look at xy) or the game logic (e.g. repeatedly_execute).
Title: Re: Help: Variable 'oObject' already imported?
Post by: Dualnames on Wed 04/06/2008 13:51:15
Well, I'd wild guess you have two objects called oObject. Try calling that object this way and if it works I'm right.

object[object id number between braces].Animate..ecc
ex:

object[0].Animate(0,5,eBlock,eOnce,eForwards);