Trouble between starting different dialouges based on characters

Started by MugMan, Sat 05/12/2015 15:35:48

Previous topic - Next topic

MugMan

Code: ags

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.

Slasher

try the second

Code: ags

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


Slasher

Have you used the Talk function for cFrank or did you type it in?

And what's not working? Does the dialog not run?

MugMan

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


Slasher

Ok. Check that the dialogs are named correctly....

do you get an error message appear?

MugMan

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.

Slasher

Try a different command:

Code: ags


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?



Crimson Wizard

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.

MugMan

Nope, the display doesn't work it does the same thing as before.

MugMan

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.

Slasher

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.

MugMan

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.

Slasher

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


MugMan

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

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!

Slasher

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?

MugMan

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

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


Monsieur OUXX

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.
 

SMF spam blocked by CleanTalk