Adventure Game Studio

AGS Support => Beginners' Technical Questions => Topic started by: TheRoger on Fri 10/06/2011 15:11:37

Title: Dialog, Option-Off (SOLVED)
Post by: TheRoger on Fri 10/06/2011 15:11:37
If I understand correctly, scripts after @S should work before dialog, so what I'm doing wrong? I get "Undefined token 'option'" error.  "floor" is a global variable.


// Dialog script file
@S  // Dialog startup entry point
 if (floor==2) option-off 2;
return
@1
return
@2
return


Please don't scold me monkey *(covers head).
Title: Re: Dialog, Option-Off
Post by: Matti on Fri 10/06/2011 15:30:16
option-off is a dialog command. If you want to disable an option using 'normal' scripting use Dialog.SetOptionState(int option, DialogOptionState)
Title: Re: Dialog, Option-Off
Post by: TheRoger on Fri 10/06/2011 15:37:25
I tried these:


// Dialog script file
@S  // Dialog startup entry point
  if (floor==2) Dialog.SetOptionState(2,eOptionOff);
return
@1
return
@2
return



// Dialog script file
@S  // Dialog startup entry point
  if (floor==2) Dialog[0].SetOptionState(2,eOptionOff);
return
@1
return
@2
return


Neither of them work, first says: Dialog 0(3): Error (line 3): must have an instance of the struct to access a non-static member

Second: Dialog 0(3): Error (line 3): Unexpected 'Dialog'

Title: Re: Dialog, Option-Off
Post by: Gilbert on Fri 10/06/2011 15:56:04
Either use the dialog object name you have set in the editor (default names are something like dDialog0):
if (floor==2) dDialog0.SetOptionState(2,eOptionOff);
or, if you want to use the array to refer to it:
if (floor==2) dialog[0].SetOptionState(2,eOptionOff);
(Note that the d in dialog is in lower case.)
Title: Re: Dialog, Option-Off
Post by: TheRoger on Fri 10/06/2011 20:09:08
Thank you  Iceboty, it worked. I kinda hate, when scripts doesn't work because of small mistakes, like capital letters   ;D