[solved] How do I load a specific json with function()

Get help using Construct 2

Post » Tue Feb 03, 2015 9:44 pm

Hi,
Has somebody experience with json and function ?
I'm able to send variables through the call function.
e.g.
function(2)
set text to Database.Value(0,Function.Param(0),"ID")

But what I want to change the database name ???
e.g.
function(Database1)
set text to Function.Param(0).Value(0,1,"ID") -> (this is not accepted)
set text Database1.Value(0,1,"ID") -> (this should be the result)

This should save me a lot of programing...
Last edited by edwardr on Sun Feb 08, 2015 5:55 pm, edited 1 time in total.
B
15
S
4
Posts: 77
Reputation: 1,030

Post » Fri Feb 06, 2015 2:06 pm

http://armaldio.xyz - Image - Join now our Discord Server ;) - https://discord.gg/0eLPLj96B4tUr1D3

If you like my work you can donate some bucks ;)

Image
B
51
S
14
G
1
Posts: 241
Reputation: 4,957

Post » Fri Feb 06, 2015 5:40 pm

yes, I'm using it already, but it doesn't solve the Problem with opening a specific database by calling the Name with a function
B
15
S
4
Posts: 77
Reputation: 1,030

Post » Fri Feb 06, 2015 8:51 pm

What kind of object are your databases ?
B
54
S
21
G
20
Posts: 871
Reputation: 15,450

Post » Sat Feb 07, 2015 5:05 pm

I made a sample

with the slider you can choose the Detail Information
with the list you can choose which database should be load. (but this is not working)
You do not have the required permissions to view the files attached to this post.
B
15
S
4
Posts: 77
Reputation: 1,030

Post » Sun Feb 08, 2015 4:19 pm

You can always use a family for this kind of thing. Add a family instance variable to identify each database and use it to do the picking. Here :
You do not have the required permissions to view the files attached to this post.
B
54
S
21
G
20
Posts: 871
Reputation: 15,450

Post » Sun Feb 08, 2015 5:54 pm

pick by comparison .. THX!!!
B
15
S
4
Posts: 77
Reputation: 1,030

Post » Tue Feb 10, 2015 12:45 pm

Hi
@Magistross: I have on more question: (sorry)
is it also possible to pick a specific globalvariable? So without slider and given variables. (Families is not working with Globalvariables :( and function.param(0) is not recognized as a globalvariable)

e.g.
when Database 1 is chosen, take globalvariable 1
when Database 2 is chosen, take globalvariable 2
You do not have the required permissions to view the files attached to this post.
B
15
S
4
Posts: 77
Reputation: 1,030

Post » Tue Feb 10, 2015 2:33 pm

You ought to migrate from global variables to a plugin like Dictionnary. It allows for the flexibility you seek, although you can't manipulate the data at edit time.
B
54
S
21
G
20
Posts: 871
Reputation: 15,450

Post » Tue Feb 10, 2015 2:41 pm

:( ... not good..
I have to rethink this problem, maybe I can solve it otherway...

if interested: I need this for a research function.
e.g. I have several databases (ship, plane, truck, ..) with detail information and different level and I just want to show the players level (one globalvariable for each database) of the truck and all this information what it can do. e.g. Player: Level 10 for Truck, 3 for submarine, 5 for plane,...

I thought with families and compare, I can reduce it to one function. (Except the players level it worked)

If I find a solution I will post it
B
15
S
4
Posts: 77
Reputation: 1,030


Return to How do I....?

Who is online

Users browsing this forum: oddreal, Yahoo [Bot] and 2 guests