Scrolling Dialog Template -- DEPRECATED

Started by monkey0506, Thu 30/12/2004 21:17:11

Previous topic - Next topic

Candle


monkey0506


Rui 'Trovatore' Pires

Well, no further problems have come up, right? Then I'll add your template to my archive. :)
Reach for the moon. Even if you miss, you'll land among the stars.

Kneel. Now.

Never throw chicken at a Leprechaun.

monkey0506

#23
Well, after a long break trying to figure out what was wrong with my scripts, I realized virtually nothing was wrong with them. Either that or it was an issue with something changed when I just made this update:

[EDIT: See latest script here.]

I don't have time (and I can't get a good link anyway) to rebuild/reupload the template files, but that script should fix a few minor things, as well as making the global script a tiny bit shorter (notice the way I rescripted on_event, it's much nicer that way). And I never did get a definitive reply as to whether or not Candle ever got this working in 640 resolution...

EDIT: I've just discovered the "GetTextWidth" function... Hmm... Perhaps I could figure out aÃ,  way to allow multi-line text... This would be very extremely useful in doing so. Why hasn't anyone mentioned this???

monkey0506

#24
Update again!Ã,  Sorry about all these long posts, but this one is a major update to the global script:

Code: ags
// main global script file

int RunningDialog; // stores currently running dialog
dlg dlgnum[300]; // max 300 dialogs
int optstate[9000]; // Max. 30 topics per dialog, Max. 300 dialogs

function DialogVariable(int var){
Ã,  if (var == 0) {
Ã,  Ã,  int firstopt = (RunningDialog * 30);
Ã,  Ã,  return firstopt;
Ã,  Ã,  }
Ã,  else if (var == 1) {
Ã,  Ã,  int topopt = (RunningDialog * 30);
Ã,  Ã,  while (optstate[topopt] != 0) topopt++;
Ã,  Ã,  return topopt;
Ã,  Ã,  }
Ã,  else if (var == 2) {
Ã,  Ã,  int bottomopt = (RunningDialog * 30);
Ã,  Ã,  while (optstate[bottomopt] != 0) bottomopt++;
Ã,  Ã,  bottomopt += 6;
Ã,  Ã,  return bottomopt;
Ã,  Ã,  }
Ã,  else if (var == 3) {
Ã,  Ã,  int lastopt = (RunningDialog * 30);
Ã,  Ã,  lastopt += 29;
Ã,  Ã,  }
 }

function OptStateEstablishment() {
Ã,  // set objects not contained in the first 7 lines of a dialog
Ã,  // to "off by scrolling"
Ã,  int i = 0;
Ã,  while (i <= 8999) {
Ã,  Ã,  optstate[i] = 1;
Ã,  Ã,  i++;
Ã,  Ã,  }
Ã,  RunningDialog = 0;
Ã,  while (RunningDialog <= 299) {
Ã,  Ã,  int j = DialogVariable(0);
Ã,  Ã,  while (j < (DialogVariable(0) + 7)) {
Ã,  Ã,  Ã,  optstate[j] = 0;
Ã,  Ã,  Ã,  j++;
Ã,  Ã,  Ã,  }
Ã,  Ã,  RunningDialog++;
Ã,  Ã,  }
Ã,  RunningDialog = -1;
Ã,  }

#sectionstart game_startÃ,  // DO NOT EDIT OR REMOVE THIS LINE
function game_start() // called when the game starts, before the first room is loaded
Ã,  {
Ã,  // Turn off DIALOG and DLGARROW GUIs
Ã,  GUIOff(DIALOG);
Ã,  GUIOff(DLGARROWS);
Ã,  OptStateEstablishment();
Ã,  }
#sectionend game_startÃ,  // DO NOT EDIT OR REMOVE THIS LINE

function GetOptionText(int option) {
Ã,  // use this function to get the text of a variable option of the running dialog, i.e., as in a while loop
Ã,  if (option > 29) option -= DialogVariable(0); // set up for appropriate dialog
Ã,  if (option == 0) return dlgnum[RunningDialog].text0;
Ã,  else if (option == 1) return dlgnum[RunningDialog].text1;
Ã,  else if (option == 2) return dlgnum[RunningDialog].text2;
Ã,  else if (option == 3) return dlgnum[RunningDialog].text3;
Ã,  else if (option == 4) return dlgnum[RunningDialog].text4;
Ã,  else if (option == 5) return dlgnum[RunningDialog].text5;
Ã,  else if (option == 6) return dlgnum[RunningDialog].text6;
Ã,  else if (option == 7) return dlgnum[RunningDialog].text7;
Ã,  else if (option == 8) return dlgnum[RunningDialog].text8;
Ã,  else if (option == 9) return dlgnum[RunningDialog].text9;
Ã,  else if (option == 10) return dlgnum[RunningDialog].text10;
Ã,  else if (option == 11) return dlgnum[RunningDialog].text11;
Ã,  else if (option == 12) return dlgnum[RunningDialog].text12;
Ã,  else if (option == 13) return dlgnum[RunningDialog].text13;
Ã,  else if (option == 14) return dlgnum[RunningDialog].text14;
Ã,  else if (option == 15) return dlgnum[RunningDialog].text15;
Ã,  else if (option == 16) return dlgnum[RunningDialog].text16;
Ã,  else if (option == 17) return dlgnum[RunningDialog].text17;
Ã,  else if (option == 18) return dlgnum[RunningDialog].text18;
Ã,  else if (option == 19) return dlgnum[RunningDialog].text19;
Ã,  else if (option == 20) return dlgnum[RunningDialog].text20;
Ã,  else if (option == 21) return dlgnum[RunningDialog].text21;
Ã,  else if (option == 22) return dlgnum[RunningDialog].text22;
Ã,  else if (option == 23) return dlgnum[RunningDialog].text23;
Ã,  else if (option == 24) return dlgnum[RunningDialog].text24;
Ã,  else if (option == 25) return dlgnum[RunningDialog].text25;
Ã,  else if (option == 26) return dlgnum[RunningDialog].text26;
Ã,  else if (option == 27) return dlgnum[RunningDialog].text27;
Ã,  else if (option == 28) return dlgnum[RunningDialog].text28;
Ã,  else if (option == 29) return dlgnum[RunningDialog].text29;
Ã,  }

function HighlightDialog() { //highlight the dialog option under the mouse
Ã,  if ((IsGUIOn(DIALOG)) && (GetGUIAt(mouse.x, mouse.y) == DIALOG)) {
Ã,  Ã,  if (GetGUIObjectAt(mouse.x, mouse.y) == 0) SetLabelColor(DIALOG, 0, 13);
Ã,  Ã,  else SetLabelColor(DIALOG, 0, 31055);
Ã,  Ã,  if (GetGUIObjectAt(mouse.x, mouse.y) == 1) SetLabelColor(DIALOG, 1, 13);
Ã,  Ã,  else SetLabelColor(DIALOG, 1, 31055);
Ã,  Ã,  if (GetGUIObjectAt(mouse.x, mouse.y) == 2) SetLabelColor(DIALOG, 2, 13);
Ã,  Ã,  else SetLabelColor(DIALOG, 2, 31055);
Ã,  Ã,  if (GetGUIObjectAt(mouse.x, mouse.y) == 3) SetLabelColor(DIALOG, 3, 13);
Ã,  Ã,  else SetLabelColor(DIALOG, 3, 31055);
Ã,  Ã,  if (GetGUIObjectAt(mouse.x, mouse.y) == 4) SetLabelColor(DIALOG, 4, 13);
Ã,  Ã,  else SetLabelColor(DIALOG, 4, 31055);
Ã,  Ã,  if (GetGUIObjectAt(mouse.x, mouse.y) == 5) SetLabelColor(DIALOG, 5, 13);
Ã,  Ã,  else SetLabelColor(DIALOG, 5, 31055);
Ã,  Ã,  if (GetGUIObjectAt(mouse.x, mouse.y) == 6) SetLabelColor(DIALOG, 6, 13);
Ã,  Ã,  else SetLabelColor(DIALOG, 6, 31055);
Ã,  Ã,  }
Ã,  else { // mouse not over GUI option
Ã,  Ã,  SetLabelColor(DIALOG, 0, 31055);
Ã,  Ã,  SetLabelColor(DIALOG, 1, 31055);
Ã,  Ã,  SetLabelColor(DIALOG, 2, 31055);
Ã,  Ã,  SetLabelColor(DIALOG, 3, 31055);
Ã,  Ã,  SetLabelColor(DIALOG, 4, 31055);
Ã,  Ã,  SetLabelColor(DIALOG, 5, 31055);
Ã,  Ã,  SetLabelColor(DIALOG, 6, 31055);
Ã,  Ã,  }
Ã,  }

function OptStateNullEstablishment() {
Ã,  // turn empty strings off 
Ã,  int i = DialogVariable(0);
Ã,  while (i <= DialogVariable(3)) {
Ã,  Ã,  string j;
Ã,  Ã,  StrFormat(j, "%s", GetOptionText(i));
Ã,  Ã,  if (StrComp(j, "") == 0) optstate[i] = -1;
Ã,  Ã,  i++;
Ã,  Ã,  }
Ã,  }

function SetupDialog(int dialog) {
Ã,  //this function is used to replace the dialog tab in the game editor
Ã,  RunningDialog = dialog; // store the currently running dialog globally
Ã,  // set up dialog text in arrays
Ã,  /****///DIALOG 1///****/
Ã,  StrCopy(dlgnum[0].text0, "My name's Guybrush Threepwood. Prepare to die!");
Ã,  StrCopy(dlgnum[0].text1, "So... How did you get up there?");
Ã,  StrCopy(dlgnum[0].text2, "I'll just be running along now.");
Ã,  /****///DIALOG 2///****/
Ã,  StrCopy(dlgnum[1].text0, "This is the first option of dialog two.");
Ã,  StrCopy(dlgnum[1].text1, "It's not that fantastic, but it's just for testing.");
Ã,  StrCopy(dlgnum[1].text2, "I need to make six more after this.");
Ã,  StrCopy(dlgnum[1].text3, "One down, five more to go for this dialog.");
Ã,  StrCopy(dlgnum[1].text4, "Funny the way I gave up on trying to build a dialog tree.");
Ã,  StrCopy(dlgnum[1].text5, "A few more to go now...");
Ã,  StrCopy(dlgnum[1].text6, "I'm getting bored.");
Ã,  StrCopy(dlgnum[1].text7, "This is making me tired.");
Ã,  StrCopy(dlgnum[1].text8, "This is the last one, thank goodness.");
Ã,  OptStateNullEstablishment(); // turn off empty options
Ã,  // set appropriate dialog text on GUI
Ã,  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
Ã,  Ã,  }
Ã,  // check ability to scroll
Ã,  string strbotopt, strbotopt1;
Ã,  StrFormat(strbotopt, "%s", (GetOptionText(DialogVariable(2)))); // check bottom option
Ã,  StrFormat(strbotopt1, "%s", (GetOptionText(DialogVariable(2) + 1))); // check option below bottom option
Ã,  int i = DialogVariable(1);
Ã,  int j = (DialogVariable(2) + 1);
Ã,  while ((i >= DialogVariable(0)) && (optstate[i] != 1)) i--;
Ã,  while ((j <= DialogVariable(4)) && (optstate[j] != 1)) j++;
Ã,  if (((DialogVariable(1) != DialogVariable(0)) && (optstate[i] == 1)) ||
Ã,  Ã,  ((StrComp(strbotopt, "") != 0) && (StrComp(strbotopt1, "") != 0) && 
Ã,  Ã,  (optstate[j] == 1))) { // can scroll
Ã,  Ã,  Ã,  if ((DialogVariable(1) != DialogVariable(0)) && (optstate[i] == 1)) { // can scroll up
Ã,  Ã,  Ã,  Ã,  SetGUIObjectEnabled(DLGARROWS, 0, 1);
Ã,  Ã,  Ã,  Ã,  SetButtonPic(DLGARROWS, 0, 1, 79);
Ã,  Ã,  Ã,  Ã,  }
Ã,  Ã,  Ã,  else { // can not scroll up
Ã,  Ã,  Ã,  Ã,  SetGUIObjectEnabled(DLGARROWS, 0, 0);
Ã,  Ã,  Ã,  Ã,  SetButtonPic(DLGARROWS, 0, 1, 0);
Ã,  Ã,  Ã,  Ã,  }
Ã,  Ã,  Ã,  if ((StrComp(strbotopt, "") != 0) && (StrComp(strbotopt1, "") != 0) &&
Ã,  Ã,  Ã,  Ã,  (optstate[j] == 1)) { // can scroll down
Ã,  Ã,  Ã,  Ã,  SetGUIObjectEnabled(DLGARROWS, 1, 1);
Ã,  Ã,  Ã,  Ã,  SetButtonPic(DLGARROWS, 1, 1, 81);
Ã,  Ã,  Ã,  Ã,  }
Ã,  Ã,  Ã,  else { // can not scroll down
Ã,  Ã,  Ã,  Ã,  SetGUIObjectEnabled(DLGARROWS, 1, 0);
Ã,  Ã,  Ã,  Ã,  SetButtonPic(DLGARROWS, 1, 1, 0);
Ã,  Ã,  Ã,  Ã,  }
Ã,  Ã,  Ã,  SetGUIPosition(DIALOG, 16, 143);
Ã,  Ã,  Ã,  SetGUISize(DIALOG, 304, 57);
Ã,  Ã,  Ã,  GUIOn(DLGARROWS);
Ã,  Ã,  Ã,  }
Ã,  else { // can not scroll
Ã,  Ã,  SetGUIPosition(DIALOG, 0, 143);
Ã,  Ã,  SetGUISize(DIALOG, 320, 57);
Ã,  Ã,  GUIOff(DLGARROWS);
Ã,  Ã,  }
Ã,  GUIOn(DIALOG); // turn on the dialog GUI
Ã,  }

function EndDialog() {
Ã,  RunningDialog = -1; // no dialog running
Ã,  GUIOff(DLGARROWS); // turn off dialog arrows
Ã,  GUIOff(DIALOG); // turn off dialog
Ã,  SetCursorMode(0);
Ã,  // TURN ON NORMAL GUIS HERE
Ã,  }

function RunCustomDialog(int dialog, int option){
Ã,  //this function is used to replace the dialog editor
Ã,  GUIOff(DLGARROWS); // turn off dialog arrows during speech
Ã,  GUIOff(DIALOG); // turn off dialog GUI during speech
Ã,  while (optstate[option] != 0) option++;
Ã,  if (option > 29) option -= DialogVariable(0);
Ã,  if (dialog==0){
Ã,  Ã,  if ((option > 2) && (option < 7)) SetupDialog(0);
Ã,  Ã,  if (option==0){
Ã,  Ã,  Ã,  DisplaySpeech(GBRUSH, dlgnum[0].text0);
Ã,  Ã,  Ã,  DisplaySpeech(CHAR, "No... That can't be right. I'm Guybrush!");
Ã,  Ã,  Ã,  DisplaySpeech(GBRUSH, "Woah... You're right!");
Ã,  Ã,  Ã,  DisplaySpeech(CHAR, "Of course I'm right.");
Ã,  Ã,  Ã,  optstate[0] = -1;// turn of dlgnum[0].text0
Ã,  Ã,  Ã,  SetupDialog(0);
Ã,  Ã,  Ã,  }
Ã,  Ã,  else if (option==1){
Ã,  Ã,  Ã,  DisplaySpeech(GBRUSH, dlgnum[0].text1);
Ã,  Ã,  Ã,  DisplaySpeech(CHAR, "I was born this way.");
Ã,  Ã,  Ã,  DisplaySpeech(GBRUSH, "You were?");
Ã,  Ã,  Ã,  DisplaySpeech(GBRUSH, "That's amazing!");
Ã,  Ã,  Ã,  DisplaySpeech(CHAR, "Yes, but--");
Ã,  Ã,  Ã,  DisplaySpeech(CHAR, "OH MY!");
Ã,  Ã,  Ã,  DisplaySpeech(CHAR, "Look, a distraction!");
Ã,  Ã,  Ã,  DisplaySpeech(GBRUSH, "Where?");
Ã,  Ã,  Ã,  EndDialog();
Ã,  Ã,  Ã,  }
Ã,  Ã,  else if (option==2){
Ã,  Ã,  Ã,  DisplaySpeech(GBRUSH, dlgnum[0].text2);
Ã,  Ã,  Ã,  DisplaySpeech(CHAR, "You do that, son...");
Ã,  Ã,  Ã,  EndDialog();
Ã,  Ã,  Ã,  }
Ã,  Ã,  }
Ã,  else if (dialog == 1) {
Ã,  Ã,  if (option == 8) {
Ã,  Ã,  Ã,  DisplaySpeech(GBRUSH, dlgnum[1].text8);
Ã,  Ã,  Ã,  optstate[DialogVariable(0) + 8] = -1;
Ã,  Ã,  Ã,  SetupDialog(1);
Ã,  Ã,  Ã,  }
Ã,  Ã,  else EndDialog();
Ã,  Ã,  }
Ã,  }

function AutoScrollDialog() {
Ã,  // automatically correct the scrolling of the dialogues
Ã,  if (optstate[DialogVariable(2)] == -1) {
Ã,  Ã,  int i = DialogVariable(2);
Ã,  Ã,  while ((optstate[i] != 1) && (i <= DialogVariable(3))) i++;
Ã,  Ã,  if (optstate[i] == 1) optstate[i] = 0;
Ã,  Ã,  else {
Ã,  Ã,  Ã,  int j = DialogVariable(1);
Ã,  Ã,  Ã,  while ((optstate[j] != 1) && (j >= DialogVariable(0))) j--;
Ã,  Ã,  Ã,  if (optstate[j] == 1) optstate[j] = 0;
Ã,  Ã,  Ã,  }
Ã,  Ã,  SetupDialog(RunningDialog);
Ã,  Ã,  }
Ã,  }

#sectionstart on_eventÃ,  //DO NOT EDIT OR REMOVE THIS LINE
function on_event(int event, int data) {
Ã,  if (event == GUI_MDOWN) { // if clicked on A GUI (any mouse button, combine with IsButtonDown to allow/disallow buttons)
Ã,  Ã,  if (data == DIALOG) { // if clicked on THIS gui
Ã,  Ã,  Ã,  RunCustomDialog(RunningDialog, DialogVariable(1) + GetGUIObjectAt(mouse.x, mouse.y));
Ã,  Ã,  Ã,  }
Ã,  Ã,  }
Ã,  }
#sectionend on_eventÃ,  //DO NOT EDIT OR REMOVE THIS LINE

#sectionstart repeatedly_executeÃ,  // DO NOT EDIT OR REMOVE THIS LINE
function repeatedly_execute() 
Ã,  {
Ã,  // put anything you want to happen every game cycle here
Ã,  HighlightDialog();
Ã,  AutoScrollDialog();
Ã,  }
#sectionend repeatedly_executeÃ,  // DO NOT EDIT OR REMOVE THIS LINE

function show_inventory_window()Ã,  Ã, 
// This demonstrates both types of inventory window - the first part is how to
// show the built-in inventory window, the second part uses the custom one.
// Un-comment one section or the other below.
Ã,  {
Ã,  // ** DEFAULT INVENTORY WINDOW
Ã,  InventoryScreen();
Ã,  /*Ã,  
Ã,  // ** CUSTOM INVENTORY WINDOW
Ã,  GUIOn (INVENTORY);Ã,  
Ã,  // switch to the Use cursor (to select items with)
Ã,  SetCursorMode (MODE_USE);
Ã,  // But, override the appearance to look like the arrow
Ã,  SetMouseCursor (6);
Ã,  */
Ã,  }

#sectionstart on_key_pressÃ,  // DO NOT EDIT OR REMOVE THIS LINE
function on_key_press(int keycode) // called when a key is pressed. keycode holds the key's ASCII code
Ã,  {
Ã,  if (/*(*/IsGUIOn(DIALOG)) /*&& (keycode !=Ã,  NEGATE YOUR DIALOG KEYCODES HERE ))*/ keycode = 0;
Ã,  // You may want some popup modal GUIs to be able to come on while the DIALOG
Ã,  // GUI is on. Negate these (i.e., keycode != 32) here so that other keypresses
Ã,  // will be ignored.
Ã,  // PLACE YOUR on_key_press SCRIPTS HERE
Ã,  if (IsGamePaused()==1) keycode=0; // game paused, so don't react to keypresses
Ã,  if (keycode==17) QuitGame(1); // Ctrl-Q
Ã,  if (keycode==363) SaveGameDialog(); // F5
Ã,  if (keycode==365) RestoreGameDialog(); // F7
Ã,  if (keycode==367) RestartGame(); // F9
Ã,  if (keycode==434) SaveScreenShot("scrnshot.pcx");Ã,  // F12
Ã,  if (keycode==9) show_inventory_window(); // Tab, show inventory
Ã,  }
#sectionend on_key_pressÃ,  // DO NOT EDIT OR REMOVE THIS LINE
 
#sectionstart on_mouse_clickÃ,  // DO NOT EDIT OR REMOVE THIS LINE
function on_mouse_click(int button) // called when a mouse button is clicked. button is either LEFT or RIGHT
Ã,  {
Ã,  if (IsGUIOn(DIALOG)) button = 0; // prevent non-GUI mouse-clicks during dialogÃ,  Ã,  
Ã,  if (IsGamePaused()==1) // Game is paused, so do nothing (ie. don't allow mouse click)
Ã,  Ã,  {
Ã,  Ã,  }
Ã,  // PLACE YOUR on_mouse_click SCRIPTS HERE
Ã,  else if (button==LEFT) 
Ã,  Ã,  {
Ã,  Ã,  ProcessClick(mouse.x,mouse.y,GetCursorMode());
Ã,  Ã,  }
Ã,  else // right-click, so cycle cursor
Ã,  Ã,  {Ã,  Ã, 
Ã,  Ã,  SetNextCursorMode();
Ã,  Ã,  }
Ã,  }
#sectionend on_mouse_clickÃ,  // DO NOT EDIT OR REMOVE THIS LINE

#sectionstart interface_clickÃ,  // DO NOT EDIT OR REMOVE THIS LINE
function interface_click(int interface, int button) {
Ã,  if (interface == DIALOG) on_event(GUI_MDOWN, DIALOG);
Ã,  else if (interface == DLGARROWS) {
Ã,  Ã,  if (button == 0) { // scroll up
Ã,  Ã,  Ã,  int i = DialogVariable(1);
Ã,  Ã,  Ã,  while ((i >= DialogVariable(0)) && (optstate[i] != 1)) i--;
Ã,  Ã,  Ã,  if (optstate[i] == 1) {
Ã,  Ã,  Ã,  Ã,  // if any option above the top has been turned off by scrolling
Ã,  Ã,  Ã,  Ã,  optstate[DialogVariable(2)] = 1;
Ã,  Ã,  Ã,  Ã,  optstate[i] = 0;
Ã,  Ã,  Ã,  Ã,  }
Ã,  Ã,  Ã,  }
Ã,  Ã,  else if (button == 1) { // scroll down
Ã,  Ã,  Ã,  int i = DialogVariable(2) + 1;
Ã,  Ã,  Ã,  while ((optstate[i] != 1) && (i <= DialogVariable(3))) i++;
Ã,  Ã,  Ã,  if (optstate[i] == 1) {
Ã,  Ã,  Ã,  Ã,  // if any option below the bottom has been turned off by scrolling
Ã,  Ã,  Ã,  Ã,  optstate[DialogVariable(1)] = 1;
Ã,  Ã,  Ã,  Ã,  optstate[i] = 0;
Ã,  Ã,  Ã,  Ã,  }
Ã,  Ã,  Ã,  }
Ã,  Ã,  SetupDialog(RunningDialog);
Ã,  Ã,  }
Ã,  // PLACE YOUR interface_click SCRIPTS HERE
Ã,  }
#sectionend interface_clickÃ,  // DO NOT EDIT OR REMOVE THIS LINE

#sectionstart character2_aÃ,  // DO NOT EDIT OR REMOVE THIS LINE
function character2_a() {
Ã,  // script for character2: Any click on character
if (GetCursorMode() == MODE_TALK) {
Ã,  SetCursorMode(6);
Ã,  SetupDialog(0);
Ã,  }
else {
Ã,  SetCursorMode(6);
Ã,  SetupDialog(1);
Ã,  }Ã,  
}
#sectionend character2_aÃ,  // DO NOT EDIT OR REMOVE THIS LINE


I'll rebuild the template file tomorrow if I get a chance.Ã,  As for what this update does, it allows you to turn off options in scrolling dialogs.Ã,  With earlier versions this wasn't possible.Ã,  It also establishes the optstate of everything but the first 7 options of every dialog (the first shown, 0 - 6) as '1', which aids in proper scrolling capabilities.Ã,  And I now test whether the option you are scrolling to is actually off by scrolling.Ã,  If it's not off by scrolling, it will go to the first option that is, or if none are available, it will not allow scrolling.

EDIT:  I edited all the posts that contained lengthy bits of code and linked them to this post.

EDIT:  I reuploaded it to my site, but I'm not sure if it will work.  I had to use WinXP's compression service to zip it because my copy of Picozip self-corrupted.

http://www32.brinkster.com/monkey0506/dlg320.zip
http://www32.brinkster.com/monkey0506/dlg640.zip

monkey0506

#25
I know this may sound a bit big-headed of myself, but I was just reading in the BFAQ (Re: Dialog Speech Color) and it reads:

QuoteThe dialog options are drawn in the player character's talking color. The highlighted option color uses the GUI foreground color if you are using a GUI TextWindow. Otherwise, it is hardcoded to yellow. Maybe in the future there will be a way to change this, but for now, deal with it!

I was just wondering if this template could be added as a workaround to the highlighted option color (if that sort of thing is even done in the BFAQ).  If it isn't, then you can probably just ignore this post (or "deal with it!").

GarageGothic

Ok, this is the error message I get when using both 640 and 320 versions of the template on the AGS 2.7 RC1. I haven't been able to use it on any versions of 2.7:

An internal error has occured. Please note down the following information.
If the problem persists, contact Chris Jones.
(ACI version 2.70.849)

Error: run_text_script1: error -6 running function 'repeatedly_execute':
Error: Array index out of bounds (index: -30, bounds: 0..8999)
in Global script (line 19)
from Global script (line 258)
from Global script (line 286)

monkey0506

Thank you for reporting this problem.  I will look into it immediately (actually, I'm at school right now, and then I'll be gone all weekend, so I'll get to it first thing Monday).  It's probably just a problem with the AutoScrollDialog function, so if you temporarily comment out that line:

Code: ags
#sectionstart repeatedly_execute  // DO NOT EDIT OR REMOVE THIS LINE
function repeatedly_execute() 
  {
  // put anything you want to happen every game cycle here
  HighlightDialog();
[b]//  AutoScrollDialog();[/b]
  }
#sectionend repeatedly_execute  // DO NOT EDIT OR REMOVE THIS LINE


HighlightDialog() doesn't reference any array elements, so it's likely a problem with the while loop.  Please note that with this line commented out, you can not turn off options in a scrolling dialog.  It causes errors in the way the dialog options are displayed.  Once again, thank you for reporting this error, and like I said, I'm gone all weekend, but I'll look at it Monday. :)

Dr Lecter

Erm... I tried using the script with version 2.7 and this happened:
---------------------------
Illegal exception
---------------------------
An exception 0xC0000005 occured in ACWIN.EXE at EIP = 0x0043072C ; program pointer is +379, ACI version 2.70.864, gtags (1,1)

AGS cannot continue, this exception was fatal. Please note down the numbers above, remember what you were doing at the time and notify CJ on the Tech forum.



Most versions of Windows allow you to press Ctrl+C now to copy this entire message to the clipboard for easy reporting.
---------------------------
OK   
---------------------------

Something tells me that isn't very good...

I don't know how I plan to do this, but I'm going to try and make a much simpler custom version of is, minimised down so that it only covers what I want it to.

monkey0506

#29
Well the code is optimised for 2.62.  So it may have something to do with that.  Else it may have something to do with the Autoscroll functions I was trying to implement which will be obsolete in the new SM I am coming out with.

OFFICIAL UPDATE FOR NEW USERS (and those who haven't heard about the ScrollingDialog Script Module):

This template was designed within and for AGS Version 2.62.  It is now outdated, although it's replacement is still under construction.  It was never fully implemented, but the missing features are getting worked on in the Script Module that will replace this template.  You are still free to use this as you see fit, but as I now use AGS 2.7, support may (and probably will) be limited!  Thank you,

monkey_05_06

monkey0506

#30
Well...it's been a long while since I started this venture, and it would seem that I'm nearly there.  As I have previously mentioned, this template is being replaced by a script module.

The replacement SM is nearing completion, so I figured I would give an official update on the new syntax that will be used.

Previously, this was something of a hassle to work with...to say the least.  I hope to simplify these matters a lot with this module.  For example, previously the user had access to an array, dlgnum[300], which has been changed and removed from the user's general use.

The user will now have access to the struct ScrollingDialog, which contains static functions to set and obtain the values needed by the script.  For example, where the user previously had to type something like string temp; StrFormat(temp, "%s", GetOptionText(3)); to get the text from an option, the user can now do this String Text = ScrollingDialog.GetOptionText(0, 3); (AGS 2.71 beta 3+).

Furthermore, the following will be available with the release of the replacement SM:

ScrollingDialog SM Features (pre-release list)
Ability to run a dialog from any script (following the SM in the SM list).
Ability to scroll dialogs containing more options than can be shown on the GUI at once (as defined by the number of labels on the GUI).
User definition of default, highlighted, and used dialog option colors.
Ability to run interaction for a dialog option from any script (following the SM in the SM list).
Multi-line dialog text support (dialog options can span up to two lines per option).
Support of up to 200 characters per option (as opposed to the 150 character built-in limit).
Support of 500 dialog topics each containing 30 options (based on built-in limits.  the user can increase/decrease these limits).

So...it's come a good ways.  Well...I increased some of the limits, added multi-line support, and added user color-definition support.  I'm still working out some bugs, but keep an eye out for this...it should be finished soon.

[EDIT:]

I've now implemented dynamic string reconstruction.  Basically, all this means is that the text will appear correctly on your GUI if the dialog is scrollable or not.  The reason it is important is this.  Suppose you have a long string of text:

"Hello, my name is Toboggan Shoeslider.  I'm new to this town."

It's possible that this text would span more than one line, perhaps displaying:

"Hello, my name is Toboggan Shoeslider.  I'm new"

on the first line, and:

" to this town."

On the second.  Now suppose that you later turn on a dialog option, which makes the dialog topic in question scrollable.  Since the GUI is moved and resized to make room for the new text, less of the first line would fit on the new first line.  But, because of the dynamic text reconstruction, the user doesn't have to worry about this at all.  It is all taken care of.

[EDIT:]

ScrollingDialog v. 0.5 BETA Script Module posted as Monday 5 September 2005 3:46 P.M. Central time.

monkey0506

Final bump.

Version 0.60 of the ScrollingDialog Script Module has now been released.  Although it requires v. 2.71 RC1 or later (which ATM is not the official version), this template is officially deprecated.  If anyone really wants to use it, be warned that support will be very limited.  Perhaps you can contact Geoffkan because he has created a new system based on this one which is AGS 2.7 compliant.  In any case, this thread, which has been dead for some time, is officially ended.

SMF spam blocked by CleanTalk