Keeping player interface active when carrying out function per default

Started by tor.brandt, Sat 22/10/2016 10:05:12

Previous topic - Next topic

tor.brandt

If a function is run on e.g. a hotspot event, the whole game interface is disabled while the function is carried out.
E.g. if I have set a player.Say function, the game interface is disabled until the character has finished talking.

I seem to recall that you don't even have to script to keep the interface enabled by default, but I have looked everywhere (editor, help files, forum), and I just can't find it!
How do I make it so that the game interface is kept enabled by default, such that I have to enter into the function specifically when I want the interface to be disabled while carrying out the function?

Slasher

Game settings > When player interface is disabled, GUIs should > Display normally...

tor.brandt

Thanks, but that doesn't do it.

The cursor is still hidden, and I'm unable to click anywhere while it's carrying out the function.
What I'm after is that the player interface shouldn't be disabled in the first place.

Khris

What you're after is every action running non-blocking but still in sequence, I guess?
That's possible but complicated.

Is the GUI supposed to never get disabled at all? Is the player supposed to be able to interrupt the result of an interaction at any point? If we're mostly talking about the blocking walk over to the hotspot before the interaction takes place, I wrote the GotThere module for that: click
Then there's Character.SayBackground.

Note however that many actions like walking, talking, animating can be non-blocking, but using several non-blocking commands in sequence will cause them to run at the same time.
If you want to tell AGS to run command A non-blocking, then command B non-blocking as soon as command A has finished, you need to actually script that. The easiest way is to use a timer, but you can only do that if you know the exact number of game frames it takes for command A to finish. Another way is to set a variable, then check stuff in repeatedly execute. An example would be sending the player off to coordinates on the screen, then repeatedly checking player.Moving and running the next non-blocking action as soon as it is false.

Anyway, you need to better describe how exactly you want the game to behave, I guess.

tor.brandt

@Khris:
Thank you for your reply, and for the link to your module!

Yes, what I'm mostly after is that the walk should be non-blocking, such that the player can interrupt the walk, in effect interrupting the entire function.

I tried using your module in the following way:
Code: ags

function hWindow_Look()
{
  if (!GotThere()) GoFace(265, 135, eUp);
  
  else
  {
  player.FaceDirection(eDirectionUp);
  player.SayBackground("It's dark outside.");
  player.SayBackground("I can't see anything for the reflections in the glass.");
  }
}


In general settings I unchecked "automatically walk to hotspots in Look mode" (if I leave it checked, then the character still walks blockingly).
However, now the character doesn't walk at all, but simply carries out the "else" part right away.
What could I have done wrong?

Also, SayBackground works fine for my purpose (my purpose being that unless the hotspot is actually associated with game progress, the talking should be non-blocking) if there is only one instance of talk.
But
Code: ags

player.SayBackground("It's dark outside.");
player.SayBackground("I can't see anything for the reflections in the glass.");

only displays the second line, since, as you mentioned, the non-blocking actions are carried out simultaneously.
But I'd like it to first display the first line and THEN the second.
I guess I will have to use the timer then... I'll try to sort that out.

tor.brandt

I have just imported GotThere as a separate script...
It's not supposed to be pasted into the globalscript or anything, is it?

Khris

No, importing it is correct.
You don't need walkto points for your hotspots since the coordinates are set in your interaction functions anyway.

I'm not sure what causes this, are you using other modules, or a template?

monkey0506

Quote from: tor.brandt on Sat 22/10/2016 11:03:18Also, SayBackground works fine for my purpose... if there is only one instance of talk.
But [code] only displays the second line, since, as you mentioned, the non-blocking actions are carried out simultaneously.
But I'd like it to first display the first line and THEN the second.
I guess I will have to use the timer then... I'll try to sort that out.

The QueuedSpeech module should be able to do what you're looking for with the background speech.

tor.brandt

@Khris:
Ah yes, I'm using the LW_BASS template - do you know if that conflicts with your module?

@monkey0506:
Sounds great, thank you!
However, when I try to use the script, it says I need AGS ver. 3.4.0.3, but I cannot find a higher version than 3.4.0.12 anywhere?

Cassiebsg

3.4.0.3 is a lower version than .12.
Not sure how to fix that though.
There are those who believe that life here began out there...

tor.brandt


monkey0506

It's a bug in AGS, but as 3.4.0.3 is an alpha version it's doubtful that anyone will try to use the module with an earlier 3.4.0.x version. As you have the final release of AGS 3.4.0 (3.4.0.12), you can just delete the final digit from the line:

Code: ags
#ifver 3.4.0.3


(Line 3 of the module) So it should instead read:

Code: ags
#ifver 3.4.0


I have a mostly completed version 4.2 of the module which will use the SCRIPT_API_v340 preprocessor macro instead, which will make sure that the module has a sufficiently high AGS version without encountering this bug.

tor.brandt


SMF spam blocked by CleanTalk