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)
Hope you liked it...