GUIOn/GUIOff Help?

Started by Rattrap93955, Tue 02/12/2003 03:04:05

Previous topic - Next topic

Rattrap93955

OK. I'm having a major problem with my text parser. I can get it to parse, but I don't want it on in the Title Screen... Was using this for the script, but am not having any results at all, it just stays on:

function room_a() {
GUIOff(3);
}

Yet, the parser stays on in the Title screen. Did I miss something or what?

What I would really like to do is the old SCI0 parser, where you start to type and it pops up in the middle of the screen and everything pauses... Also, when I do do the AGI version, it doesn't clear when you hit enter....

Could someone explain this to me in plain english? Step by step or something?

Gilbert

#1
Hmmm you have to put that GUIOff() line in the enter room before fade-in interaction of the title room, did you do that?

Please don't triple post, try to stay in one thread.

Rattrap93955

Didn't mean to triple post. Was having trouble with computer for two nights now. Wouldn't connect to the Internet and when it did, everything went it's own way. :(

Rattrap93955

OK. I have a new problem pertaining to the Text Parser... Why doesn't it accept any of the commands that I put in the script for the room, but it will accept all of the commands that have been put into the Global Script? Getting frustrated here. I can get just about anything to work except for the silly parser. :(

Gilbert

Hmmm can you post one of the nonworking portion of codes from the room script here?

Rattrap93955

OK. Here's the broken code:

function room_b() {
 // script for room: Player enters screen (after fadein)
if (Said("look")) {
       Display("You are standing on a very long and very dull beach. The sky is of a dreary grey and the Atlantic continues to lap at the beach.");
     SetTextBoxText(3,1,"");
 }
}

Scorpiorus

I doesn't work because you check the input string only when the player enters the room. When you press the enter key to input a typed command AGS calls interface_click function and that is something you could use.

Try the next implementation:


Main Global Script:


function interface_click(int interface, int button) {

if (interface == GUI_WITH_TEXTBOX_HERE) {

if (button == TEXTBOX_OBJECT_NUMBER_HERE) {

   string input;
   GetTextBoxText (interface, button, input);
   SetTextBoxText (interface, button, "");
   ParseText(input); // start parsing
   string buffer;
   if (SaidUnknownWord (buffer)) Display("You can't use '%s' in this game.", buffer);
   else if (Said("eat apple")) Display("You'd love to, but you don't have one.");
   //.....
   else CallRoomScript (1); // look for room-specific commads

}

}



Room 1 Script


function on_call(int value) {

if (value == 1) //the value we pass via the CallRoomScript(1)

   if (Said("look")) Display("You are standing on a very long and very dull beach. The sky is of a dreary grey and the Atlantic continues to lap at the beach.");

}

}




Room 2 Script


function on_call(int value) {

if (value == 1) //the value we pass via the CallRoomScript(1)

   if (Said("look")) Display("There is nothing to look at");

}

}


Thus you can have different responses for different rooms.


How does it turn out?

~Cheers

SMF spam blocked by CleanTalk