TEMPLATE: Text Parser v2.0

Started by magintz, Sat 01/11/2003 10:47:09

Previous topic - Next topic

magintz

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
When I was a little kid we had a sand box. It was a quicksand box. I was an only child... eventually.

Privateer Puddin'

i'll parse on this one. oh god im lame :P

good work!

Pumaman

Nice work Magintz, moving to the tech archive :)

Magintz unplugged

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

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

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

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

#7
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: ags
// 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.

magintz

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

Erm... I guess you misunderstood me.  I meant that you could also use the space bar (as suggested) to do the same thing...

mkennedy

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

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.

mkennedy

#12
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.

monkey0506

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.

Blu Aardvark

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

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

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.

Laukku

#17
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. :)
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.

SMF spam blocked by CleanTalk