Cycling TextStrings using Modes and a Single Action Button

So I built some conditional variables to cycle through some text strings. My example is switching languages. English to French to German, and finally to Spanish, and then it is supposed to cycle back to English.

Everything is working except when I want the text to circle back to English. The number values seem to circle back to 1 but not the Modes. I don’t understand what I am doing wrong. Can someone help?

The link to the test is below.

Hi there! Welcome to the community, and happy to help!
Hmm not sure why it doesn’t work but I found a workaround that may help you. I switched in your conditional ‘If Value == 5’ : ‘Set Language to Language: Mode 5’ by ‘Set Language to English’.

See below the video to better visualise it. I also added a page 2 directly in your file with this workaround so you can check in details. Hope this helps!

1 Like

Celine, Let me start by saying thank you for the quick response and with the video, that is great! I see how this could fix the issue but my main question is shouldn’t this work the way I originally set it? Does this mean there is a bug in the code?

The reason I ask is that I plan on using the array I created in this example but on a much larger scale to make multiple versions of website layouts and languages for different versions of the same sites. If there is a bug in this array code I want to know if it might affect what I am doing and if I will have to design/code a different tactic. Unless you are fixing the bug.

Hey @Charles_W_Hsu ,
Sorry for the late reply, I’ve checked internally with the Advanced Prototyping team and it is an expected behaviour.

To give you more context, as you sets the value of Language (in Mode 1) to the value of Mode 2. That means that after the first run, the value in the first Mode is overridden from English (initial Mode 1 value) to French (initial Mode 2 value).

This can’t be achieved today by using Modes. I’ve shared your feedback to have the possibility to switch between Modes to our team for consideration, though I can’t guarantee an ETA for an implementation. Thanks again for flagging this!

Thank you Celine for this explanation. I would love to hear when this might be figured out.

FYI - My original concept was to be able to set all of the variables in the Local Variable Window and NOT in the Code in the Buttons. I figured having all the Colors, text Strings, Numbers, and Booleans all be in the Modes in the Local Variable window. Being able to change all of these details in this window instead of in the code on each button would be extremely useful I think.

I also noticed that you can select the Mode in the String variable feature and it changes the text in that String but you can’t do that with any of the other variable types. It would be extremely useful if the Variable Mode(Column with its corresponding variable) could be selected instead of the hard-coded value for that variable!!! =) Are there any thoughts from the Development Team about doing this in the future? If you need a better explanation I would be more than willing to explain more.

Thank you for the additional feedback!
For the second part of your feedback, can you clarify ‘You can select the Mode in the String variable feature and it changes the text in that String but you can’t do that with any of the other variable types’ , you mean also in the Local Variable window or in the advanced prototype interaction setting?

If you are able to, please share a quick screenshot or video recording so I can better visualise your feature request :slight_smile: Thank you!

So I created this YouTube video to help explain what I mean. I did use the wrong phrasing in some areas of the video. In most cases, I was referring to variables and not values.

I added an additional comment to make it a bit more clear.

Hey Charles,
Thank you for sharing your detailed feedback with your video! Though I can’t guarantee anything on our end, but I can give some visibility to our team for consideration.

I appreciate you listening to my ideas! Thanks!

Hey Charles!
Thanks for these videos! Two things I wanted to share…

  1. Doing something like Set language to language:Mode2 just sets the value of language in Mode 1 (cause that’s the Mode that your prototype is in) to the value of Mode 2.

e.g., the values of your variables are
Mode 1 — Language: English
Mode 2 — Language: French

After executing Set language to language:Mode 2, you will get:
Mode 1 — Language: French (cause you replaced this value with language:Mode 2
Mode 2 — Language: French

So in your case it wouldn’t actually help to have e.g., color:Mode2 as that would do the same thing; override the value of the variable in the Mode of the Prototype.

  1. That being said the way to fix this would be to have an action that switches the Mode of the prototype to a different Mode. That’s something we’re working on!

The setup would then be sth like this…

  • If val == 2
    • Set Mode: Mode 2
  • If val == 3
    • Set Mode: Mode 3

The behavior would then be that the prototype changes into this other Mode, making all variables that relate to that change their value. — It’s the equivalent of changing the mode on the page between Mode 1, 2, or 3…

We don’t know yet, when that will land exactly, but yeah, we’re working on that as the solution for your problem.

2 Likes

@nikolasklein, Yeah! That would be totally what I would want in this feature! If you are building this that is extremely useful!! I can’t wait to see this feature. Excited to see this!

1 Like