Wintermute Engine Forum

Wintermute Engine => Scripts, plugins, utilities, goodies => Topic started by: metamorphium on September 16, 2006, 08:21:20 PM

Title: Icon based dialogues
Post by: metamorphium on September 16, 2006, 08:21:20 PM
Hi,

I quickly threw together an universal object for icon based dialogues. Feel free to use it, misuse it, change it or throw it out and away.

http://wiki.dead-code.org/wakka.php?wakka=IconBased
Title: Re: Icon based dialogues
Post by: The Man on April 15, 2008, 07:21:41 PM
Damn...I don't know what I'm doing...I tried to use this method,but it didn't work...It gives me a lot of errors like:

20:09: CUIWindow::LoadFile failed for file 'windows\dialogueWindow.window'
20:09: Runtime error. Script 'scripts\dialogueObject.script', line 21
20:09:   Call to undefined method 'AttachScript'. Ignored.
20:09: Runtime error. Script 'scripts\dialogueObject.script', line 42
20:09:   Call to undefined method 'CreateButton'. Ignored.
20:09: Runtime error. Script 'scripts\dialogueObject.script', line 46
20:09:   Call to undefined method 'SetImage'. Ignored.
20:09: Runtime error. Script 'scripts\dialogueObject.script', line 47
20:09:   Call to undefined method 'SetHoverImage'. Ignored.
20:09: Runtime error. Script 'scripts\dialogueObject.script', line 42
20:09:   Call to undefined method 'CreateButton'. Ignored.
20:09: Runtime error. Script 'scripts\dialogueObject.script', line 46
20:09:   Call to undefined method 'SetImage'. Ignored.
20:09: Runtime error. Script 'scripts\dialogueObject.script', line 47
20:09:   Call to undefined method 'SetHoverImage'. Ignored.
20:09: Runtime error. Script 'scripts\dialogueObject.script', line 42
20:09:   Call to undefined method 'CreateButton'. Ignored.
20:09: Runtime error. Script 'scripts\dialogueObject.script', line 46
20:09:   Call to undefined method 'SetImage'. Ignored.
20:09: Runtime error. Script 'scripts\dialogueObject.script', line 47
20:09:   Call to undefined method 'SetHoverImage'. Ignored.

And how my entity script should look like?
I could give up and use the standard dialogues method...but I want it!I want the icons!
Help me out...
Title: Re: Icon based dialogues
Post by: metamorphium on April 15, 2008, 07:31:45 PM
seems you don't have any dialogue window file? You need just a simple window which will be used as a container for icons.
Title: Re: Icon based dialogues
Post by: The Man on April 15, 2008, 08:17:26 PM
Yes,I didn't have it! I solved it,but I still don't know how my entity script should look like...
Can you give me a short example?
Title: Re: Icon based dialogues
Post by: The Man on April 16, 2008, 10:59:09 AM
Ehm...no one can give me a help?
Please?
Title: Re: Icon based dialogues
Post by: metamorphium on April 16, 2008, 11:22:04 AM
sorry, I have no clue what do you mean by Entity script?
Title: Re: Icon based dialogues
Post by: The Man on April 16, 2008, 11:31:20 AM
I've got this entity called "venditore",and when I Leftclick on him I want the dialogue to start...I've got no problem with the traditional method,but i dont' know how to implement the icon method...what do I have to write inside "venditore.script"?
Title: Re: Icon based dialogues
Post by: metamorphium on April 16, 2008, 01:02:45 PM
Code: [Select]
[code script]
on "LeftClick"
{

  var your_object  = new Object("scripts\dialogueObject.script");

  your_object.InsertIcon(...);  // supply correct parameters.
  your_object.InsertIcon(...);
  your_object.InsertIcon(...);
  your_object.InsertIcon(...);

  your_object.initializeDialogue(path_to_your_responses_script);


}
Title: Re: Icon based dialogues
Post by: The Man on April 16, 2008, 01:58:23 PM
Ok,it worked...the only problem is that the actor can walk during the dialogue!How can I solve this?
I tried to set Game.Interactive = false; but in this way the player can't choose the dialogue icon!
Sorry for all this problems,but I'm dreaming of creating a Broken Sword Style adventure,and I need this kind of dialogue...
Title: Re: Icon based dialogues
Post by: metamorphium on April 16, 2008, 03:04:23 PM
try modifying the initializeDialogue method in the dialogue object to read:

tmpwin.Visible = true;
tmpwin.GoExclusive();
Title: Re: Icon based dialogues
Post by: The Man on April 16, 2008, 04:03:09 PM
It doesn't seem to work and I really don't know why...I'm starting to give up...
What about a complete step-by-step tutorial for people who doesn't know a thing about scripting in WME like me?
Believe me,for a person who's not so familiar with programming,this procedure is quite difficult...and I'm sure a lot of people would like to use icon based dialogues...Anyway,thanks for your help!
Title: Re: Icon based dialogues
Post by: metamorphium on April 16, 2008, 05:34:04 PM
For people who don't know a thing about scripting is here my online book.

http://res.dead-code.org/doku.php/wmebook:start

Icon based dialogue is not a trivial matter and if you find the code complex, it's time to go "back to the roots" and learn how WME works. ;)

Ps. Optionally if you upload somewhere some minimalistic version of your dialogue project, I'll look what's wrong with it.
Title: Re: Icon based dialogues
Post by: cremen on June 21, 2008, 01:06:33 PM
a little improove for other users:

in the initializeDialogue method at the end
add little command:

Code: [Select]
tmpwin.ApplyEvent("Init");
and in the reactions.script

add "Init" event like this:

Code: [Select]
on "Init"{
dlgObject.insertIcon("first","icon.png","icon.png"); // insert some real image file instead of icon.png
dlgObject.insertIcon("second","icon.png","icon.png"); // insert some real image file instead of icon.png
dlgObject.insertIcon("third","icon.png","icon.png"); // insert some real image file instead of icon.png
}

and then you need to show your dialog, use command like this:
Code: [Select]
dlgObject.initializeDialogue("scripts\reactions.script");
it will be automaticly started.

this method is more usefull, becouse all icon based dialogs by one per file, you may just call
Code: [Select]
dlgObject.initializeDialogue("scripts\dialog1.script");
or
Code: [Select]
dlgObject.initializeDialogue("scripts\dialog3.script");
and all logic in the one file.

thanx for your engine.

P.S. in my project i renamed initializeDialogue to showdialog