Blocking Dialogs [SOLVED]

Started by Racoon, Thu 03/12/2020 23:54:30

Previous topic - Next topic

Racoon

Hey Guys,

I have a problem. I am trying to get a game running for this month AGS, but I made a mistake with some dialogs. I thought I could do Dialog.start(); and then add code after that, that runs after the Dialog stops. But Dialogs are non blocking, or get called last? from what I read while googleing. Is there an easy way to block them?

Crimson Wizard

#1
The Dialog.Start is a not an instant function, it schedules actual dialog to run after the rest of the script is finished, similar to ChangeRoom.
The solution is usually to split script in two parts, where one runs before dialog and starts dialog, another runs after dialog. The second part could be placed in a separate function and called from dialog itself, at its exit point(s).
Another way, I think, could be to set up some variable, and check that variable in repeatedly_execute function (or corresponding room's event), and run second part from there. If I remember correctly, common repeatedly_execute is not run during dialogs (only repeatedly_execute_always). Sorry if I'm wrong (need to test that out later).
Finally, you could just put whole script inside the dialog. This may be simpliest way to do if dialog has only one exit point. After all, dialog script are almost like normal scripts, only with few additional rules on top.

Racoon

#2
Thank you! I thought you could not call room object from a dialog, but then found out that it works with the object ID. So putting the script in the dialog is what worked best for me.

Crimson Wizard

Quote from: Racoon on Fri 04/12/2020 19:25:00
Thank you! I thought you could not call room object from a dialog, but then found out that it works with the object ID. So putting the script in the dialog is what worked best for me.

There's also another trick: you may create global pointers to objects ("Object*" type of variable) and assign them to real objects on room enter event, then use these global pointers wherever so long as you are in correct room).
This is if you don't like using object[N] syntax.

SMF spam blocked by CleanTalk