Text Parser Scripting: Can't figure out what the manual says!

Started by Ytterbium, Sat 01/11/2003 19:44:48

Previous topic - Next topic

Ytterbium

I checked the manual for how to script a text parser. The text box is on GUI 0, object 0, and I want it to move the character to an object and pick it up when they player types "Get key." But it has a problem with the first line, and won't compile it. Here's what I have in the room script:

function interface_click (0,0)
 string input;
 GetTextBoxText (0, 0, input);
 ParseText (input);
 if (Said ("get,take key"));
 MoveCharacter (0, 302, 123);
 ObjectOff (0);
 AddInventory (1);

It seems to have a problem with the function line. What am I supposed to do, exactly? I can't find anyplace with a complete text parser script example.


Currently in production: Septigon

Scummbuddy

function interface_click (0,0)
 string input;
 GetTextBoxText (0, 0, input);
 ParseText (input);
 if (Said ("get,take key"));  <------ take out this semicolon
{     <---- add this brace  
MoveCharacter (0, 302, 123);
 ObjectOff (0);
 AddInventory (1);
}    <----- add this closing brace
- Oh great, I'm stuck in colonial times, tentacles are taking over the world, and now the toilets backing up.
- No, I mean it's really STUCK. Like adventure-game stuck.
-Hoagie from DOTT

Ytterbium

I tried that. It says "Error (line 2): PE03: Parse error at '0.'"

Line 2 is where the "function" is.

Currently in production: Septigon

Ishmael

function interface_click (int interface, int button) { <--- this...
if ((interface == 0) && (button == 0)) { <--- ...this...
string input;
GetTextBoxText (0, 0, input);
ParseText (input);
if (Said ("get,take key")); <------ take out this semicolon
{ <---- add this brace
MoveCharacter (0, 302, 123);
ObjectOff (0);
AddInventory (1);
} <----- add this closing brace
}
} <--- and these


?
I used to make games but then I took an IRC in the knee.

<Calin> Ishmael looks awesome all the time
\( Ö)/ ¬(Ö ) | Ja minähän en keskellä kirkasta päivää lähden minnekään juoksentelemaan ilman housuja.

Ytterbium

Thanks. The script compiled. There's just one problem...when I type something in and press enter, nothing happens! I don't know what to do! Maybe it's a bug with Windows XP, or maybe I have to do something else...

The GUI has a text box, which is object 0 on GUI 1 (I changed it because I thought the GUI 0 was interfering, but I was wrong). I bound the text box to the script, yet, pressing return does nothing!

Currently in production: Septigon

Ishmael

function interface_click (int interface, int button) {
if ((interface == 1) && (button == 0)) {
string input;
GetTextBoxText (0, 0, input);
ParseText (input);
if (Said ("get,take key"));
{
MoveCharacter (0, 302, 123);
ObjectOff (0);
AddInventory (1);
}
}
}
I used to make games but then I took an IRC in the knee.

<Calin> Ishmael looks awesome all the time
\( Ö)/ ¬(Ö ) | Ja minähän en keskellä kirkasta päivää lähden minnekään juoksentelemaan ilman housuja.

Ytterbium

Quote from: TK on Sun 02/11/2003 18:28:00
function interface_click (int interface, int button) {
if ((interface == 1) && (button == 0)) {
string input;
GetTextBoxText (0, 0, input);
ParseText (input);
if (Said ("get,take key"));
{
MoveCharacter (0, 302, 123);
ObjectOff (0);
AddInventory (1);
}
}
}


That's exactly what I have. Do I need to put something in the global script? That might be my problem...

EDIT: Yes, I did. I was supposed to use an on_call script in the room. Not an interface_click. The interface_click is in my global script, thanks to this thread:
http://www.agsforums.com/yabb/index.php?board=2;action=display;threadid=9435

and it works! There's one problem...how do I make it so that the key doesn't disappear until the character has moved? I can do this with the interaction editor (wait until move to finish), but since the text parser can't perform interactions, I need to use scripts. Unfortunately, it doesn't tell me what script to use to get it to wait.

EDIT: Never mind, I read the f***king manual.

Currently in production: Septigon

SMF spam blocked by CleanTalk