Adventure Game Studio

AGS Support => Beginners' Technical Questions => Topic started by: RocketBoy on Thu 21/07/2005 02:23:47

Title: global function with 2 variables [SOLVED]
Post by: RocketBoy on Thu 21/07/2005 02:23:47
Hi everyone,

This is my first post and hopefully I am not going to go against some rule or something! I HAVE searched the Technical forum and Beginners Technical Questions without any success!

Here's my problem:

I'm trying to make a simple global function that would do the following each time the player would click on a object: 1) Walk to Object, 2) Add Object in inventory and3)remove object from the room.

So far my script is:
Global Script (right at the top):

function globGetObject(int zzObjectNum, int zzInvID){
character[EGO].Walk(object[zzObjectNum].x,object[zzObjectNum].y);
character[EGO].AddInventory(inventory[zzInvID]);
object[zzObjectNum].Visible = false;
}


Script header:


import function globGetObject(int, int);



On the Object script in a room:


globGetObject(0,3);



I get this message when I try to save the game:
There was an error compiling your script. The problem was:
In: 'Global script'
Error (line 3):'y' is not a public member of 'Object'

(where line 3 is the 'character[EGO].walk' part)

I'm under the impression that I'm missing something obvious! :-\ Can someone point me in the right direction please? Or show me where the thread is if someone already answered that question somewhere else.

You already have the eternal thanks of a newbie!
Title: Re: global function with 2 variables
Post by: strazer on Thu 21/07/2005 02:34:07
The Object.X and .Y properties have to be uppercase. ;)
Title: Re: global function with 2 variables
Post by: RocketBoy on Thu 21/07/2005 12:39:48
Wow. That was simple, I almost feel stupid :-\

I was so certain it had to do with something else than a typo... ack I hate doing that kind of mistake!

Thanks Strazer!
Title: Re: global function with 2 variables
Post by: monkey0506 on Thu 21/07/2005 21:57:05
Question:  Why are some X & Y properties upper case, while some are lower case (i.e., mouse.x & mouse.y, versus Object.X & Object.Y)?  Of course if there is a mouse.X & mouse.Y property that may in some way be different...It seems like there might be but I don't have access to a manual ATM, so...
Title: Re: global function with 2 variables
Post by: strazer on Fri 22/07/2005 14:07:55
Quote from: Pumaman on Mon 07/02/2005 20:51:48Because all the new OO properties start with a capital letter. So your question might be, why aren't the character x and y capitalised. The reason for that is that changing it would require people to rework tons and tons of code, for no real advantage.
Title: Re: global function with 2 variables
Post by: monkey0506 on Fri 22/07/2005 15:20:22
Okay...thanks ;D

Which makes sense...