TEMPLATE: Scavenger's Icon Based Dialog System (SIBIDS)

Started by Scavenger, Wed 05/11/2003 18:01:27

Previous topic - Next topic

Scavenger

No, no! I know what you're thinking. But no. I am not in need of CJ to install needless add-ins to AGS. I have just created one myself =) Want to see?

SIBIDS - Scavenger's Icon Based Interactive Dialog System
SIBIDS is my system, and it does Icon based conversations. At the moment it can do up to 129 individual dialogs, with custom title bars showing the name of the Character you're talking to, up to eight options, and an ambiguous way of coding. Now comes with a NON EXISTANT (wow!) manual!

HOW TO SET UP DIALOGS:
In ProcessDialog, put your dialog code in the following way:
if (UsedDO (PLACE_DIALOGNO_HERE, PLACE_DIALOGOPTION_HERE)) {
DisplaySpeech (EGO, "This is the way you converse.");
DisplaySpeech (MAN, "Cool, huh?"}
Make sure you put Dialog Option 1 as the Greeting, and 8 as the Leaving. To leave the dialog, use QuitDialog (), and that will ensure you quit. To set icons, in game_start, set:
dialog[DIALOG_NUMBER].buttonpic[DIALOG_OPTION] = (The sprite slot number)

ADVANTAGES/DISADVANTAGES to SIBIDS:
Pro's -
Easy intergration of real code into dialogs.
Pretty Pictures!
You can make non-blocking GUIs.

Cons -
UNMANAGABLE.
Hard to grasp.
Un-user friendly.



HasPlayerQuitDialog ()
Returns 1 if the player has quit the dialog.

QuitDialog ()
Used to kick the player out of the current conversation. Useful for those times when the NPC gets annoyed with you, or you click the bye button.

SetDialogIcon (Dialog Number,Dialog Option,On or off?)
Sets dialog icons either on, or off.
InitiateDialog (Dialog Number)
Sets up the conversation, eg by opening the Dialog Gui, setting the current conversation to the one you specify, makes the dialog gui say the right buttons and the name of the character you're talking to, and so on. The most important initiation function!
ProcessDialog
The backbone of the SIBIDS. Although, on transit it may seem like its the smallest function, but believe me, it can easily be the largest function IN YOUR ENTIRE GAME, even though you must never ever run this function. One disadvantage to SIBIDS is that the whole of the games dialogs are stored in this one function, making organising a messy business. But, if you organise right, you could be in for a winner, here. (I could create a program to generate the dialogs like the AGS dialogs can... but I don't know C++, so what good I'd be is a mystery)
UsedDO (dialog number,dialog option)
Short for Used Dialog Option. Returns 1 if the dialog option selected is available to click on. Used IN ProcessDialog.

The other functions are too insignificant to name, and their use is obvious and uneeded by the user.

Below is the code needed by your game to run. You also need:
THIIIISSS GUIIII!!!!! (Save Target As, remember.) to use the dialog system to it's potential

char quitdialog;
char currdialog;
char isindialog;

struct Cdialog {
char button[8];
short buttonpic[8];
string chartotalkto;
};

Cdialog dialog[129];

function InitiateDialog (char dialognum) { // initiates a conversation, ie, sets up the display, and which dialog it is.
    char buttonnum;
while (buttonnum <=7) {if (dialog[dialognum].button[buttonnum]) {
SetButtonPic (DIALOG, buttonnum,1, dialog[dialognum].buttonpic[buttonnum]);}
else { SetButtonPic (DIALOG,0,1, 0);}
buttonnum++;}
SetTextBoxText (DIALOGGUI, 9, dialog[dialognum].chartotalkto);
GUIOn (DIALOGGUI);
isindialog = 1;
currdialog = dialognum;}

function UsedDO (short dialognumber, char dialogoption) {
  if ((dialognum == dialognumber) && (curopt == dialogoption) && (IsDialogOptionAvailable(dialognum, curopt))) return 1;
  else return 0;}

function IsDialogOptionAvailable (char dialogn, char optionn) {
  if (dialog[dialogn].button[optionn]) return 1;}

function ProcessDialog (char dialognum, char curopt) { //the dialog engine, DO NOT RUN THIS COMMAND! It's a raw function, like on_key_press, or on_mouse_click.
  GUIOff (DIALOGGUI); //turns the dialog gui off, so the user can't touch the dialog options
if (UsedDO (0,0)){ // The Kind of thing you should do.
}
  if (HasPlayerQuitDialog () == 0) { //If the player HASN'T chosen the quit option, or hasn't been kicked out of the conversation...
   InitiateDialog (currdialog); //Reruns the dialog.
else {
    quitdialog = 0;}}

function HasPlayerQuitDialog () {
  return quitdialog;}

function QuitDialog () { //Quits the current dialog
  quitdialog = 1;}
function SetDialogIcon (short dialogn, short buttonn, char moden) {dialog[dialogn].button[buttonn] = moden;}

TELL ME WHAT YOU THINK! Um.. whoops. Caps lock =(.

Edit by strazer:

See following posts for template link.

Also, be sure to check out HeirOfNorton's script modules.

SSH

* SSH applauds Scavenger's hard work

Why not make a template?

Would it work if a BrokenSword/ Lucasarts style invetory item was clicked on as a dialog topic?

12

Scavenger

It was amazingly easy to code, as well :P

Hehe, no template = me too lazy.

I suppose it could be done with inventory items... if you set their other click interactions to run ProcessDialog, and gave the inventory items to the character which holds the dialog you want to use... but of course, anything is. Just mess around with it. But remember there is an inventory item limit, so I wouldn't suggest it. (129x8 = 1032, which is nearly 10 times the amount of inventory items you can have in your game)

Scorpiorus


Pumaman

Nice work indeed, I'll move this one to the Tech Archive in a few days.

Rui 'Trovatore' Pires

#5
I'll try and whip up a template of this and upload it in my website.

EDIT

I'm working on it. Seriously, Scavenger, did you even test this? The code is nightmarish, absolutely nightmarish. Either you didn't give us the right code, IN THE PROPER SEQUENCE and with EVERYTHING on it, or you didn't even test it.

EDIT 2

Ok, it's done. Sorry if I sounded testy, but your code really was incomplete and needed proper documentation. For instance, we don't use 1-8 AT ALL, but 0-7... and you sometimes use DIALOG and sometimes DIALOGGUI for the same GUI... and you called functions which you only delcared afterwards... but I fixed it now. :P At least it works for me... I'll upload it soon, and include both YOUR instructions and MY rectifications in the readme.

EDIT 3

Template now available on my AGS resource site.

Now excuse me while I have my breakfast. :P

EDIT 4 - Forgot to mention, I used AGS v2.7!.
Reach for the moon. Even if you miss, you'll land among the stars.

Kneel. Now.

Never throw chicken at a Leprechaun.

Scavenger

#6
Whoa. This is OLD...  must've been over six months ago. You're completely and utterly correct. SIBIDS was sloppily coded.. looking back on it now, I cringe at the sight of it! I definately didn't know how to distribute code ¬¬. Or write it, for that matter. It went through two seperate game files before release. Uck. I'll make it my sworn duty to write better and more coherent code next time!

I thank you truely and sincerely for fixing this age old problem... you're a regular philanthropist!

EDIT: Tested game. Works fine for me.

magintz

Has anyone made anything with this so I can take a looksie?
When I was a little kid we had a sand box. It was a quicksand box. I was an only child... eventually.

Rui 'Trovatore' Pires

Sure, take a look at the template further up this thread. :P Compile it and see.
Reach for the moon. Even if you miss, you'll land among the stars.

Kneel. Now.

Never throw chicken at a Leprechaun.

SMF spam blocked by CleanTalk