Are sequences without an @number guaranteed to play without interruption?
Posted: Sat Jul 06, 2019 2:14 am
I've got a really random bug that 20% of the people who play my game report, and as far as I can tell, it seems like it shouldn't be possible to occur (this is usually the case with tough bugs). I'm starting to think it could be a race condition, or caused by a lack of understanding on the dialogue library.
I'm looking at my dialogue, and one node looks like this:
My question is, is it possible to click really fast and skip these sequences/scripts, or are they guaranteed to execute until completion?
Here's my CollectCrops() function:
BTW: If that exception were thrown, it would cause this, so this is most likely the source of the bug, but I can't figure out any possible way for it to get to that default block.
I'm looking at my dialogue, and one node looks like this:
My question is, is it possible to click really fast and skip these sequences/scripts, or are they guaranteed to execute until completion?
Here's my CollectCrops() function:
Code: Select all
namespace PixelCrushers.DialogueSystem.SequencerCommands
{
public class SequencerCommandCollectCrops : SequencerCommand
{
public void Start()
{
// Add your initialization code here. You can use the GetParameter***() and GetSubject()
// functions to get information from the command's parameters. You can also use the
// Sequencer property to access the SequencerCamera, CameraAngle, Speaker, Listener,
// SubtitleEndTime, and other properties on the sequencer. If IsAudioMuted() is true,
// the player has muted audio.
//
// If your sequencer command only does something immediately and then finishes,
// you can call Stop() here and remove the Update() method:
//
string cropName = DialogueLua.GetVariable("GrowingCropName").AsString;
string nameOfVariable = null;
switch (cropName)
{
case "sunflowers":
nameOfVariable = "sunflowers";
break;
case "catnip":
nameOfVariable = "catnip";
break;
case "wheat":
nameOfVariable = "wheat";
break;
case "coffee beans":
nameOfVariable = "coffeebeans";
break;
case "carrots":
nameOfVariable = "carrots";
break;
default:
throw new System.Exception("Unknown crop name: " + cropName);
}
var previousNumberOfCrop = DialogueLua.GetVariable(nameOfVariable).AsInt;
DialogueLua.SetVariable(nameOfVariable, previousNumberOfCrop + 1);
var previousCropsGrown = DialogueLua.GetVariable("cropsGrown").AsInt;
DialogueLua.SetVariable("cropsGrown", previousCropsGrown + 1);
DialogueLua.SetVariable("DayCropReady", -1);
DialogueLua.SetVariable("GrowingCropName", "");
Stop();
}
}
}