Dialog Request Doesn't Work

Started by Mr Flibble, Fri 14/05/2004 23:23:01

Previous topic - Next topic

Mr Flibble

I have properly programmed the dialog request function, but it still doesn't work.
In my dialogue I have
Code: ags

GB: I want the item.
VD: Okay.
run-script 1
add-inv 8
option-off 1
return


In the global script I have:
Code: ags

function dialog_request (int Flibble)  {
if (1 == Flibble)
SetCharacterView(GB, 26);
AnimateCharacter(GB, 2, 0, 0);
ReleaseCharacterView(GB); //(That may not be the exact
line, but its the one that has that effect)


I can't figure out why it doesn't work.
After the line "VD: okay" the animation should show the character "picking up" the object.


Another, seemingly unrelated problem:
Whenever I talk to the character (who happens to be the VooDoo lady) the dialogue runs as normal.
I have also programmed so that you can give her a certain item to start the conversation, but I get kicked out of the game and I get an error message saying

"FaceCharacter : Invalid character selected.
I'll post tomorrow with the exact script for the second problem.
Thanks.
Ah! There is no emoticon for what I'm feeling!

Scorpiorus

Put extra braces.
Also you need to block the script so that animation can proceed:

function dialog_request (int Flibble)Ã,  {
   if (1 == Flibble) {
      SetCharacterView(GB, 26);
      AnimateCharacter(GB, 2, 0, 0);
      while (character[GB].animating) Wait(1);
      ReleaseCharacterView(GB);
   }
}



Quote"FaceCharacter : Invalid character selected.
Seems like an invalid value specified for the character to face. But, yeah the exact script code would be useful.

Mr Flibble

Thanks. I didn't get any errors compiling the script, but that seems about right.

Code: ags

    if (type==2 || type==6) FaceCharacter(GetPlayerCharacter(),GetCharacterAt(mouse.x,mouse.y));
    if (UsedMode("close")){
       Display("I can't close that");


The first line of that block. I'm not sure if the rest is related or not.
The error (invalid character) happens when i try to talk to some, or give an item to others.
Help would be appreciated.
Ah! There is no emoticon for what I'm feeling!

Proskrito

are you using a scumm template?
it seems so, and then, it could give you that error if you have interactions in a interaction (like use inv on character) AND in the 'any click on character', in both of them, and in the any click, the last line is 'else Unhandled()'
if thats the problem, try moving the interactions in the 'any click' to their respective modes, keeping it blank, OR, moving everything to the 'any click'.
The point is that one click must not trigger 2 interactions, and it could be running the 'use inv on...' and the 'any click', causing the error.

Hope this helps! : ) (and sorry if thats not the problem!)

Mr Flibble

Yeah, I use your template. Thanks for the help on how to fix it up.
But what if I want to put something like
>Use Inv on Character=
Move Char (x, y,);
FaceLocation (x, y);
Run Dialog(x)

Can you do that? Or is that not what you meant?
'Cos I have a whole pile of interactions done for a cutscene, back when i couldn't use script. Should I convert them into one Run Script command?
Ah! There is no emoticon for what I'm feeling!

Scorpiorus

#5
What if you replace the line:

if (type==2 || type==6) FaceCharacter(GetPlayerCharacter(),GetCharacterAt(mouse.x,mouse.y));

with:

int charToFace = GetCharacterAt(mouse.x,mouse.y);
if ((type==2 || type==6) && charToFace!=-1) FaceCharacter(GetPlayerCharacter(), charToFace);

That way you won't at least get the error.

Proskrito

the easy way: just keep the 'any click' empty, and there shouldnt be problems.
The explanation:
I think its my fault, i should have put that in the documentation, and update the template examples.
What is happening, is that in the any click interaction, you have some interactions (for special modes i suppose, like push), and in order to have unhandled event support, at the bottom of that script, there is an 'else Unhandled()', that would run the unhandled event function if none of those modes is used. But as 'any click' is run always, you could have the 'use inv on char' interaction in its own interaction, and for example 'push' interaction in any click. Then you use an inv. item on the character, and then, the 'use inv on..' is triggered, but so is 'any click', and since the mode you used was not any of the ones in the any click, unhandled event is run, when it shouldnt.
So the easy solution is to write the interactions on their modes, and not using the 'any click' (use Ext. modes for push, pull, open and close and Walk for walk mode, usemode1 and usemode2 respectively(sp?)).
Damn me and my english! : P i hope its clear now : )

Mr Flibble

Thanks!
Scorpius, I'll try your code, and Proskrito, thanks for clearing that up.

One last thing, Proskrito, can you please verify that Scorpius' new code won't conflict with your MI2 template?
Thanks.
Ah! There is no emoticon for what I'm feeling!

Proskrito

im sure scorpiorus' code will work perfectly. (always trust him more than me ; ) )
Im glad you solved it! :)

SMF spam blocked by CleanTalk