Adventure Game Studio

AGS Support => Beginners' Technical Questions => Topic started by: Wonkyth on Sat 29/03/2008 03:36:50

Title: Error when just starting!
Post by: Wonkyth on Sat 29/03/2008 03:36:50
I've only just started, but I seem to have run into a problem:

I'm currently in "Getting Started with AGS - Part 4"
I did all the stuff it told me to do, but when it told me to run it at the end of the "Back to the Events" section it gave me this message: "Error (line 10): PE04: parse error at 'oKey'"

help would be nice, as I'm most certainly NOT a scripting whiz.

If you need more info, just ask

Thankyou.
Title: Re: Error when just starting!
Post by: Vince Twelve on Sat 29/03/2008 06:45:59
Could you post line 10 of your code and a couple lines around it?

Likely you've forgotten a semicolon at the end of the line or something.
Title: Re: Error when just starting!
Post by: Wonkyth on Sat 29/03/2008 07:19:53
// room script file

function hsquarerock_Look()
{
Display("It's just a Big,  Square Rock...");
}

function oKey_Interact()
{
oKey.Visible - false;
player.AddInventory(iKey);
GiveScore (5);
}
Title: Re: Error when just starting!
Post by: Akatosh on Sat 29/03/2008 10:24:10
Well, it's


oKey.Visible - false;


in your code, but it should be


oKey.Visible = false;


if you want it to work. Also, welcome to the forums!  ;)

Title: Re: Error when just starting!
Post by: miguel on Sat 29/03/2008 11:10:30
Hi there,
custom functions had to go on the Global Script and then imported (AGS 2.72, the one I use),
if it's not the way it works with V3.0 then forget my post.
Other than that what Akatosh said.
good luck
Title: Re: Error when just starting!
Post by: Wonkyth on Sun 20/04/2008 09:41:52
Quote from: Akatosh on Sat 29/03/2008 10:24:10
it should be


oKey.Visible = false;


if you want it to work.




It worked and thankyou for the help, but I think that while I was trying to fix it before, I stuffed it up.

now its giving me this message:

"Error (line 10): undefined token 'oKey'."

the scripting is still the same as before (exept for the hyphen), and any help would be appreciated.



You know, what this thing really needs is something to tell you what on earth the error messages are supposed to mean.
errors like "';' expected" are easy enough, but words like 'parse' might be going over the heads of alot of people.
Title: Re: Error when just starting!
Post by: .M.M. on Sun 20/04/2008 12:50:43
Quote from: wonkyth on Sun 20/04/2008 09:41:52
"Error (line 10): undefined token 'oKey'."
Does your object have script name "oKey" or just "Key"?
Title: Re: Error when just starting!
Post by: Khris on Sun 20/04/2008 16:25:50
miguel: custom functions work fine in room scripts (although there's no custom one in the posted code).
Title: Re: Error when just starting!
Post by: Wonkyth on Sun 20/04/2008 22:36:11
Yeah, I thought of that, but I can't remember how to bring up the place where you do that.
Title: Re: Error when just starting!
Post by: OneDollar on Mon 21/04/2008 08:27:06
Quote from: wonkyth on Sun 20/04/2008 22:36:11
Yeah, I thought of that, but I can't remember how to bring up the place where you do that.
1. Open up your room and at the top where it says "Show this room's:" choose objects from the drop down list. Your key should appear in the room along with any other objects you have in that room.
2. Either click the key or choose the key object from the drop down list between the project tree and properties box on the right to select it.
3. In the properties box, under design, find the "Name" property. Set this to "oKey" (no speech marks).

Generally its useful to stick to a naming system when you make new things in your game, so for example sticking a small "o" in front of the names of all the objects, "h" for hotspots, "i" for inventory items, "c" for characters, "g" for GUIs etc etc. You don't have to do this (instead of the above steps you could just change all references in your script to "key") but its a good habit to get into and the manual follows this pattern.
Title: Re: Error when just starting!
Post by: Wonkyth on Wed 23/04/2008 23:17:18
Thanks for the help.

as it happens I started again, and by doing that I understood what it was that I'd done wrong, and so I now know how to fix it.

I'd say I'm ready to start my first small game, but my head is empty...


;D ;D ;D