RunDialog in room script problem

Started by Bernie, Sat 07/08/2004 12:26:44

Previous topic - Next topic

Bernie

I've posted something like this before, but this time I can't fix the problem with the solution given in the last thread.

Anyway, the problem: When I call a RunDialog() from my room script, repeatedly execute seems to sort of still run for a loop or two while the dialog is running - a label is updated just before the window appears, and sometimes just after selecting an option. However, it doesn't do that when I call RunDialog() through, for example, a character interaction.

I tried to lock it with 'if (IsInterfaceEnabled()==1) {*setting label text*}, so it wouldn't update while the dialog is running, but it didn't work either.

And so, I did the following:

if (IsInterfaceEnabled()==0) if (GetGlobalInt(14)<10) {{SetGlobalInt(14,10);}}

if (GetGlobalInt(14)>0) {SetGlobalInt(14,GetGlobalInt(14)-1);}

if (GetGlobalInt(14)==0) {*setting label text*}

(not the most efficient kind of code, but the logic works for me, heh.)

This seems to work for most of the time, but sometimes, it still updates the label. Any ideas?

Thanks~

Proskrito

mmm i could be totally wrong, and in that case sorry, but i think i remeber reading in the forums that both RunDialog and NewRoom are called after any other function inside another function, so maybe it have something to do with it.

SilverWizard_OTF

I you want to run your dialo when you enter the room, then just put the script command RunDialog() to the room script--> after fadein.
   If you want to run the dialog only once, then put it at --> first time player enters screen

"All we have to decide is what to do, with the time that is given to us"

Bernie

Proskrito - Thanks. Problem is, it also happens while the dialog is running, even after I've already selected a few options. A RunDialog() from a room seems to behave differently than one called through, say, a character interaction. Even keypresses slip through sometimes.

SilverWizard_OTF - Thanks, but I think you're misunderstanding my problem. :)

Pumaman

AGS can only run one script at a time, by which it means one copy of a script.

Therefore, if RunDialog is run from a room script, the global script is still available and it may allow it to be run.

I'm surprised that IsInterfaceEnabled doesn't work in this case though, that seems a bit odd.

Are you saying that this only happens just before and just after the dialog options appear?

Bernie

Yep, that's how it is. Even with IsInterfaceEnabled it seems to let one loop through when the text options appear and when they disappear.

I managed to fix it with the code in my first post and setting that global value to 5 just before calling rundialog() within a room, and also locking keypresses with it, so hooray for me! :)

Pumaman



Pumaman

I haven't been able to replicate this problem, IsInterfaceEnabled always returns 0 for me.

What speech style and dialog options style are you using?

Bernie

Lucas arts speech style and the text options on a GUI (it happens with normal dialog options style, too). I could still call a popup modal GUI by holding down a key while selecting an option, even though it was locked with IsInterfaceEnabled. Same for my status bar label, it would update, too.

I can't reproduce this in a clean game, but it's still present in the game I'm currently working on. Weird problem. :)

Pumaman

So your on_key_press definitely has an

if (IsInterfaceEnabled()) return;

type line in it?

Strange, is the game large or is it uploadable?

Bernie

I removed the lockout code (explained in 1st post) to reproduce and confine the bug in a single room demo, but it seems to be gone now. I've changed a lot of code since the bugs' last appereance, must have done something that made it go away. Well, either that or I'm going insane.

All keypresses had both an IsInterfaceEnabled and the lockout code, only like that it worked reliably back then. I'll just work without the lockout code for now and see if I come across it again. Sorry for the trouble. :)

SMF spam blocked by CleanTalk