Adventure Game Studio

AGS Support => Beginners' Technical Questions => Topic started by: mode7 on Mon 18/10/2010 17:55:03

Title: Custom Function with Dialog Variable (SOLVED)
Post by: mode7 on Mon 18/10/2010 17:55:03
I want to start a dialog by calling a custom function which does various stuff before showing the dialog.

function StartDialog (Dialog);
{
//random stuff...
Dialog.Start() // This is where I get an error
}

I know i'd probably have to write something  instead of  "Dialog" in the start command but I can't figure out what. I'm still very inexperienced handling structs.
Title: Re: Custom Function with Dialog Variable
Post by: Dualnames on Mon 18/10/2010 18:53:25

function StartDialog(this Dialog*) {
//random stuff
this.Start();
}


So when you want to use it you'll go like:

dDialog1.StartDialog();

More info:
http://www.adventuregamestudio.co.uk/manual/ExtenderFunctions.htm
Title: Re: Custom Function with Dialog Variable
Post by: Khris on Mon 18/10/2010 19:00:29
Also, before extender functions came along, the way to do this was:

function StartDialog (Dialog* d);   // function parameters are declared just like variables
{
  //random stuff...
  d.Start();
}
Title: Re: Custom Function with Dialog Variable
Post by: mode7 on Tue 19/10/2010 07:44:36
Thanks guys!!!