Hey there!
I want to turn my login events into a function because I want to add multiple ways of signing in. For example by button click, by pressing enter etc. and I just want to use a single function for that.
Here is what the perfectly fine working login events look like:
So now if I turn that into that function:
The whole red marked part at the end is skipped. Even though I checked via console that the local var signed_in is indeed set to 1. Or if I put in wrong login information to force an error message (from mongodb) then error_message != "" will be ignored too.
This is how the login button event with the function looks like:
Why is that? I even tried using function parameters instead of local variables. And tried setting it to asynchronous, with and without a wait for previous actions.
In order to circumvent the part that is skipped I'm implementing the skipped part inside the javascript snippet. The login part works just fine. But for the error messages I'm confused as to how I can access the key-value-pairs of my JSON object within javascript.
I tried a lot of variations of
runtime.objects.Language.Get("error_messages." & error_message)
runtime.objects.Language.getItem("error_messages." & error_message)
runtime.objects.Language[2]
runtime.objects.Language["error_messages." & error_message]
runtime.objects.Language["error_messages." + error_message]
runtime.objects.Language[String("error_messages." + error_message)]
runtime.objects.Language[String("error_messages." + String(error_message))]
etc...
This is what the modified login script looks like
Please help with either getting the functions last part not getting skipped or with the part how I can retrieve the JSON object from script event. Thank you! :)