Forum rules - please read before posting.

Compare string variable to PopUp variable

Hey Chris,

I would like to know if a PopUp variable can be compared to a string variable like the pictures show
I have the InputNumOnly varible to be assigned by a menu item type string and i see that its value is i.e. 63 so based on what is the QuestionID PopUp varible i choose the proper value from QuestionAnswers PopUP variable in this example QuestionID is 1 so QuestionAnswers gets to be 63 and so when i check the two variable it seems that they both are '63' but the answer i get in actionlist check is false.

Any ideas whats going on or how i should do a comparison between a string variable and a PopUp variable with AC actionlists or should i do it whit custom script?

https://imgur.com/a/PL6mSWw

Thanks.

Comments

  • We'll need to do some testing. If you open up AC's ActionVarCheck script and replace line 279:

    compareValue = _compareVar.TextValue;
    

    with:

    compareValue = _compareVar.GetValue (Options.GetLanguage ());
    

    Does that allow for the comparison?

  • Hey Chris,

    So that change didn't do anything, but i tried to copy the value 0 of QuestionAnswers to a tmp Variable String and it worked fine with the comparison.

    P.S. I also tried to copy the value of the tmp Variable to QuestionAnswers but it sets its value to the last PopUp value (cause its a big number 63), so it must be using the place value and not the actual value on some functions... maybe...

    https://imgur.com/a/fEFqi2O

  • You can copy a non-string variable into a string variable, but not the reverse.

    The code change above works for me, however. In the Variable: Check Action, are you setting the first variable to the String, and the second to the PopUp?

  • Yes, as you see in the first picture the first var is InputNumOnly string and the second is QuestionAnswer which is PopUp.

    https://imgur.com/a/PL6mSWw

    Also i have AC version 1.72, could it be this the problem? I can't change it right now cause my boss does not want to.

  • v1.72 is three years old - it could well be a factor.

    The best thing you can do is print the result to the Console to see what comparison it's making.

    Underneath that same line, insert:

    Debug.Log ("Compare '" + fieldValue + "' with '" + compareValue + "', Equal? " + (fieldValue == compareValue));
    
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.