GUI object number with new scripting? (SOLVED)

Started by monkey0506, Sun 03/04/2005 20:33:19

Previous topic - Next topic

monkey0506

Is it possible to use/find the object number of a GUI control witht he new scripting style (object-oriented)?  I'm in the process of rewriting my scrolling dialog template for the new style scripting and as an introduction (to myself) of the new style that will be used by AGS scripting, and I've encountered a potential problem.  I know (at least I think I do...) that the old-style scripting still works with the new style, but I had something like:

Code: ags
  int line = 0; // stores current line (0 - 6) of DIALOG GUI
  int shift = 0; // shifts text in appropriate direction
  int option = DialogVariable(0); // begin while loop at firstopt
  string text; // stores text to be set on label
  while ((line + shift) <= 6) { // sets text on label
    StrFormat(text, "%s", GetOptionText(option)); // format text
    if (optstate[option] == 0) // if option is ON
      SetLabelText(DIALOG, (line + shift), text); // set text on label
    else shift--; // shift text up
    line++; // go to next line
    option++; // and next option


That would set the text on to the labels.  The problem is I don't know how to access the object number with the new scripting style so storing the line number (label #) and shifting it (by changing the line number) work in a while loop.  I can always use the old-style scripting for this part if I have to, but I'm just looking for a better way...

strazer

Yes, you can use the GUI's "Controls" property:

Code: ags

gDialog.Controls[line + shift].AsLabel.SetText(text);

monkey0506


monkey0506

Lol...I actually read this entry (Controls property (GUI)) when I first downloaded it but I didn't know what it was talking about at the time...

SMF spam blocked by CleanTalk