Forum rules - please read before posting.

Parameters used in checks

I was having an issue with ActionVarCheck where I wanted to compare a Popup local variable with a Popup parameter. The parameters I had set didn't show up despite being the correct type.

The problem lies in the ShowVarGUI method. For Popup, it calls Action.ChooseParameterGUI with Integer as the expected type. That makes sense to an extent because a Popup is just an integer underneath its packaging, but it made it so that my parameters were ineligible for comparison.

I solved it in my case by adding logic to Action.ChooseParameterGUI that allowed Popups to be considered as integers.
(_expectedType == ParameterType.Integer && _parameter.parameterType == ParameterType.PopUp) ||
However, I think it should technically be the other way around. ShowVarGUI for Popups should call for an expected type of Popups and ChooseParameterGUI should also allow an Integer parameter.

Long explanation, but I think it might be helpful to factor out this logic into a separate method and make it more complete. Something like:
static bool IsParameterTypeCompatible (ParameterType type, ParameterType expectedType)
that runs the logic inside that if statement.

Thanks.

Comments

  • Welcome to the community, @dyscordion_matt.

    I'd like to know more about the original issue that led you to making such changes. Could you provide steps or screenshots to recreate the problem?

  • Thanks! Excited to be here.

    Here's the default behavior I encountered.

    Here's the fixed/expected behavior.

    Hopefully those links work for you.

  • As far as steps to recreate the problem:

    • Create a variable of type Popup
    • Create an ActionList
    • Add a Popup parameter to the ActionList
    • Create a Variable - Check Action
    • Set the variable to check to your variable
    • Attempt to compare it with the ActionList's Popup parameter
  • Great, thanks - I'll look into this.

  • Recreated, thanks for the details.

    To fix, open up AC's ActionVarCheck script, and replace line 570:

    checkParameterID = Action.ChooseParameterGUI ("Value:", parameters, checkParameterID, ParameterType.Integer);
    

    with:

    checkParameterID = Action.ChooseParameterGUI ("Value:", parameters, checkParameterID, new ParameterType[] { ParameterType.Integer, ParameterType.PopUp });
    
  • Looks like a clean fix. Should there be logic to make sure that the Popup type from the two variables match?

  • I'd be inclined to say that'd be a user choice.

Sign In or Register to comment.

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Welcome to the official forum for Adventure Creator.