Adventure Game Studio

AGS Support => Modules, Plugins & Tools => Topic started by: magintz on Sat 01/11/2003 10:47:09

Title: TEMPLATE: Text Parser v2.0
Post by: magintz on Sat 01/11/2003 10:47:09
Ever wanted to make yourself a classic Sierra text-based adventure? Well now you can with the new Text Parser Template.
Just put the agt file in the AGS program directory and start a new game to select it.

Version 2.0
This is a completly new reworking hence the jump straight to v2.0. I started fresh from a blank AGS document. This is fully annotated, more concise and easier to learn to use. It also uses the new AGS 2.7 scripting style. This is the earliest version and I still have to re-work some of the more complex stuff like inventory system etc... but it is more than enough to get you going. This is now broken down into 1 room.

Version 1.1
  - Added two rooms with interactions AND annotations
  - Fixed "Get Closer" command when you take key
  - Fixed minor spelling errors
  - Removed the readme as no-one really use's it (annotations were easier)

Have fun

Download here (http://www.lumpcity.co.uk/~skimbleshanks/templates/text_parser_v20.zip) (Thanks Rui)

Just to let everyone know this is old and outdated, you're welcome to use it but I suggest it as just example code to reference and perhaps learn how to do it yourself, either that or check out the enhanced version from Laukku  (http://www.adventuregamestudio.co.uk/yabb/index.php?topic=9435.msg462815#msg462815)
Title: Re:Text Parser Template v1.1
Post by: Privateer Puddin' on Sat 01/11/2003 10:50:58
i'll parse on this one. oh god im lame :P

good work!
Title: Re:Text Parser Template v1.1
Post by: Pumaman on Mon 03/11/2003 21:26:53
Nice work Magintz, moving to the tech archive :)
Title: Re:Text Parser Template v1.1
Post by: on Thu 18/12/2003 12:08:24
I've been thinking about my next update, I'm guessing I should try to add some more features, I also added the F3 command which is able to recall the last thing typed, forgot to mention that above.

I will add some extra functions such as speach using a parser.... mebe....


watch this space

\/ \/ \/ \/ \/ \/ \/ \/
Title: Re:Text Parser Template v1.1
Post by: on Sun 18/01/2004 01:25:56
Very, very useful template. By the way, is there a way to have the parser box hidden, and shown only when the user starts typing (as in Larry 2, Space Quest 3, and Conquests of Camelot)? If so, is there is also a way to hit space and see the last command typed already shown in the box?
Title: Re:Text Parser Template v1.1
Post by: on Tue 20/01/2004 08:51:44
I'll get implementing that as a new feature so it only appears when you start typing, could be tricky, but i'll have to see.

As for the last line to be repeated, that is implemented with the F3 command as in the classic Sierra style games; not sure about the space command tho? that could be tricky as it would have to detect the first character in the parser box being a space, i know the basic theory behind this but have never implemented anything like it in AGS.
Title: Re: Text Parser Template v1.1
Post by: magintz on Mon 14/02/2005 22:42:08
I know I've been promising an update, but I now promise to get three new versions out by easter.

Versions 1 will contain the template, thats it.
Version 2 will contain a demo game to explain everything.
Version 3 (still in concept) will be completley different. It will contain a form of Artificial-Artifical Intelligence and will pick up on certain words and grammar points such as questions, store items in selection of strings and reply back e.g:

What is your name
tell me your name
i would like to know your name
what do people call you

would all respond the same, and the system would also learn, if you told it your name it would look for key features such as name and my etc... and store into a database "name", and next time you were to interact it could respond back with "it was Magintz, wasn't it".

To begin with it will start by learning names, dates and other important information and maybe branch off.
Title: Re: Text Parser Template v1.1
Post by: monkey0506 on Tue 15/02/2005 22:47:11
In regards to the "F3" thing.Ã,  I don't believe (and yes, I've looked) that this is AGS implemented, but rather your own implementation (as in on_key_press) (I assume that if I am wrong I will be corrected).Ã,  So (assuming that I am indeed correct), something like

// on_key_press
else if (keycode == 32) {
Ã,  // turn on text parser
  string buffer;
  GetTextBoxText(GUINAME, OBJECTNUM, buffer);
  if (StrComp(buffer, "") == 0) keycode = 'F3'; // 'F3' may have to be replaced with its respective numerical value, I'm not sure
Ã,  }
else if (keycode == F3) {
Ã,  // stuff
Ã,  }


Assuming that I didn't miss something about F3 being handled by AGS (please let me know if I did), something like this should work.

EDIT: Oops! I forgot something. Code updated.
Title: Re: Text Parser Template v1.1
Post by: magintz on Wed 16/02/2005 20:31:35
Thanks for that, but i already have the f3 command implemented into the last version i made
Title: Re: Text Parser Template v1.1
Post by: monkey0506 on Mon 21/02/2005 00:22:00
Erm... I guess you misunderstood me.  I meant that you could also use the space bar (as suggested) to do the same thing...
Title: Re: TEMPLATE: Text Parser v2.0 (AGS 2.7 Compatible)
Post by: mkennedy on Sun 20/11/2005 07:39:15
When I try to make a new game with the template I get an error message saying:

There was an error compiling your script. The problem was:
In: 'Global script'

Error (line 83):  Undefined token 'Parser'
Title: Re: TEMPLATE: Text Parser v2.0 (AGS 2.7 Compatible)
Post by: monkey0506 on Wed 23/11/2005 07:11:40
Hmmm...Parser is a keyword of AGS 2.7+.  So unless you have 2.62 or earlier (or even a pre-OO-2.7 BETA) then it shouldn't have anything to do with the template...check your version of AGS.
Title: Re: TEMPLATE: Text Parser v2.0 (AGS 2.7 Compatible)
Post by: mkennedy on Thu 24/11/2005 01:05:06
That was my first thought, But I checked and I'm using the latest 2.7.  I have not tried 2.71 yet though.

Edit:

I downloaded 2.71 and got it to work using that. I hope to be able to use the text parser and expand upon it.
Title: Re: TEMPLATE: Text Parser v2.0 (AGS 2.7 Compatible)
Post by: monkey0506 on Sat 26/11/2005 18:42:36
Well...at least you got it fixed.  I still have no idea what the problem might have been, but you may want to PM magintz just to let him know that you got the problem worked out.
Title: Re: TEMPLATE: Text Parser v2.0
Post by: Blu Aardvark on Sun 02/12/2007 07:42:50
It seems that the download link in the first post is no longer working.  Of course, I didn't bump this thread just to say that...

For the benefit of anyone else who happens to be searching the forums for a text parser module and stumbles upon this thread, I found another copy of this template (version 2.0, yes). You can download it here (http://www.lumpcity.co.uk/~skimbleshanks/templates/text_parser_v20.zip)
Title: Re: TEMPLATE: Text Parser v2.0
Post by: Rui 'Trovatore' Pires on Sun 02/12/2007 20:31:21
Heh. People are still linking to my old Skimbleshanks project. Kewl. ;D
Title: Re: TEMPLATE: Text Parser v2.0
Post by: magintz on Thu 06/12/2007 19:05:10
Wow. People are still using this? I thought somebody made a module far superior to this.

Anyway, thanks Rui for keeping it up.
Title: Re: TEMPLATE: Text Parser v2.0
Post by: Laukku on Sun 10/08/2008 16:49:43
Quote from: magintz on Thu 06/12/2007 19:05:10
Wow. People are still using this? I thought somebody made a module far superior to this.

It seems that nobody did, but that is no longer true. Lo and behold,

Text Parser enhanced

Basically an improved version of Texr Parser v2.0. Because no one had made a better one and Text Parser v2.0 was clumsy (having to put txtParser=""; after every single command? Seriously??), I decided to improve it by myself. Here are some improvements since Text Parser v2.0:

-parser GUI pops up and pauses the game automatically when the player starts typing
-NoMatch() function for generic "that doesn't work" responses
-a text-based inventory (read-only)
-inventory item closeup GUI for look commands (if you don't want it, you can easily remove it)
-"it" feature: You can type "look apple", then "take it" and the parser still understands it. Does not currently work for commands like "throw it at the bird", though.
-simplified scripts and fixed some bugs
-and many small things I've forgotten.

It even surpasses Trilby's Notes. It's made in 2.72, but it should work in AGS 3.0.2 SP1, too.

EDIT: I've improved it even more. It now includes a default "Really restart?" GUI, an easy-to-use ShowInvCloseup function, and bug fixes. Hopefully I figured out the correct reason for the sprite 0 bug. Post a message if you find bugs.
Get it here:
http://www.mediafire.com/download.php?jcy1nkmffx3
Enjoy. :)