Dialog run-script

Started by Estaog, Mon 28/06/2004 14:47:37

Previous topic - Next topic

Estaog

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?
Think about the kittens man!

http://members.aol.com/johnk0/godkills.jpg

Gilbert

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.

Ashen

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?
I know what you're thinking ... Don't think that.

Estaog

#3
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?
Think about the kittens man!

http://members.aol.com/johnk0/godkills.jpg

Wolfgang Abenteuer

#4
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

Estaog

Yep that did the trick, thanks a lot!
Think about the kittens man!

http://members.aol.com/johnk0/godkills.jpg

Estaog

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.
Think about the kittens man!

http://members.aol.com/johnk0/godkills.jpg

Ashen

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.
I know what you're thinking ... Don't think that.

Estaog

Ah yes that will work too.Thanks
Think about the kittens man!

http://members.aol.com/johnk0/godkills.jpg

TerranRich

NO, it will not work. When using "if" statement you DO need the double-= signs.
Status: Trying to come up with some ideas...

Estaog

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
Think about the kittens man!

http://members.aol.com/johnk0/godkills.jpg

Gilbert

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).

Hollister Man

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.
That's like looking through a microscope at a bacterial culture and seeing a THOUSAND DANCING HAMSTERS!

Your whole planet is gonna blow up!  Your whole DAMN planet...

SMF spam blocked by CleanTalk