Custom GUI script giving error message ???

Started by Draft, Sun 26/02/2012 20:41:56

Previous topic - Next topic

Draft

 ???

I recently downloaded the CustomDialogGui module from Abstauber and I cannot find the solution for this problem.

I have searched everywhere I can think of, trying every keyword and resource I can find, including the posts in Abstauber's thread. I have tried attempting to correct it by defining it as a function, as a global GUI* variable and as a seperate function that calls the module script. I am completely stuck with this one.

What I am getting is an error message saying that 'CustomDialogGui' does not contain a function for init

Here is the secton of code being flagged


function CustomDialogGui::init() {
 
 // whether it's a text or an icon based GUI
 // valid values are: eTextMode and eIconMode
 this.gui_type      = eTextMode;
 // Top-Left corner of the Dialog GUI
 this.gui_xpos        = 20;
 this.gui_ypos        = 20;
 this.gui_stays_centered_x = false;
 this.gui_stays_centered_y = false;

I have also tried moving the bracket to its standard position and deleting the ::init but these do not work either.

Also, I have read the Wiki page on Text Window - Customized but it is not very clear on the path to use as far as can I create the pieces in Paint, what file type or where would I import them to ??? within AGS in order to use them as a GUI. It says to assign each image to a gui button and presto but the only GUI window I can open in the editor does not have any of these options.

Is there a proper set of instructions for doing this that I have missed as all I really want to do for the moment is create a custom design for the border and change the background color for the default text box. I have copies of the large Abstauber script and can work on figuring it out seperately for now. Either way any advice would be a huge help. ???
Draft
AdventureDraft.com

Ryan Timothy B

I don't know anything about Abstauber's module but I do know what your error message is telling you.

If you have a struct and want to have a function work for that struct you import it into the struct (or an extender method).

Code: ags

struct CustomDialogGui
{
  //some variables are defined here
  
  import init(); //this is where it imports that function you're describing
};


If you've removed the line "import init();" or renamed it, your error message would be: 'CustomDialogGui' does not contain a function for init


This function:
Code: ags

function CustomDialogGui::init() 
{
  //etc..
}


Means that this function belongs within the struct CustomDialogGui. Hence the CustomDialogGui::init

The function works like so
customDialogGui.init();


Basically just like all the Character.Say  Character.Walk  functions that come with AGS. These are all functions within the Character struct.

Draft

Quote from: Ryan Timothy on Sun 26/02/2012 23:15:01
I don't know anything about Abstauber's module but I do know what your error message is telling you.

If you have a struct and want to have a function work for that struct you import it into the struct (or an extender method).

Code: ags

struct CustomDialogGui
{
  //some variables are defined here
  
  import init(); //this is where it imports that function you're describing
};


If you've removed the line "import init();" or renamed it, your error message would be: 'CustomDialogGui' does not contain a function for init


This function:
Code: ags

function CustomDialogGui::init() 
{
  //etc..
}


Means that this function belongs within the struct CustomDialogGui. Hence the CustomDialogGui::init

The function works like so
customDialogGui.init();


Basically just like all the Character.Say  Character.Walk  functions that come with AGS. These are all functions within the Character struct.

Thanks Ryan

I fooled with this yesterday until I was crosseyed, finally had to take a break. I'm gonna look at it again and see what happened to the input.

I worked with the Make New Text GUI some as well but all I get is one box (not eight) and when I upload my custom box border it displays wrong and has big black arrows all over it. Anybody know what I am doing wrong  with this particular piece of editing.
Draft
AdventureDraft.com

Khris

I downloaded and imported the module and the only error I got was the use of eFontFont0 instead of eFontNormal. As soon as I corrected that, it compiled fine.

Just to make sure, did you import the module my right clicking the Scripts node and selecting "Import script..."?
Because the only way I can replicate this error is by -like Ryan explained- manually commenting out or removing a line in the module's header.

(Also: don't abuse the quote function, quoting the entire previous post serves absolutely no purpose, it just clutters up the thread.)

Kastchey

I know it's been ages since this thread was replied to, but I managed to repro this and resolve, after a maddening hour of code comparing between the main version and a backup.

So, in case it helps anyone else... The reason was that I had left an open /* in a custom script right above Custom Dialog GUI.
And while this did not visually comment anything out in the next script, I'm sure it quietly contracted the disease, making the engine treat the init() function as commented out.

Crimson Wizard

Quote from: Kastchey on Thu 21/12/2023 16:05:22So, in case it helps anyone else... The reason was that I had left an open /* in a custom script right above Custom Dialog GUI.
And while this did not visually comment anything out in the next script, I'm sure it quietly contracted the disease, making the engine treat the init() function as commented out.

If you're speaking about script headers, then the reason is that when compiling a script all the headers meant for this script are merged together into a single text, thus treated as one.

Kastchey

Ah. That makes sense. Useful to know, thanks!

Crimson Wizard

This is a C/C++ style of treating script headers, however, I suppose, this may be reworked for AGS by checking whether there's an unclosed comment or other region (like #ifdef block), and forcefully close it at the header's end with a warning.

Kastchey

It might be a good idea - thanks! I don't know if the frequency alone could warrant a validation, people probably don't leave open comments in the headers all that often. But when it does happen, it can be very confusing before you realize what could have happened.

Snarky

I know that people have had difficulties with the compiler errors when there's an unclosed brace close to the end of a script, because the error message points to the next script (and can be misleading).

SMF spam blocked by CleanTalk