Adventure Game Studio

AGS Support => Beginners' Technical Questions => Topic started by: Atrocious Toaster on Tue 30/06/2009 23:13:21

Title: Help... error with line 525 about Undefinedtoken "Rundialog"
Post by: Atrocious Toaster on Tue 30/06/2009 23:13:21
Here's what I put in the last 5 lines of the script for Phil Nihilist about talking to him and activating the dialogue:


function cPhil_Talk()
{
RunDialog(dDialog0);
}

This is what it said about "Compilation Errors"

Error (line 525): Undefined Token 'RunDialog':P. I am in serious need of help urgently.
Title: Re: Help... error with line 525 about Undefinedtoken "Rundialog"
Post by: Matti on Tue 30/06/2009 23:39:24
The RunDialog function is obsolete. It's called Dialog.Start() - in your case dPhil.Start or whatever the dialog is called.
Title: Re: Help... error with line 525 about Undefinedtoken "Rundialog"
Post by: TerranRich on Tue 30/06/2009 23:42:52
dDialog0.Start() from what it looks like.
Title: Re: Help... error with line 525 about Undefinedtoken "Rundialog"
Post by: Matti on Wed 01/07/2009 00:12:12
D'oh. Of course...
Title: Re: Help... error with line 525 about Undefinedtoken "Rundialog"
Post by: Atrocious Toaster on Wed 01/07/2009 03:36:37
Now it says: "Error (Line 524): Nested functions not supported (You may have forgotten closing a brace)."

This is Line 524: function cPhil_Talk()

Now I know that bracket at the end of cPhil_Talk is closed. What, did I forget a space between k and ( ?
Title: Re: Help... error with line 525 about Undefinedtoken "Rundialog"
Post by: Ishmael on Wed 01/07/2009 03:45:15
There's a brace or several missing from the function before that one.
Title: Re: Help... error with line 525 about Undefinedtoken "Rundialog"
Post by: Atrocious Toaster on Wed 01/07/2009 03:50:07
Here's the btnDeleteSave_OnClick Function, the cPhil_Talk Function, and the cPhil_Look Function, in order on the global script.

function btnDeleteSave_OnClick(GUIControl *control, MouseButton button)
{
  if (lstSaveGamesList.SelectedIndex >= 0)
  {
    DeleteSaveSlot(lstSaveGamesList.SaveGameSlots[lstSaveGamesList.SelectedIndex]);
    lstSaveGamesList.FillSaveGameList();
  }



function cPhil_Talk()
{
dDialog0.Start();
}

function cPhil_Look()
{
dDialog1.Start();
}
Title: Re: Help... error with line 525 about Undefinedtoken "Rundialog"
Post by: Ryan Timothy B on Wed 01/07/2009 03:57:50
function btnDeleteSave_OnClick(GUIControl *control, MouseButton button)
{
 if (lstSaveGamesList.SelectedIndex >= 0)
 {
   DeleteSaveSlot(lstSaveGamesList.SaveGameSlots[lstSaveGamesList.SelectedIndex]);
   lstSaveGamesList.FillSaveGameList();
 }
} //<-----this bracket


function cPhil_Talk()
{
dDialog0.Start();
}

function cPhil_Look()
{
dDialog1.Start();
}


Brace was missing. The one before the cPhil_Talk() function.

edit: oh and I beat monkey :p
Title: Re: Help... error with line 525 about Undefinedtoken "Rundialog"
Post by: monkey0506 on Wed 01/07/2009 03:58:17
You've forgotten the closing brace } for the function btnDeleteSave_OnClick...

It should be:

function btnDeleteSave_OnClick(GUIControl *control, MouseButton button)
{
 if (lstSaveGamesList.SelectedIndex >= 0)
 {
   DeleteSaveSlot(lstSaveGamesList.SaveGameSlots[lstSaveGamesList.SelectedIndex]);
   lstSaveGamesList.FillSaveGameList();
 }
}


function cPhil_Talk()
{
dDialog0.Start();
}

function cPhil_Look()
{
dDialog1.Start();
}


EDIT: Ryan got there first! But yes!
Title: Re: Help... error with line 525 about Undefinedtoken "Rundialog"
Post by: Atrocious Toaster on Wed 01/07/2009 04:20:23
I am cursed by a non-bug continuous super-repeated message of death. Now it's this!
Error (Line 521): PE04: parse error ar ')'

And to confirm suspicions, this is line 521:

)

The one you told me to bracket. So, I'm at a loss here, folks! PLEEZ try to help. Oops! Pardon the first word on that last sentence. Please, okay? Thank you.
Title: Re: Help... error with line 525 about Undefinedtoken "Rundialog"
Post by: TerranRich on Wed 01/07/2009 04:32:40
That means that you're missing a closing parenthesis.

DeleteSaveSlot(lstSaveGamesList.SaveGameSlots(lstSaveGamesList.SelectedIndex));

You had ]) instead of )).

Remember, if it says there's an error with a '(' or a ')', then check all parentheses! :)
Title: Re: Help... error with line 525 about Undefinedtoken "Rundialog"
Post by: Atrocious Toaster on Wed 01/07/2009 05:29:27
So, I'm missing a second parentheses? I don't know exactly :P
Title: Re: Help... error with line 525 about Undefinedtoken "Rundialog"
Post by: Scummbuddy on Wed 01/07/2009 05:56:55
Terran is saying to change:

SaveGameSlots[1stSaveGameList.SelectedIndex]

to

SaveGameSlots(1stSaveGameList.SelectedIndex)
Title: Re: Help... error with line 525 about Undefinedtoken "Rundialog"
Post by: Khris on Wed 01/07/2009 09:03:12
No, SaveGameSlots is an array property, so square brackets are correct there.

AtrociousToaster, you were meant to place a "curly" bracket } at line 521, not a standard one ).
Title: Re: Help... error with line 525 about Undefinedtoken "Rundialog"
Post by: TerranRich on Wed 01/07/2009 17:32:32
Square brackets [ ] are for index arrays. â€" MyArray[SomeIndexNumber]
Curly braces { } are for blocks of code, especially contained within if, while, and function blocks. â€" if (SomeVar == 7) { DoCode(); }
Parentheses ( ) are for parameters sent to a function, as well as grouping expressions within if and while blocks. â€" while (SomeVar < 10) { SomeVar++; }

Always make sure each ( [ { has an ending } ] ) and that they match up perfectly. It's always a good idea to work from the outside in, matching up blocks of brackets/braces/parentheses.

And sorry about the mix-up with the SaveGameSlots array.
Title: Re: Help... error with line 525 about Undefinedtoken "Rundialog"
Post by: monkey0506 on Wed 01/07/2009 18:46:55
And just in case you get lost or confused trying to match up your braces {}, brackets [], and parentheses (), you can always highlight the brace/bracket/parenthesis in question (works for both opening and closing) then press Ctrl+B which will highlight the matching brace/bracket/parenthesis.

If you see that Ctrl+B is obviously selecting the wrong brace/bracket/parenthesis, that means that you're missing one somewhere. ;)
Title: Re: Help... error with line 525 about Undefinedtoken "Rundialog"
Post by: Atrocious Toaster on Wed 01/07/2009 20:55:10
Of course *slap myself in the face* I used a Parentheses where it was not supposed to be used! I overlooked what I didn't need because I was looking for what I didn't have! Ow, my brain hurts. I'll check back to say what happens!
Title: Re: Help... error with line 525 about Undefinedtoken "Rundialog"
Post by: Atrocious Toaster on Wed 01/07/2009 23:22:39
HOORAY! It works, but now A: I can't leave the chat with Phil when I click on Bye (I am SO NEW to this program :P!) And B: Every time I use Dialog1 for the LookatPhil Sequence it goes... (http://img217.imageshack.us/img217/4594/error2v.th.jpg) (http://img217.imageshack.us/i/error2v.jpg/)

I AM SO CONFUSED! CAN SOMEONE HELP ME? THANKS!
Title: Re: Help... error with line 525 about Undefinedtoken "Rundialog"
Post by: Matti on Thu 02/07/2009 00:36:30
It seems that you turned all the dialog options off (forever), so that the dialog can't be started. Don't know why this gives an error message though.

Can you post the code where you want to start the dialog and perhaps the dialog too?
Title: Re: Help... error with line 525 about Undefinedtoken "Rundialog"
Post by: Atrocious Toaster on Thu 02/07/2009 00:52:36
Well, I want one character to say one line without the menu, not that Display stuff. You know, the words over his head. I tried dialogue, but it still wouldn't go through!
Title: Re: Help... error with line 525 about Undefinedtoken "Rundialog"
Post by: on Thu 02/07/2009 01:11:50
To leave a dialog, replace "return" with "stop".

And if you really only want the character to say a single line, why not use a simple
player.say("FooBar, now with extra fruit!")
and unlock the actual dialogue later?