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

Get help using Construct 2

Post » Mon Aug 14, 2017 11:51 pm

Message: DjowG can only post plain text URLS until they have 500 rep. 1 URLS modified. Why?
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)

:?: 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 :cry: )
Image

:?: 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?

Image

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 :(

CAPX https://www.dropbox.com/s/ja91gb39jyti4 ... .capx?dl=0
Last edited by DjowG on Wed Aug 16, 2017 4:53 pm, edited 1 time in total.
B
6
S
2
G
1
Posts: 12
Reputation: 974

Post » Wed Aug 16, 2017 8:49 am

Does anyone have any suggestions or another idea on how to do this?
B
6
S
2
G
1
Posts: 12
Reputation: 974

Post » Wed Aug 16, 2017 2:02 pm

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
Last edited by blackhornet on Wed Aug 16, 2017 2:19 pm, edited 1 time in total.
ImageImageImage
B
71
S
21
G
231
Posts: 3,692
Reputation: 129,360

Post » Wed Aug 16, 2017 2:11 pm

I am a newbie in here and want to learn something from here.
So never mind.
B
1
Posts: 5
Reputation: 135

Post » Wed Aug 16, 2017 5:02 pm

@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 :D
B
6
S
2
G
1
Posts: 12
Reputation: 974


Return to How do I....?

Who is online

Users browsing this forum: evillair, Fenix18 and 61 guests