Do you miss the old adventures? Create a Parser system!!!

This forum is meant for people to share their knowledge by writing their own tutorials for Adventure Maker.

Moderators: time-killer-games, Vengeance66, Candle, reneuend, GM-Support

Do you miss the old adventures? Create a Parser system!!!

Postby Lyberodoggy » Wed Feb 27, 2008 6:58 pm

Okay, here's another of my tutorials.
It's quite simple to create a parser system (well, kind of it).


You must go to the first frame of your game (not the menus or the vids. The very first frame the player has to act) and add this line of code:
Code: Select all
LoadControl TextboxObject(1)
TextBoxObject(1).Move 12*15,446*15,300*28,30*15
TextBoxObject(1).Visible = True

Remember that the coordinates used here are for 640x480 resolution. Alter them in order to fit to your project. The parser must be on the lowest side of the frame and cover it all along except for a little part, where a button will be placed.
Create a hotspot and use an image to project it (remember to create this hotspot in every frame your parser appears). This will be used to store the value of the TextBoxObject. Go to its "Advanced Tab" and add some code depending on what you want the player to do in your frame
Use the "Select case" command to check the text of the parser and use the "lcase" function to make every text typed lower case:
Code: Select all
Select case
 case lcase(TextBoxObject(1).Text)="take item","get item","every_possible_variation"
 If Item_name=0 Then
 Action.AddItem "Item_name"
 End If
 case lcase(TextBoxObject(1).Text)="..."
//etc
 End Select
 TextBoxObject(1).Text=""
//Don't forget this last line to clean up the textbox

You can even tell the player the command doesn't exist using "else case"
Another thing you can do is add save/load and exit commands:
Code: Select all
Select case
 case lcase(TextBoxObject(1).Text)="save","save game"
 Action.PopupSaveGame
 case lcase(TextBoxObject(1).Text)="load","load game"
 Action.PopupLoadGame
 case lcase(TextBoxObject(1).Text)="exit","exit game","quit","quit game"
 MsgBox "Goodbye"
 Action.Quit
 End Select
 

You will need to use
Code: Select all
unloadControl TextboxObject(1)
If you don't want the parser to appear in a frame (like a cutscene)

Hope you liked it...
Attachments
parser.rar
A sample project
(156.4 KiB) Downloaded 581 times
parser1.JPG
parser1.JPG (21.25 KiB) Viewed 14017 times
parser2.JPG
parser2.JPG (47.26 KiB) Viewed 14017 times
User avatar
Lyberodoggy
Administrator
 
Posts: 2526
Joined: Sat Feb 17, 2007 3:31 pm
Location: Athens

Postby GM-Support » Wed Feb 27, 2008 7:20 pm

Very nice Lyberodoggy!

Great job.

Did you consider using the Plugins System of AM for packaging the code so that the users don't even have to write a line of code?

I am sure you would be really good at creating plugins! If you create new plugins, they will appear on the Plugins page together with credits and links to your website, and they may become very popular!

More info on how to create plugins can be found here (c.f. question 6 and its links). Just let me know if you have any questions concerning the plugins, I am here to help.

GM-Support
GM-Support
Forum Admin and Games Page admin
 
Posts: 2221
Joined: Thu Jun 05, 2003 7:52 pm

Postby Lyberodoggy » Wed Feb 27, 2008 7:28 pm

Thanks GM, I will consider creating some plugins... Although it's gonna be difficult.
User avatar
Lyberodoggy
Administrator
 
Posts: 2526
Joined: Sat Feb 17, 2007 3:31 pm
Location: Athens

Postby Lyberodoggy » Sat Mar 01, 2008 7:32 pm

User avatar
Lyberodoggy
Administrator
 
Posts: 2526
Joined: Sat Feb 17, 2007 3:31 pm
Location: Athens

Postby Candle » Sat Mar 01, 2008 8:03 pm

So what it does is have the users type the command they want to do like "look here" Pickup fork" etc ?
Sorry for me being so dumb. lol
Please don't PM me questions, ask here in the forums!
``````````````
Between grand theft and a legal fee, there only stands a law degree.
User avatar
Candle
Administrator
 
Posts: 3077
Joined: Sat Feb 07, 2004 2:21 am
Location: Rudy's Bar

Postby Lyberodoggy » Sat Mar 01, 2008 10:11 pm

Excuse me for not describing the features here but they are already described in the plugin's page and the plugins description.
The answer to your question is curently no, but you can use commands like save, load, quit and take item without any scripting. Just go to the plugin tab of a hotspot in your frame and make it the parser button. Then if you want to add more commands, just type the code you want following
this tutorial in the advanced tab of the same hotspot.

If you have any other questions, feel free to ask...
User avatar
Lyberodoggy
Administrator
 
Posts: 2526
Joined: Sat Feb 17, 2007 3:31 pm
Location: Athens

Postby Candle » Sat Mar 01, 2008 10:51 pm

I guess i don't know what it is.
maybe someone will spell it out for me . lol
Please don't PM me questions, ask here in the forums!
``````````````
Between grand theft and a legal fee, there only stands a law degree.
User avatar
Candle
Administrator
 
Posts: 3077
Joined: Sat Feb 07, 2004 2:21 am
Location: Rudy's Bar

Postby Lyberodoggy » Sat Mar 01, 2008 11:22 pm

What don't you know? How to use it or what your question is? I 'm kinda confused here :roll:
User avatar
Lyberodoggy
Administrator
 
Posts: 2526
Joined: Sat Feb 17, 2007 3:31 pm
Location: Athens

Postby Chromegloss55 » Tue Mar 04, 2008 8:36 pm

The parser system idea was fantastic. (Totally off-the-point, I know)

Its great to see somebody with so many fresh ideas on the forums...
_________________
Bolivian Forum
Last edited by Chromegloss55 on Tue Feb 24, 2009 3:12 pm, edited 1 time in total.
Chromegloss55
Forum Master
 
Posts: 630
Joined: Sat Nov 03, 2007 2:49 pm
Location: God Knows!

Postby Lyberodoggy » Tue Mar 04, 2008 8:42 pm

Thanks
User avatar
Lyberodoggy
Administrator
 
Posts: 2526
Joined: Sat Feb 17, 2007 3:31 pm
Location: Athens

Postby Chromegloss55 » Tue Mar 04, 2008 8:45 pm

You seem to know Visual Basic very well. How long have you been using it...

Have you ever worked with one of the C languages, HTML or XML.
_________________
economy predictions
Last edited by Chromegloss55 on Tue Feb 24, 2009 3:12 pm, edited 1 time in total.
Chromegloss55
Forum Master
 
Posts: 630
Joined: Sat Nov 03, 2007 2:49 pm
Location: God Knows!

Postby Lyberodoggy » Tue Mar 04, 2008 8:49 pm

I 've been using VB and VBS since 2007 :P
I 've read a book for VB and learned everything else while practicing
Currently reading Deitel's and Deitel's Programming in C
I 've worked in HTML, can't say I like it very much :P. I usually use ready apps to create sites. But I can debug a simple html file and create my own if needed.
User avatar
Lyberodoggy
Administrator
 
Posts: 2526
Joined: Sat Feb 17, 2007 3:31 pm
Location: Athens

Postby Chromegloss55 » Tue Mar 04, 2008 8:57 pm

That's quite a lot. I started a few years ago and learned most of it by practise. I only read one book on how to script and that was it. I don't find books that helpful, the way you learn is by doing. :D

(Or maybe that's just me)

Co-incidently, that was when I started learning Spanish.

Enjoy programming in C, it is a completely different kettle of fish! If you're looking a becoming at programmer, then also make sure to brush up on XML, because it seems to be all the rage at the moment.
_________________
Miscarriage / Still Birth Forum
Last edited by Chromegloss55 on Tue Feb 24, 2009 3:13 pm, edited 1 time in total.
Chromegloss55
Forum Master
 
Posts: 630
Joined: Sat Nov 03, 2007 2:49 pm
Location: God Knows!

Postby mercedes » Wed Jul 23, 2008 1:05 am

Sorry if I am bumping post here..but..

I have looked at this..as well as the parser plug in..but I want to understand it before I download it..

So I gather that a Parser is a "Textbox"..?..This is where I'm a bit lost..I don't know what a Parser is..LOL..:oops:

I understand how this works...I think..I assume the user can type whatever u have in the code into textbox..save game..use item..add item..>>will put it in inventory..

So does this mean the variables have to be created as well..or are they in the code..EX.. use_item take_item..and so on..

As for Save, Load,Exit and such.. will the menu have to be disabled on right click..or will that work also?

From what it looks like..there is no point and clicking involved with this? Only typing..into textbox?


Sorry If i sound stupid..just I want to know if I can use this or not..like if it will be useful in one of my projects..Looks really interesting..!~


Many Thanks Kid~!
User avatar
mercedes
VIP
 
Posts: 2460
Joined: Sun Mar 09, 2008 10:43 pm
Location: Canada..~

Postby Lyberodoggy » Thu Jul 24, 2008 5:49 pm

A parser is what the... ancestors of today's adventures used to communicate with the user.


Using and tweaking the plugin you can send messages to the player and make him think what is the right word to type.

You could use it for custom dialogues too, using keywords in it, but that would take a custom dialogue engine too.

There are no variables for taking or using items. It uses the normal AM inventory.

You can keep the point & click part if you want to. That's why I added the option to disable the parser in some frames. You can keep the right click menu too..
User avatar
Lyberodoggy
Administrator
 
Posts: 2526
Joined: Sat Feb 17, 2007 3:31 pm
Location: Athens

Postby marxdarx » Tue Oct 20, 2009 4:37 pm

I can really imagine some good uses for this. For instance, when you need to repeat a password to a guard to let him in..you just type it in1 and the guard moves aside..very good idea

it may have been the old school way(You have been eaten by a grue! lol) to move around, but now we can use it in subtle ways to enhance the experience thanks!
"There is no limit to what a person can do if they just DO IT" - marxdarx
marxdarx
New Member
 
Posts: 4
Joined: Tue Oct 20, 2009 2:55 pm

Postby Lyberodoggy » Tue Oct 20, 2009 9:54 pm

You are welcome!
User avatar
Lyberodoggy
Administrator
 
Posts: 2526
Joined: Sat Feb 17, 2007 3:31 pm
Location: Athens


Return to Post Your Own Tutorials

Who is online

Users browsing this forum: No registered users and 0 guests

cron