[Solved] How do i solve? instance, parameters an dictonary

0 favourites
  • 5 posts
  • Hi! Every one, i have some problem here (I not native speak English, so sorry for any error)

    I'm making a menu and translation system for my game, but two things are not working (my capx is in the final of post if you need look)

    <img src="{SMILIES_PATH}/icon_question.gif" alt=":?:" title="Question"> When I am with the 'language option' selected, I would like that when you press 'space' the idiom changes to the next one and when you reach the last one, you turn to the first. I try many possibilities, but nothing work, but for me make sense (in the capx there other functional possibility, with one key for every language <img src="{SMILIES_PATH}/icon_cry.gif" alt=":cry:" title="Crying or Very Sad"> )

    <img src="{SMILIES_PATH}/icon_question.gif" alt=":?:" title="Question"> I have 3 json archives ('string.en', 'string.pt', 'string.es') i load the json of selectioned language in a dictionary.

    In the json (load as dictonary) as the key and the value. For exemple, the key 'mastervol' in 'string.en' its value is 'Master Vol', in 'string.pt' its value is 'Vol Mestre' and in 'string.es' its value is 'Vol Maestro'.

    I use for text in the menu a 'sprite font' called 'menu_select'. Every 'sprite font' is the same with a different instance caled 'opt'. For exemple 'menu_select' whit the text

    "Fullscreen" has 'opt' 'fullscreen' and 'menu_select' whit the text "Master Vol" has 'opt' 'mastervol'.

    I need when you change the language, the function 'update_text' pick the 'menu_select' with the instance 'opt' and change its text to the 'value' of the 'key' equal to the 'opt' instance of the same 'menu_select'. but my code don't work for this, but work for 'menu_stts' whith the instance 'opt'.

    There's two 'menu_stts', one for fullscreen on/off (whit instance 'opt' equal 'full_stts') and other for selected language (whit instance 'opt' equal 'lang_stts').

    When i set to change the text of 'menu_stts' and check the parameter is equal the 'opt' he change only one... but the same method not change in 'menu_select'

    Why i do worng? is possible pick a value off a key equal a instance and change the text for only the object that have this same instance?

    If someone can help me I will be very grateful, I am learning a lot here in the forum, i had read and read lots of articles, but none of them gave me that answer <img src="{SMILIES_PATH}/icon_e_sad.gif" alt=":(" title="Sad">

    CAPX https://www.dropbox.com/s/ja91gb39jyti4 ... .capx?dl=0

  • Does anyone have any suggestions or another idea on how to do this?

  • To fix the language issue, you need to add Else to your conditions. Get rid of the lang_set_number and add Else to events 23 and 24, so that you are only checking one language at a time. At the moment you are cycling all languages at the same time.

    For the language update, add a subevent at event 45, add a For each menu_select, and move your function call there. This calls the function once for each object, passing in the instance variable one at a time.

    Edit: capx added

    http://www.blackhornettechnologies.com/Construct2Stuff/djowg_menu_instance_BHT.capx

  • Try Construct 3

    Develop games in your browser. Powerful, performant & highly capable.

    Try Now Construct 3 users don't see these ads
  • I am a newbie in here and want to learn something from here.

    So never mind.

  • blackhornet I'm very grateful to you.

    I'm learning a lot here, thank you very much.

    I need to study more, but I'm very happy with what I'm doing.

    I clearly see my mistakes, thanks for the explanation

    And an extra thank you very much for capx

Jump to:
Active Users
There are 1 visitors browsing this topic (0 users and 1 guests)