PDA

View Full Version : I getting "Parse error" but I don't know why I'm getting it, can anyone explain?



Captain Jonesy
04-10-10, 05:17 PM
Hi

This is the code I've written so far for my level
func OpenRoom_2_0()
{
idx = ObjFind(1000);
if(ObjGet(idx,O_STATUS)==0)
ScrRequest(gs_fid("PlayCutscene"));
}
func PlayCutscene()
{
// position player and avoid eventual jump entries
PlayerSetPos(580,114);
PlayerEnterIdle();

Message0(3,4,"Dizzy has taken\nDaisy on a date");
Message0(4,5,"to a beautiful place\nwith views of a castle");
Message0(5,6,"to ask her\na special question"); MessagePop();
Message2(5,6,"This is wonderful!\nyou are so romantic");
MessagePop();
Message1(4,5,"I want to ask\nyou something\nDaisy. Would you...");
MessagePop();
Message2 (5,6,"Ouch"); MessagePop();

idx = ObjFind(1000);
rand = gs_rand(1);
if(rand==0)
ObjSet(idx,O_COLOR,COLOR_GREEN);
ObjSet(idx,O_TILE,464);

Message1 (4,5,"Are you ok?\nYou suddenly look\nquite ill"); MessagePop();
Message2 (5,6,"I think I must have\neaten something bad"); MessagePop();
Message1 (4,5,"Oh no, I'll go and find\nyou some meds"); MessagePop();
ObjSet(idx,O_STATUS,1);
}
///////////// Daisy
func ActionObject_1000()
{
if(ObjGet(ObjFind(100),O_STATUS)==0)//first time talk
{
Message1(4,5,"I be back soon \n with some meds I promise");
Message2(5,6,"Please be quick \n Ouch!"); MessagePop();
}
///////////// Bob
func ActionObject_1001()
{
coins = PlayerGet(P_COINS);
if(coins==0)
{
Message2(4,2, "Alright mate!\nGive me 10 coins\n and we can talk business"); MessagePop();
}
else
if(coins==MAXCOINS)
{
Message2(10,7,"THANKS, Mate!\nLet's do business!");
Message2(10,7,"You have problems\n with the missus\n you say?");
Message2(10,7,"Try this potion\nThis should do the trick!");
MessagePop();
PlayerSet(P_COINS,0); // remove them
ObjSet(ObjFind(100),O_DISABLE,0); // enable item
}
}

on line 186 - func ActionObject_1001() - I'm getting error saying

PARSER, 0,0 "Parse error"

- next window says

EXCEPTION
gserrorexit < GSErrHandler < ga_parse <gs_compile buffer

I don't understand why I'm getting such error as this code/command worked fine before and I've copyed and pasted all my code into a new script because the script files get become corrupted sometimes. Can someone explain please? Thanks in advance.

Jonesy

Colin
04-10-10, 05:52 PM
think your problem lies before ActionObject_1001()

in


///////////// Daisy
func ActionObject_1000()
{
if(ObjGet(ObjFind(100),O_STATUS)==0)//first time talk
{
Message1(4,5,"I be back soon \n with some meds I promise");
Message2(5,6,"Please be quick \n Ouch!"); MessagePop();
}


you have 2 open brackets but only closed 1. you need another one at the end

Captain Jonesy
04-10-10, 09:08 PM
That's it, thanks Colin. I can't believe I overlooked that. Another thing I want to ask you guys; I also having an issue where I want give character a item, but for some reason I can only talk to the character not able to give a item to the character. Here's code I'm written, where am I going wrong here?


///////////// Daisy
func UseObject_1000( idx )
{
if(idx==ObjFind(100))
Message2(3,8,"Thank you\nI feel so much better");
InventorySub(idx); // remove item from the inventory
ObjSet(idx,O_TILE,314);
}
func ActionObject_1000()
{
if(ObjGet(ObjFind(100),O_STATUS)==0)//first time talk
{
Message1(4,5,"I be back soon \n with some meds I promise");
Message2(5,6,"Please be quick \n Ouch!"); MessagePop();
ObjSet(ObjFind(1000),O_STATUS,1); // advance the talk status
}
else // next time
{
// open the inventory dialog and let the player select an item
idx = OpenDialogInventory();
if(idx!=-1)
{
// if an item was selected, call the defaut use function
// it will also call the UseObject callback of the item
UseObject(idx);
}

Thanks in advance for your help:dizzy_biggrin:

Jonesy

delta
04-10-10, 09:24 PM
That's it, thanks Colin. I can't believe I overlooked that. Another thing I want to ask you guys; I also having an issue where I want give character a item, but for some reason I can only talk to the character not able to give a item to the character. Here's code I'm written, where am I going wrong here?


I *think* that where you have if(idx==ObjFind(100)) , you need if(ObjGet(idx,O_ID)==100) instead...

NO! it isn't. It's much much simpler than that. You're checking the STATUS property of object 100, but you then change the STATUS property of object 1000 to 1. So of course if it's still checking object 100, the STATUS property will still be 0!

Captain Jonesy
05-10-10, 12:26 PM
Thanks Delta, good spotting. Sorry for being pain, I promise I won't keep bothering you guys, but I'm stuck again. The issue I'm having is when I give "daisy" an item, I want to be able to select and change her character tile back to default (currently green) via this code here:
func UseObject_1000( idx ) if(idx==ObjFind(100))
InventorySub(idx); // remove item from the inventory
idx = ObjFind(1000);
ObjSet(idx,O_TILE,310);
ObjSet(idx,O_COLOR,COLOR_DEFAULT);

I'm using the item via "if(idx==ObjFind(100))"
then selecting her character tile "idx = ObjFind(1000);"
I don't understand why it isn't changing, anyone explain this?

Here is the rest of code if needed;


func OpenRoom_2_0()
{
idx = ObjFind(1000);
if(ObjGet(idx,O_STATUS)==0)
ScrRequest(gs_fid("PlayCutscene"));
}
func PlayCutscene()
{
// position player and avoid eventual jump entries
PlayerSetPos(580,114);
PlayerEnterIdle();

Message0(3,4,"Dizzy has taken\nDaisy on a date");
Message0(4,5,"to a beautiful place\nwith view of a castle");
Message0(5,6,"to ask her\na special question"); MessagePop();
Message2(5,6,"This is wonderful!\nyou are so romantic");
MessagePop();
Message1(4,5,"I want to ask\nyou something\nDaisy. Would you...");
MessagePop();
Message2 (5,6,"Ouch"); MessagePop();

idx = ObjFind(1000);
rand = gs_rand(1);
if(rand==0)
ObjSet(idx,O_COLOR,COLOR_GREEN);
ObjSet(idx,O_TILE,314);
Message1 (4,5,"Are you ok?\nYou suddenly look\nquite ill"); MessagePop();
Message2 (5,6,"I think I must have\neaten something bad"); MessagePop();
Message1 (4,5,"Oh no, I'll go and find\nyou some meds"); MessagePop();
ObjSet(idx,O_STATUS,1);
}
///////////// Daisy
func UseObject_1000( idx )
{
if(idx==ObjFind(100))
InventorySub(idx); // remove item from the inventory
idx = ObjFind(1000);
ObjSet(idx,O_TILE,310);
ObjSet(idx,O_COLOR,COLOR_DEFAULT);
Message2(3,8,"Thank you\nI feel so much better"); MessagePop();
Message2(3,8,"What were you about to say? \n before I"); MessagePop();
Message2(3,8,"Noooooo!"); MessagePop();
Message2(3,8,"its happening again!"); MessagePop();
ObjSet(idx,O_TILE,183); // Goat
rand = gs_rand(1);
if(rand==0)
ObjSet(idx,O_COLOR,COLOR_BLUE);
Message2(2,6,"Baa-ram-ewe. Baa-ram-ewe"); MessagePop();
Message1(4,5,"That didn't work\nI better look for another potion then"); MessagePop();
}

Thanks in advance again :)

Jonesy

delta
05-10-10, 05:03 PM
the problem is likely to be that the code you're using doesn't have any { or } in it:


func UseObject_1000( idx ) if(idx==ObjFind(100))
InventorySub(idx); // remove item from the inventory
idx = ObjFind(1000);
ObjSet(idx,O_TILE,310);
ObjSet(idx,O_COLOR,COLOR_DEFAULT);

try this instead:



func UseObject_1000( idx )
{
if(idx==ObjFind(100))
{
InventorySub(idx); // remove item from the inventory
idx = ObjFind(1000);
ObjSet(idx,O_TILE,310);
ObjSet(idx,O_COLOR,COLOR_DEFAULT);
}
}

as I said in the other thread, I see absolutely no reason why the above code won't work. On the other hand, have you defined COLOR_DEFAULT? there is no colour defined as COLOR_DEFAULT in the standard game files, so if you haven't then chances are the game will ignore that code, as it can't find that colour. Try changing the colour to COLOR_WHITE instead.