Need help with Text parser

Started by arthur.com, Sun 22/04/2007 15:48:30

Previous topic - Next topic

arthur.com

Could someone make a tutorial how do i make text phraser?
Including GUI,scripts and evereything.
If it's a crime to like pokemon video games -arest me!

Akatosh

There's one in the manual. Just search for 'Text Parser'.

Khris

To get you started, here's the on_key_press-code I wrote once.
Add a GUI, name it "PARSER".
Put a textbox on it, name it "command".

Code: ags
String oldline;
String newline;

#sectionstart on_key_press  // DO NOT EDIT OR REMOVE THIS LINE
function on_key_press(int keycode) {
  // called when a key is pressed. keycode holds the key's ASCII code

  // standard AGS keypress stuff here
  
  // parser
  if (keycode==361 && oldline!=null) { // F3
    command.Text=oldline;
    gParser.Visible=true;
  }
  if (keycode==8 && command.Text=="") { // Delete (when empty)
    gParser.Visible=false;
  }
  if (keycode>=65 && keycode<=122 && gParser.Visible==false) { // show box after keypress
    if (keycode<=90 && IsKeyPressed(403)==0 && IsKeyPressed(404)==0) keycode=keycode+32; // shift?
    gParser.Visible=true;
    newline="";
    command.Text=newline.AppendChar(keycode);
  }
}
#sectionend on_key_press  // DO NOT EDIT OR REMOVE THIS LINE

arthur.com

#3
Thanks.
I really need the text parser because a GUI would be too small for all the options
(STARWARS sim game)

EDIT:
umm.....where EXACTLY do i have to write that? ???


Edit by Ashen: Don't double post.
If it's a crime to like pokemon video games -arest me!

Khris

Menu: Script -> on_key_press
Now extend the existing function until it looks like the code above.
(Don't delete the contents inside, leave it where I wrote "// standard AGS keypress stuff here").

SMF spam blocked by CleanTalk