Sorry, I didn't notice that was a different script. I'm not aware that I've changed it, here's the script:
`using UnityEngine;
using System.Collections;
using AC;
public class ItemSetLabel : MonoBehaviour
{
public string inventoryMenuName = "Verbs";
public string inventoryElementName = "Inventory";
public int interactionIndex = 0;
private int tempInvID = -1;
private Menu verbsMenu;
private MenuInventoryBox inventoryElement;
private void Start ()
{
verbsMenu = PlayerMenus.GetMenuWithName (inventoryMenuName);
inventoryElement = verbsMenu.GetElementWithName (inventoryElementName) as MenuInventoryBox;
}
private void Update ()
{
bool isOver = false;
if (KickStarter.runtimeInventory.SelectedItem == null)
{
for (int _slot=0; _slot<inventoryElement.GetNumSlots (); _slot++)
{
if (verbsMenu.IsPointerOverSlot (inventoryElement, _slot, KickStarter.playerInput.GetInvertedMouse ()))
{
isOver = true;
InvItem hoverItem = inventoryElement.GetItem (_slot);
if (hoverItem.id != tempInvID && tempInvID >= 0)
{
KickStarter.playerCursor.ResetSelectedCursor ();
tempInvID = -1;
}
int cursorID = KickStarter.playerCursor.GetSelectedCursorID ();
if (cursorID == -1)
{
cursorID = hoverItem.interactions[interactionIndex].icon.id;
KickStarter.playerCursor.SetCursorFromID (cursorID);
tempInvID = hoverItem.id;
KickStarter.playerMenus.UpdateAllMenus ();
return;
}
}
}
}
if (tempInvID >= 0 && !isOver)
{
KickStarter.playerCursor.ResetSelectedCursor ();
tempInvID = -1;
}
}
I believe the reason it sticks non-inventory sentences afterwards is because the bool is still true, only OnHotspotReach seems to turn it back to false.
What exactly should trigger when the inventory interaction is finished? If the others are clearing when he reaches a hotspot or when a hotspot walk is cancelled, neither of these will apply to an inventory interaction.
Okay, it might have something to do with: interaction.actionList.actionListType == ActionListType.RunInBackground
If the inventory interaction is Pause Gameplay, the text needs to be held during the interaction and restored once the interaction is over (or pause gameplay is "unpaused" by an action). I'm not sure how to add this to the current script?
The new script hooks into the OnEnterGameState event to clear the override once you re-enter Normal gameplay. The check for "RunInBackground" you're referring to is a wait to prevent the override from being set, as the game won't enter Cutscene mode and later re-enter Normal mode.
If the Interaction is set to Pause Gameplay, the check should be bypassed and should be set at the end of the OnInventoryInteract function.
Again, please, what is the situation when using both "When running" options for the Inventory interaction?
The textbook is a "run in background" type interaction, the flyer is a "Pause gameplay" type action. The first one doesn't really hold and the flyer holds until the action is "unpaused" (we spoke a bit about this here: https://adventurecreator.org/forum/discussion/9580/pause-gameplay-when-running-option-toggle-in-action-list#latest - the flyer interaction would basically "unpause" when he says the line "George says that...") and the text should stop holding and return to normal. I'm not sure if the end of OnInventoryInteract would count if the game was unpaused mid-interaction, but the of end OnInventoryInteract would also be a good place for the text to unhold, and it doesn't seem to be doing.
I know what it is you want - I was asking about the actual properties of the ActionList you were demonstrating.
When pausing gameplay, that OnEnterGameState event should kick in once the ActionList finishes. Try placing a print statement inside the "GameState.Normal" check clause to see if this is being run. On my end, it is - I have no such issue when running inventory interactions.
It would also be worth placing one inside the SetOverrideText function - because this is called any time the text is set or cleared.
It comes on during a Pause Gameplay action, but the sentence still gets stuck. It doesn't come on during a Pause In Background action, and the sentence doesn't get stuck.
Replace "outside check" with the actual gameState, so that we can see what's actually going on:
Debug.Log ("Enter GameState: " + gameState);
It needs to be displayed twice: Cutscene when the Interaction begins, and Normal when it ends. You should find that this is the case when running a Hotspot Interaction that also blocks gameplay.
You're only showing a glimpse of your ActionList. It may be related to the speech being background. What if you uncheck Play in background? within the speech Action?
"gamestate" that gives me an error: Assets\ScummVerbLine.cs(78,45): error CS0103: The name 'gameState' does not exist in the current context
Here's what happens when I change parts of the action, and also when I change the action that clears it (nothing really, since it seems to be always cleared when a non-inventory item action runs, regardless of state or speech state) https://gfycat.com/defiantinfatuatedgoldenmantledgroundsquirrel
Comments
Unrelated - this is referring to the SetItemLabel script. Have you modified it?
Try replacing the instance of:
with:
Replace the Start function with an Awake one.
Sorry, I didn't notice that was a different script. I'm not aware that I've changed it, here's the script:
`using UnityEngine;
using System.Collections;
using AC;
public class ItemSetLabel : MonoBehaviour
{
}
`
So this just started happening?
Replace:
with:
I'm afraid that didn't help, I just tried it. And yes, it just started happening, I assume after upgrading AC.
Is the error message exactly the same? Post both the message and the modified script - use https://paste.ofcode.org/ so the line numbers are visible.
It's just endlessly giving this same error: https://paste.ofcode.org/sCPqrtSGtCeA67tuphxyDm
This is the script I'm using: https://paste.ofcode.org/6SgcKJBXXHzgTV2ECBNvPd
EDIT: Oh man, I'm so sorry, I forgot completely to refresh the package manager after updating to the dev version
Okay back to business, the inventory still sticks the sentence: https://gfycat.com/livelyacclaimedgoitered
I believe the reason it sticks non-inventory sentences afterwards is because the bool is still true, only OnHotspotReach seems to turn it back to false.
Try this:
https://paste.ofcode.org/CNLGUZ2y4H5mnAJ7sb9HWm
Sorry, still sticking, and there's no debug message I can give you.
I don't have much to go on - is this for inventory interactions set to "Run In Background", "Block Gameplay", or both?
You can place debug messages in OnInventoryInteract - which is triggered when running an inventory interaction.
Right now, it checks if the clicked interaction runs in the background or not. If it is, it should clear the override - otherwise assign it.
Okay, it might have something to do with:
interaction.actionList.actionListType == ActionListType.RunInBackground
If the inventory interaction is Pause Gameplay, the text needs to be held during the interaction and restored once the interaction is over (or pause gameplay is "unpaused" by an action). I'm not sure how to add this to the current script?
The new script hooks into the OnEnterGameState event to clear the override once you re-enter Normal gameplay. The check for "RunInBackground" you're referring to is a wait to prevent the override from being set, as the game won't enter Cutscene mode and later re-enter Normal mode.
If the Interaction is set to Pause Gameplay, the check should be bypassed and should be set at the end of the OnInventoryInteract function.
Again, please, what is the situation when using both "When running" options for the Inventory interaction?
Here's an example of how I'm getting trying to get it working: https://gfycat.com/decimalartisticarcticduck
The textbook is a "run in background" type interaction, the flyer is a "Pause gameplay" type action. The first one doesn't really hold and the flyer holds until the action is "unpaused" (we spoke a bit about this here: https://adventurecreator.org/forum/discussion/9580/pause-gameplay-when-running-option-toggle-in-action-list#latest - the flyer interaction would basically "unpause" when he says the line "George says that...") and the text should stop holding and return to normal. I'm not sure if the end of OnInventoryInteract would count if the game was unpaused mid-interaction, but the of end OnInventoryInteract would also be a good place for the text to unhold, and it doesn't seem to be doing.
The text hold restores if I set the interactions to Run In Background: https://gfycat.com/exaltedflusteredamericansaddlebred
I know what it is you want - I was asking about the actual properties of the ActionList you were demonstrating.
When pausing gameplay, that OnEnterGameState event should kick in once the ActionList finishes. Try placing a print statement inside the "GameState.Normal" check clause to see if this is being run. On my end, it is - I have no such issue when running inventory interactions.
It would also be worth placing one inside the SetOverrideText function - because this is called any time the text is set or cleared.
Okay, I tried:
private void OnEnterGameState(GameState gamestate) { if (gamestate == GameState.Normal) { print("gamestate"); SetOverrideText(string.Empty); } }
And I'm not getting it called at all: https://gfycat.com/unlawfulshorttermhermitcrab
SetOverrideText, however, is working everytime text is set or cleared.
Place the print outside of the gamestate check so that it runs at all times - what then?
Like so?
private void OnEnterGameState(GameState gamestate) { if (gamestate == GameState.Normal) { SetOverrideText(string.Empty); } print("outside check");
https://gfycat.com/tornadolescentcollie
It comes on during a Pause Gameplay action, but the sentence still gets stuck. It doesn't come on during a Pause In Background action, and the sentence doesn't get stuck.
Replace "outside check" with the actual gameState, so that we can see what's actually going on:
It needs to be displayed twice: Cutscene when the Interaction begins, and Normal when it ends. You should find that this is the case when running a Hotspot Interaction that also blocks gameplay.
You're only showing a glimpse of your ActionList. It may be related to the speech being background. What if you uncheck Play in background? within the speech Action?
"gamestate" that gives me an error:
Assets\ScummVerbLine.cs(78,45): error CS0103: The name 'gameState' does not exist in the current context
Here's what happens when I change parts of the action, and also when I change the action that clears it (nothing really, since it seems to be always cleared when a non-inventory item action runs, regardless of state or speech state) https://gfycat.com/defiantinfatuatedgoldenmantledgroundsquirrel