Please login or register.

Login with username, password and session length
Advanced search  

News:

Forum rules - please read before posting, it can save you a lot of time.

Author Topic: WME text/script questions (implementing text/ text analysis)  (Read 2944 times)

0 Members and 1 Guest are viewing this topic.

Arathel

  • Lurker
  • *
  • Karma: 0
  • Offline Offline
  • Posts: 9
    • View Profile
WME text/script questions (implementing text/ text analysis)
« on: April 25, 2009, 06:37:35 AM »

Hello :D My fellow WME forumers, I am in need of your wisdom.

My adventure will include chat sequences. I already asked on the IRC forum and they said it's possible, so I am posting this here to get some help how the heck I should script something like that :D lol Ok, here's a picture explaining what I want to do:



blabla messages user. (this is easy again, like after player has done X start Y, Y being the chat window). blabla says 'hey hi :D' . Text will be displays in the new window. Now it's the players turn to write blabla back. Depending on what the user is writing (must me one of choices below or the new events (messages form blabla won't trigger), blabla's answers are different. Player inputs text in the text box show on the pictures and hit enter or clicks on the 'send' button:

User input:
If "* Hi* *" goto blablaresponse2 print: 'how are you'
If "* I* * busy *" goto blablaresponse3 print: 'what are you doing? :O'
If "* Hi* * how are *" blablaresponse4 print: 'I am fine matey, and you?'

* are wildcards. E.g. "yo yo hi - how are you?" would trigger blablaresponse4.

Player clicks on the 'Log' button. This will open a new window, containing the whole discussion the player had with the npc. It should not only log blabla's text, but also the player input (I think we can compare this with the text log feature some adventure have, were you can check older conversations with NPCs. Should not be hard for this project - if it weren't for the player input and different responses an 'npc' can give.).

There was no example on the wiki about that. While it's possible to add novel-like text to your adventure (user asuka has done this, so I'd quite hapy if you'd response to this post :D), I wonder how about to script user input, and especially, how to trigger the various replies based on it AND logging this stuff.

Before I start on the real adventure, I am working on a test demo where I try out various ideas. I will try my luck on this problem today and upload a test build as soon as I figured something out.

PS: I remember that something similiar has been done with the AGS (or something like that) Engine once. The game itself  was limited to a chat window though.


EDIT: Basic Test Windows ready.
« Last Edit: April 25, 2009, 09:09:24 AM by Arathel »
Logged
If it\'s dark, it\'s dark.

madtom

  • Lurker
  • *
  • Karma: 0
  • Offline Offline
  • Posts: 6
    • View Profile
Re: WME text/script questions (implementing text/ text analysis)
« Reply #1 on: April 26, 2009, 03:24:13 PM »

This is an interesting problem. I'll post my solutions to dealing with editor input here in case it's of any help.

From the Window object containing the editor control:
Code: WME Script
  1. //inputbar and inputline are declared elsewhere in base.inc
  2. //though I guess they could be attached or dealt with in a variety of other ways
  3. //inputbar is the editor control itself, while inputline is the variable used to save/evaluate user input
  4.  
  5. inputbar = QuestionDisplay.GetControl("inputbar");
  6. inputbar.Interactive = true;
  7. inputbar.CursorChar = "|";
  8. inputbar.MaxLength = 12;
  9.  
  10. on "LeftClick"
  11. {
  12.  
  13. this.Focus();
  14. }
  15.  
  16. on "Keypress"
  17. {
  18.   //If return is pressed and the input bar isn't empty
  19.    if(Keyboard.KeyCode==VK_RETURN && inputbar.Text != "")
  20.         {
  21.         //save user input in the inputline variable
  22.     inputline = inputbar.Text;
  23.        
  24.         //note user input for debugging
  25.         Game.Msg(inputline);
  26.        
  27.         PCStatus.Moniker = (inputline);
  28.        
  29.         //Change the Status window text to reflect the new PC Moniker
  30.         StatusName.Text = "Name: "+ToString(PCStatus.Moniker);
  31.         Narrate("Press Submit when you are content with your choices.");
  32.        
  33.         }
  34.        
  35.         //In case enter is pressed when the inputline is empty
  36.         else if(Keyboard.KeyCode==VK_RETURN && inputbar.Text == "")
  37.         {
  38.                 Game.Msg("Inputline is empty.");
  39.                 }
  40. }


The other questions surely require some pondering. I think you'll be working with ways of evaluating strings (to tell what the user typed) and reprinting things on a separate window used for the active conversation histories. Anyway, hope this is of some use to you as is.
Logged

Akusa

  • Lurker
  • *
  • Karma: 0
  • Offline Offline
  • Posts: 46
    • View Profile
Re: WME text/script questions (implementing text/ text analysis)
« Reply #2 on: April 26, 2009, 06:45:29 PM »

for your log system, that would be really easy.
simply create a text file and let WME write your strings into the text file. If you want to see you log ingame, just read the text file with WME and let them draw on your screen. It should not be very hard. The biggest problem will be scrolling the log but you can just use a modified version of WMEs save and load menu script.
for a text parser: There are books and papers out there how to write and design a text parser. Its not hard but requires some knowledge of programming but your biggest concern will be to have a parser that have enough power to answer your questions and here the real work starts.
You could research a little bit about chat bots and how they are organized. Maybe you also can find some free interpreter and hook it with wintermute per dll.
http://www.alicebot.org/aiml.html for example is famous for its good results and easy to learn chat database organization.

But personally i would stay away from something if its just a gimmick and not gameplay relevant. There is some reason why today no one uses chat-bots in games and game companies like Bethesta, BioWare and Obsidian still use more or less traditional dialog systems.
Logged

Arathel

  • Lurker
  • *
  • Karma: 0
  • Offline Offline
  • Posts: 9
    • View Profile
Re: WME text/script questions (implementing text/ text analysis)
« Reply #3 on: May 06, 2009, 11:23:33 PM »

its a major feature for the game. 1/3 of the game will be chat conversations. Since I will point the player into the right direction about what to ask all the time, the text parsing should be easy (less keywords, the player will be warned by the character when he entered a sentence with no matching keywords (e.g. 'I should rephrase my question')).

I really don't want to refrain to multiple choice input. This would make the game too easy and it would feel less interactive. I want to create the illusion that the character ingame is sitting in front of a machine, almost identical to the actual player.

Thank you madtom and Akusa for the help. I'll look further into this problem. As I said before, a mutliple choice system would be the last resort. It just wouldn't fit in the game if a box with 3dialogue choices would pop up out of nowhere all of a sudden...
« Last Edit: May 06, 2009, 11:27:43 PM by Arathel »
Logged
If it\'s dark, it\'s dark.
 

Page created in 0.283 seconds with 23 queries.