Author Topic: TEMPLATE: Text Parser v2.0  (Read 9556 times)

magintz

  • Mittens Knight
  • Just because I rock doesn't mean I'm made of stone
    • I can help with story design
    • I can help with web design
    • magintz worked on one or more games that was nominated for an AGS Award!
TEMPLATE: Text Parser v2.0
« on: 01 Nov 2003, 10:47 »
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 (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
« Last Edit: 07 Sep 2008, 01:07 by magintz »
When I was a little kid we had a sand box. It was a quicksand box. I was an only child... eventually.

Privateer Puddin'

  • Mittens Viscount
  • bob
    • Privateer Puddin' worked on one or more games that won an AGS Award!
    •  
    • Privateer Puddin' worked on one or more games that was nominated for an AGS Award!
Re:Text Parser Template v1.1
« Reply #1 on: 01 Nov 2003, 10:50 »
i'll parse on this one. oh god im lame :P

good work!

Pumaman

  • Creator of AGS
  • Administrator
  • Mittens King
  • I sense danger.
    • Lifetime Achievement Award Winner
    • Pumaman worked on one or more games that won an AGS Award!
    •  
    • Pumaman worked on one or more games that was nominated for an AGS Award!
Re:Text Parser Template v1.1
« Reply #2 on: 03 Nov 2003, 21:26 »
Nice work Magintz, moving to the tech archive :)

Magintz unplugged

  • Guest
Re:Text Parser Template v1.1
« Reply #3 on: 18 Dec 2003, 12:08 »
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

\/ \/ \/ \/ \/ \/ \/ \/

nasos

  • Guest
Re:Text Parser Template v1.1
« Reply #4 on: 18 Jan 2004, 01:25 »
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?

Magintz at school

  • Guest
Re:Text Parser Template v1.1
« Reply #5 on: 20 Jan 2004, 08:51 »
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.

magintz

  • Mittens Knight
  • Just because I rock doesn't mean I'm made of stone
    • I can help with story design
    • I can help with web design
    • magintz worked on one or more games that was nominated for an AGS Award!
Re: Text Parser Template v1.1
« Reply #6 on: 14 Feb 2005, 22:42 »
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.
When I was a little kid we had a sand box. It was a quicksand box. I was an only child... eventually.

monkey0506

  • SEND PIZZA.
    • Best Innovation Award Winner 2017, for his work to help AGS games reach the widest possible audience - through popular distribution platforms (Steam, Galaxy) as well as other operating systems (Android, Linux)
    • monkey0506 worked on one or more games that won an AGS Award!
    •  
    • monkey0506 worked on one or more games that was nominated for an AGS Award!
Re: Text Parser Template v1.1
« Reply #7 on: 15 Feb 2005, 22:47 »
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

Code: [Select]
// 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.
« Last Edit: 15 Feb 2005, 22:50 by monkey_05_06 »

magintz

  • Mittens Knight
  • Just because I rock doesn't mean I'm made of stone
    • I can help with story design
    • I can help with web design
    • magintz worked on one or more games that was nominated for an AGS Award!
Re: Text Parser Template v1.1
« Reply #8 on: 16 Feb 2005, 20:31 »
Thanks for that, but i already have the f3 command implemented into the last version i made
When I was a little kid we had a sand box. It was a quicksand box. I was an only child... eventually.

monkey0506

  • SEND PIZZA.
    • Best Innovation Award Winner 2017, for his work to help AGS games reach the widest possible audience - through popular distribution platforms (Steam, Galaxy) as well as other operating systems (Android, Linux)
    • monkey0506 worked on one or more games that won an AGS Award!
    •  
    • monkey0506 worked on one or more games that was nominated for an AGS Award!
Re: Text Parser Template v1.1
« Reply #9 on: 21 Feb 2005, 00:22 »
Erm... I guess you misunderstood me.  I meant that you could also use the space bar (as suggested) to do the same thing...

Re: TEMPLATE: Text Parser v2.0 (AGS 2.7 Compatible)
« Reply #10 on: 20 Nov 2005, 07:39 »
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'

monkey0506

  • SEND PIZZA.
    • Best Innovation Award Winner 2017, for his work to help AGS games reach the widest possible audience - through popular distribution platforms (Steam, Galaxy) as well as other operating systems (Android, Linux)
    • monkey0506 worked on one or more games that won an AGS Award!
    •  
    • monkey0506 worked on one or more games that was nominated for an AGS Award!
Re: TEMPLATE: Text Parser v2.0 (AGS 2.7 Compatible)
« Reply #11 on: 23 Nov 2005, 07:11 »
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.

Re: TEMPLATE: Text Parser v2.0 (AGS 2.7 Compatible)
« Reply #12 on: 24 Nov 2005, 01:05 »
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.
« Last Edit: 24 Dec 2005, 19:22 by strazer »

monkey0506

  • SEND PIZZA.
    • Best Innovation Award Winner 2017, for his work to help AGS games reach the widest possible audience - through popular distribution platforms (Steam, Galaxy) as well as other operating systems (Android, Linux)
    • monkey0506 worked on one or more games that won an AGS Award!
    •  
    • monkey0506 worked on one or more games that was nominated for an AGS Award!
Re: TEMPLATE: Text Parser v2.0 (AGS 2.7 Compatible)
« Reply #13 on: 26 Nov 2005, 18:42 »
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.

Re: TEMPLATE: Text Parser v2.0
« Reply #14 on: 02 Dec 2007, 07:42 »
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

Rui 'Trovatore' Pires

  • Lunge da lei per me non v'ha diletto!
    • I can help with AGS tutoring
    • I can help with play testing
    • I can help with proof reading
    • I can help with scripting
    • I can help with story design
    • I can help with translating
    • I can help with voice acting
Re: TEMPLATE: Text Parser v2.0
« Reply #15 on: 02 Dec 2007, 20:31 »
Heh. People are still linking to my old Skimbleshanks project. Kewl. ;D
Reach for the moon. Even if you miss, you'll land among the stars.

Kneel. Now.

Never throw chicken at a Leprechaun.

magintz

  • Mittens Knight
  • Just because I rock doesn't mean I'm made of stone
    • I can help with story design
    • I can help with web design
    • magintz worked on one or more games that was nominated for an AGS Award!
Re: TEMPLATE: Text Parser v2.0
« Reply #16 on: 06 Dec 2007, 19:05 »
Wow. People are still using this? I thought somebody made a module far superior to this.

Anyway, thanks Rui for keeping it up.
When I was a little kid we had a sand box. It was a quicksand box. I was an only child... eventually.

Re: TEMPLATE: Text Parser v2.0
« Reply #17 on: 10 Aug 2008, 16:49 »
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. :)
« Last Edit: 11 Aug 2008, 13:11 by Laukku »
You are standing in an open field west of a white house, with a boarded front door.
>WIN GAME
Congratulations! You just won! You got 0 out of 500 points.