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.
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.
// 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);
}
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! ;)
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
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.
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"?
- if it is "Key", change it on "oKey".
miguel: custom functions work fine in room scripts (although there's no custom one in the posted code).
Yeah, I thought of that, but I can't remember how to bring up the place where you do that.
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.
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