scripting error (unexpected 'object')

Started by , Fri 14/07/2006 12:57:28

Previous topic - Next topic

Yendi

Hi, I have a basig problem with scripting.
I am in the room, and I have an animated object there.
I want to move this object, and I am using script:
1 Object(0).Move(int x, int y, int speed)

but when I test the game, it writes me Error :
parse error, unexpected 'object'

so I try:
1 cp.move...

(cp is an scripting object name)
but it writes me the same.

PLEASE HELP !!!

Alynn

I'm guessing the number in front is just the line number and you aren't typing that out... so

1st are you sure that line of code is in an interaction of some sort? IE on room load, or looking at the object or using the object? If it's not then it won't work because the engine places all code within interaction blocks, if it's not in an interaction block you will get that error.

Also, all objects script code has an o in front of it, so if you put cp as the script name for the object, then when writing out script name it would be ocp.

limeTree

object[2].Move(125, 40, 4, eBlock);

This is the exaple how mine is.
Does you says eBlock)
8)

Yendi

Thank you for helping me.
I am in a room setting, and i am clicking on: edit script.
Than, I see this:
1// room script file
2

I tried this ocp, but the error still remain.

Yendi

i know, i tried this, but error still remain.


Ashen

#6
Quote from: Alynn on Fri 14/07/2006 13:02:59
are you sure that line of code is in an interaction of some sort? IE on room load, or looking at the object or using the object? If it's not then it won't work because the engine places all code within interaction blocks, if it's not in an interaction block you will get that error.

If those lines are all you've got in your script, then it's NOT in a functon. Follow Khris's BFAQ link for more details.

EDIT (after Nathan's post):
If it's a pointer you've created yourself somewhere (i.e. with Object *cp;), then it doesn't need the o, just be sure to use the same capitalisation - they're case-sensitive. If it's a generated script name it starts with a lowercase 'o' (added by AGS - if you've put one in yourself, it'd be oOcp), the next letter is capitalised and the rest are lower case (oCp, oDoor, oGoldfish, etc). Another thing to check, make sure you've set the SCRIPT name of the object, and not just the normal name.
I know what you're thinking ... Don't think that.

Nathan23

I'm not sure, correct me if I'm wrong.. but instead of Cp.move should be
ocp.move, seems it's a object.. and there must have a script name, it must begin with a "o"...???

SMF spam blocked by CleanTalk