Menu

Show posts

This section allows you to view all posts made by this member. Note that you can only see posts made in areas you currently have access to.

Show posts Menu

Messages - Torchiest

#1
Quote from: Matti on Fri 27/10/2023 17:27:53I'm a bit confused about why you need that dialog at all. Can't you just put
Code: ags
cEgo.Say("My keys were in the door!");
in the hDoor_Interact script?

Yes, yes I can. I didn't know that function existed lol. I assumed the dialog functionality was the only way to get characters to speak. I'll have to check out the character functions more deeply from now on.
#2
Just to follow up, this is what I was referring to in the tutorial. https://adventuregamestudio.github.io/ags-manual/acintro8.html

"This is not the same type of script that we've used for our Events like picking up the key. It's a much simpler dialog-only scripting language."
#3
Ah, thank you. For some reason the tutorial gave me the impression the dialog scripting was much more limited than the regular scripting and couldn't do things like that.
#4
After more digging, I figured out how to do this, so I'm posting my solution here for posterity:

I needed to add a special function call in the dialog as follows:

Code: ags
// Dialog script file
@S  // Dialog startup entry point
EGO: My keys were in the door!
run-script 1
stop

That calls the special function with the integer usable to decide what to do. So I changed that function to include the Display() call:

Code: ags
function dialog_request(int param)
{
  switch(param) {
    case 1: 
    {
      Display("You grab the keys, happy to have them.");
      break;
    }
  }
}

I am curious why this has to be done this way instead of it just synchronously flowing through the original code, if any can explain that.
#5
I've got the following script that runs when trying to interact with a door:

Code: ags
function hDoor_Interact()
{
  if (KeyInDoor)
  {
    cEgo.Walk(960, 620, eBlock);
    dGetKey.Start();
    KeyInDoor = false;
    GiveScore(5);
    Display("You grab the keys, happy to have them.");
  }
  else
  {
    Display("You don't need anything from there right now.");
  }
}

And then the dialog is simply this:

Code: ags
// Dialog script file
@S  // Dialog startup entry point
EGO: My keys were in the door!
stop

The Display function always runs before the dialog. I've tried calling Wait() with some number in it between the Start() and Display() calls, but it just delays both the text popup and the dialog, still showing the window first. I'd assume this is a common coding situation, but I've having a really hard time getting useful search results. Hopefully I'm just unaware of some simple way to make this work. Can anyone help?
SMF spam blocked by CleanTalk