"if (dExample.GetOptionState(1) = eOptionOff)" is asking for semicolons (SOLVED)

Started by SadoDeomeoon, Tue 28/06/2016 15:53:41

Previous topic - Next topic

SadoDeomeoon

In an attempt to start a new game, I've encountered a problem. I wanted a dialogue to start when the player first starts the game (which works, dBeginning, in this case) and then after the dialogue is over, make the objects visible (which show instructions.) I decided to use option-off in the dialogue script (since it's fairly easy and I'm still a noob) to turn the 1st option off, then only make the objects visible if it is off, to make sure the dialogue is over.

However, using the code below, all I get is an error saying "Error (line 36): expected semicolon after ')'" Line 36 is line 4 below. No matter how many semi colons (which I don't think I need) I stick into that line of code, I simply cannot get it to work.

What am I doing wrong?

Code: ags

function room_FirstLoad()
{
dBeginning.Start(); // Run the dialogue
if (dBeginning.GetOptionState(1)=eOptionOff) // The line with the error
{
    oRightMouse.Visible=true;// Make all these objects visible
    oWalkCursor.Visible=true;
    oLookCursor.Visible=true;
    oInteractCursor.Visible=true;
    oTalkCursor.Visible=true;
}
}


Edit - Like the idiot I am, I forgot to put a double = in line 4 :grin:

Khris

It still won't work though because the dialog is only started after the test in line 4.
The solution is to move the five commands into the dialog script, right before the final "stop" command (and indent them by at least one space).

SadoDeomeoon

I worked that out. I'm going to do as you suggest and put it in the dialog script. Is it dialog_request? (Thanks for the reply!)

Khris

dialog_request is obsolete, it's what you had to use in older versions of AGS.

You can simply put regular script commands right inside dialog scripts, as long as you indent them by at least one space.
(Basically just do exactly what I told you to do in my previous post.)

Grok

In a dialog script I believe you have to refer to an object this way
   
        object[1].Visible=true;


The number (ID) of the object you will find in the property list for that object.


SMF spam blocked by CleanTalk