Adventure Game Studio

AGS Support => Beginners' Technical Questions => Topic started by: Estaog on Mon 28/06/2004 14:47:37

Title: Dialog run-script
Post by: Estaog on Mon 28/06/2004 14:47:37
I did this script in the biggining of the dialog:
@S  // dialog startup entry point
run-script 51
Cow: Hello
bla: Hi
return

And the script goes like this:
........
      else if (value == 51) {
      MoveCharacterBlocking (1,138,116,0);
      FaceCharacter (1,3);
      FaceCharacter (3,1);
      GUIOff (1);
      GUIOn (2);
      }
.....

The problem is it is not running a script. Now i jumped from 10 to 51.Maybe thats the problem?

Also i am having a problem with setcharacterignore walkbehing (1,1). I wanted him to ignore a walkbehind but now everything is appearing before him. Help?
Title: Re: Dialog run-script
Post by: Gilbert on Tue 29/06/2004 02:23:02
hmmm as we cant see the whole of the dialog request code we cant judge, it can be many possibilities, some of which:
1. You're actually not using a variable by the name value to be parsed to the function, but something instead, eg. function dialog_request(int option);
2. There're some scripting problem preventing the "else if (value=51)" to be executed, you may check the braces, etc.

For the walkbehind problem, are you sure that character's id was indeed 1? Better use the script name instead (EGO, etc. that you can define in the editor), that's more recommended.
Title: Re: Dialog run-script
Post by: Ashen on Tue 29/06/2004 12:51:54
About the walkbehind:
SetCharacterIgnoreWalkbehinds tells the character to igonre ALL walkbehinds, not just a specific one, which seem to be what you want. Perhaps you could use SetWalkBehindBase to 'turn off' the walkbehind you want?
Title: Re: Dialog run-script
Post by: Estaog on Tue 29/06/2004 14:43:19
function dialog_request(int value) {

Ã,  Ã, if (value == 1) {
Ã,  Ã,  Ã, MoveCharacterBlocking (1,182,160,0);
Ã,  Ã,  Ã, FaceLocation (1,168,33);
Ã,  Ã,  Ã, GUIOff (1);
Ã,  Ã,  Ã, GUIOn (2);
Ã,  Ã, }
Ã,  Ã, else if (value == 2) {
Ã,  Ã,  Ã, if (money==0) {
Ã,  Ã,  Ã, DisplaySpeech (4, "Sorry you dont have enough money.");
Ã,  Ã,  Ã, }
Ã,  Ã,  Ã, if (money==1) {}
Ã,  Ã,  Ã, }
Ã,  Ã,  else if (value == 3) {
Ã,  Ã,  Ã,  GUIOff (2);
Ã,  Ã,  Ã,  GUIOn (0);
Ã,  Ã,  Ã,  }
Ã,  Ã,  Ã, else if (value == 4) {
Ã,  Ã,  Ã, FaceLocation (7,242,85);
Ã,  Ã,  Ã, Wait (80);
Ã,  Ã,  Ã, FaceLocation (7,255,199);
Ã,  Ã,  Ã, }
Ã,  Ã,  Ã, else if (value == 5) {
Ã,  Ã,  Ã, MoveCharacterBlocking (1,276,175,0);
Ã,  Ã,  Ã, FaceCharacter (1,7);
Ã,  Ã,  Ã, FaceCharacter (7,1);
Ã,  Ã,  Ã, GUIOff (0);
Ã,  Ã,  Ã, GUIOn (2);
Ã,  Ã,  Ã, }
Ã,  Ã,  Ã, else if (value == 6) {
Ã,  Ã,  Ã, GUIOff (2);
Ã,  Ã,  Ã, GUIOn (0);Ã, 
Ã,  Ã,  Ã, }
Ã,  Ã,  Ã, else if (value == 7) {
Ã,  Ã,  Ã,  Ã, if (money2==0) {}
Ã,  Ã,  Ã,  Ã, else if (money2==1) {
Ã,  Ã,  Ã,  Ã,  Ã, SetDialogOption (2,5,1);
Ã,  Ã,  Ã,  Ã,  Ã, }
Ã,  Ã,  Ã,  Ã, else if (value==8) {
Ã,  Ã,  Ã,  Ã,  Ã, if (character[1].inv[26]) {
Ã,  Ã,  Ã,  Ã,  Ã,  Ã,  SetDialogOption (2,8,1);
Ã,  Ã,  Ã,  Ã,  Ã,  Ã,  }
Ã,  Ã,  Ã,  else if (value == 10) {
Ã,  Ã,  Ã,  Ã,  LoseInventory (3);
Ã,  Ã,  Ã,  Ã,  AddInventory (8);
Ã,  Ã,  Ã,  Ã,  Ã, }
Ã,  Ã,  Ã,  Ã, }
Ã,  Ã,  Ã,  else if (value == 10) {
Ã,  Ã,  Ã,  Ã,  LoseInventory (26);
Ã,  Ã,  Ã,  Ã,  }
Ã,  Ã,  Ã,  else if (value == 30) {
Ã,  Ã,  Ã,  Ã,  NewRoomEx (1,66,155);
Ã,  Ã,  Ã,  Ã,  character [3].room=4;
Ã,  Ã,  Ã,  Ã,  character[3].x=27;
Ã,  Ã,  Ã,  Ã,  character[3].y=155;
Ã,  Ã,  Ã,  Ã,  scal=1;
Ã,  Ã,  Ã,  Ã,  }
Ã,  Ã,  Ã,  else if (value == 51) {
Ã,  Ã,  Ã,  MoveCharacterBlocking (1,138,116,0);
Ã,  Ã,  Ã,  FaceCharacter (1,3);
Ã,  Ã,  Ã,  FaceCharacter (3,1);
Ã,  Ã,  Ã,  GUIOff (1);
Ã,  Ã,  Ã,  GUIOn (2);
Ã,  Ã,  Ã,  }
Ã,  Ã,  Ã,  else if (value== 48) {
Ã,  Ã,  Ã,  GUIOff (2);
Ã,  Ã,  Ã,  GUIOn (1);
}Ã,  Ã, 
}
}
Thats the whole script, can you see anything wrong with it?
Title: Re: Dialog run-script
Post by: Wolfgang Abenteuer on Wed 30/06/2004 00:48:47
It looks to me, after matching up all of your brackets, that everything is encompassed within the else if (value == 7) { conditional, so any value after that won't ever get executed.Ã,  Try deleting one of the three brackets at the very end of the dialog_request script and putting it in the line above the else if (value == 8){ line instead and see if that fixes it.

Edit: Damn smilies...

~Wolfgang
Title: Re: Dialog run-script
Post by: Estaog on Wed 30/06/2004 08:49:54
Yep that did the trick, thanks a lot!
Title: Re: Dialog run-script
Post by: Estaog on Wed 30/06/2004 13:26:57
Can you guys see something wrong with this?

         if (character[1].inv[26]==1) {
            SetDialogOption (2,8,1);
            }

I get the inventry item but the option still stays off.
Title: Re: Dialog run-script
Post by: Ashen on Wed 30/06/2004 14:40:25
I think you only need one =, so:

         if (character[1].inv[26] =1) {
            SetDialogOption (2,8,1);
          }

Or, put the SetDialogOption (2,8,0); in the same place you pick up the inventory item.
Title: Re: Dialog run-script
Post by: Estaog on Wed 30/06/2004 14:42:09
Ah yes that will work too.Thanks
Title: Re: Dialog run-script
Post by: TerranRich on Wed 30/06/2004 16:10:52
NO, it will not work. When using "if" statement you DO need the double-= signs.
Title: Re: Dialog run-script
Post by: Estaog on Wed 30/06/2004 16:39:00
Quote from: Ashen on Wed 30/06/2004 14:40:25
Or, put the SetDialogOption (2,8,0); in the same place you pick up the inventory item.

I ment that
Title: Re: Dialog run-script
Post by: Gilbert on Fri 02/07/2004 02:38:32
Glad to hear that's been solved, but my advice is that you should not use numbers directly to refer to characters (unless it's really necessary), use their script names instead. (You should note that, character number starts from 0, so it may be a problem if your player character is #0 and you're using 1 in your scripts).
Title: Re: Dialog run-script
Post by: Hollister Man on Sat 03/07/2004 06:56:09
Converting the demo game this was a problem bigtime.  Trying to find every reference to EGO was tough, but finding characterfunction(0, X, Y) was pretty much trial and error.  If you're working on a constant player character, use GetPlayerCharacter() to make it even easier.