Adventure Game Studio

AGS Support => Beginners' Technical Questions => Topic started by: MugMan on Sat 05/12/2015 15:35:48

Title: Trouble between starting different dialouges based on characters
Post by: MugMan on Sat 05/12/2015 15:35:48
Code (ags) Select

function cFrank_Talk()

  if (player==cEgo) {
    dFrank_Ego_Alley.Start();
  }
  if (player==cAlienKing) {
    dFrank_Alien_Alley.Start();
  }
 
}

So what i'm trying to do is have a diffrent dialouge start depending on who the current player is, however when i try and talk to cFrank, the game freezes and highlights the first "{" in yellow.
I'm really not sure what i'm doing wrong. Sorry :undecided:
To clarify, the game runs, it just crashes when i talk to cFrank.
Title: Re: Trouble between starting different dialouges based on characters
Post by: Slasher on Sat 05/12/2015 17:28:11
try the second

Code (ags) Select

}
else if (player==cAlienKing) {
dFrank_Alien_Alley.Start();
}
}
Title: Re: Trouble between starting different dialouges based on characters
Post by: MugMan on Sat 05/12/2015 17:45:33
It's still not working :confused:
Title: Re: Trouble between starting different dialouges based on characters
Post by: Slasher on Sat 05/12/2015 17:50:44
Have you used the Talk function for cFrank or did you type it in?

And what's not working? Does the dialog not run?
Title: Re: Trouble between starting different dialouges based on characters
Post by: MugMan on Sat 05/12/2015 17:54:03
I set the talk function for frank with the dropdown menu thing on the bottom left, i tested it in game and the game still crashed, and highlighted the same line.
EDIT: Yeah, at the point where the options for dialouge should appear the game just crashes

Title: Re: Trouble between starting different dialouges based on characters
Post by: Slasher on Sat 05/12/2015 17:57:23
Ok. Check that the dialogs are named correctly....

do you get an error message appear?
Title: Re: Trouble between starting different dialouges based on characters
Post by: MugMan on Sat 05/12/2015 18:00:14
Yup, they're identical.
100% on that
But no error message, that's the strange thing, the window of the game just closes and highlights line 2.
Title: Re: Trouble between starting different dialouges based on characters
Post by: Slasher on Sat 05/12/2015 18:04:47
Try a different command:

Code (ags) Select


function cFrank_Talk()

  if (player==cEgo) {
    Display("Ego is the player.");
  }
  else if (player==cAlienKing) {
    Display("Alien is the player.");
  }
  else {
  Display("Who is the player?");
 
}


Do the displays show?


Title: Re: Trouble between starting different dialouges based on characters
Post by: Crimson Wizard on Sat 05/12/2015 18:05:44
The script looks okay.

Do you have a break point set in that function maybe? Do you see a red dot and a red line in the script if you open it in the editor?

Also, after it crashes, try to press F11 and see what happens.
Title: Re: Trouble between starting different dialouges based on characters
Post by: MugMan on Sat 05/12/2015 18:07:24
Nope, the display doesn't work it does the same thing as before.
Title: Re: Trouble between starting different dialouges based on characters
Post by: MugMan on Sat 05/12/2015 18:09:18
Quote from: Crimson Wizard on Sat 05/12/2015 18:05:44
The script looks okay.

Do you have a break point set in that function maybe? Do you see a red dot and a red line in the script if you open it in the editor?

Also, after it crashes, try to press F11 and see what happens.
Nope, no red dot or red line, also the f11 thing didn't work, it just doesn't respond to anything the game just stops recieving any input, mouse movements, anything.
Title: Re: Trouble between starting different dialouges based on characters
Post by: Slasher on Sat 05/12/2015 18:11:50
Something must be clashing with it..

does the 'else' not work either?

check if anything in rep exec might be interfering with it or another function / variable..

look from all angles..

as Crimson says: code looks fine.
Title: Re: Trouble between starting different dialouges based on characters
Post by: MugMan on Sat 05/12/2015 18:13:32
Quote from: slasher on Sat 05/12/2015 18:11:50
Something must be clashing with it..

check if anything in rep exec might be interfering with it or another function / variable..

look from all angles..

as Crimson says: code looks fine.

I uhh, i don't know what a rep exec even is... Sorry, this is the first character (Otherthan Ego and AlienKing) that i've added to the game, and one of the first interactions with anything other than a hotspot, and that was just a standered cEgo.Say ("Blah Blah"); sorta thing.
Edit: Turning the Else if statement into just an Else statement doesn't work ethier.
Is it relevant that the exit game thing doesn't actually stop the .exe? It just makes it not respond.
Title: Re: Trouble between starting different dialouges based on characters
Post by: Slasher on Sat 05/12/2015 18:20:11
Right..

are you using a template that is not the default?

you could try using another interaction on CFrank like Lookat and have the dialogs start instead of Talkto.

Maybe create a new game and start afresh and see if the problem persists or comb all your script and search for any errors or something that may clash..

perhaps post here or send me a PM with your room script / dialogs...

Title: Re: Trouble between starting different dialouges based on characters
Post by: MugMan on Sat 05/12/2015 18:25:51
Quote from: slasher on Sat 05/12/2015 18:20:11
Right..

are you using a template that is not the default?

you could try using another interaction on CFrank like Lookat and have the dialogs start instead of Talkto.

Maybe create a new game and start afresh and see if the problem persists or comb all your script and search for any errors or something that may clash..

perhaps post here or send me a PM with your room script / dialogs...
It's the default game base yeah, i'll redo it i suppose, the only other thing i added was a chracter switching thing so:
Code (ags) Select

function cAlienKing_Interact()
{
if (player==cEgo) {
  cEgo.Say (" If you're so bloody smart, you go do it.");
  cAlienKing.Say ("Fine, it's about time someone with an intellect attempted this.");
cAlienKing.SetAsPlayer();

EDIT: Wow, it worked when i changed the fuinction to look.
I have no idea how that worked, thanks!
Title: Re: Trouble between starting different dialouges based on characters
Post by: Slasher on Sat 05/12/2015 18:34:05
QuoteWow, it worked when i changed the fuinction to look.
strange that.. did you make sure that the mouse cursor was in fact the Talkto mouse cursor when you clicked CFrank?
Title: Re: Trouble between starting different dialouges based on characters
Post by: MugMan on Sun 06/12/2015 16:48:31
Yeah, the mouse had the talking head on it, i don't really know.
Just for reference here's the code in a working state:
Code (ags) Select

if (player==cEgo) {
  cEgo.Say ("");
}
if (player==cAlienKing) {
  cAlienKing.Say ("");
}
if (player==cFrank) {
  cFrank.Say ("");

Title: Re: Trouble between starting different dialouges based on characters
Post by: Monsieur OUXX on Mon 07/12/2015 10:02:26
The cause could be a mixup between mouse modes (Talk, interact, etc.) or some faulty scripting in your dialogs, or even something else. You have all the symptoms of a breakpoint placed on that line but you say you have no red dot there (that's dubious to say the least!). We can't have an accurate idea of what's going on.

So if you want to investigate further into this (despite the issue being partially "fixed"), I suggest you zip up your game and upload it anywhere (Dropbox, mediafire, whatever). Then we'll be able to look into this.