[Plugin]Get combo list of instance variables name?

Get help using Construct 2

Post » Tue Oct 18, 2011 4:58 am

This question is about creating plugin.

When edit Condition:"Compare instance variable" in sprite, it can select instance variable by name.
The name of instance variables seems to be shown in a combo box.

In Plugin SDK:
[code]AddComboParamOption(text);
AddComboParam(name, description, initial);[/code]
How to get the name of instance variables to put in 'text' in AddComboParamOption? Or using another function for list the name of instance variables?

Or where can I find the edittime.js of commanace.js?rexrainbow2011-10-20 03:48:58
B
97
S
22
G
178
Posts: 4,120
Reputation: 104,047

Post » Thu Oct 20, 2011 3:25 pm

Instance variable parameters are not available to the SDK. What did you need it for?
Scirra Founder
B
359
S
214
G
72
Posts: 22,952
Reputation: 178,580

Post » Thu Oct 20, 2011 3:30 pm

For example, to log the value of a property(i.e inst.X, inst.Y) or a private variable of instance.
B
97
S
22
G
178
Posts: 4,120
Reputation: 104,047

Post » Thu Oct 20, 2011 4:08 pm

I'm not sure what you're getting at. The user can always just pass an instance variable to a number/string/any param, can't they?
Scirra Founder
B
359
S
214
G
72
Posts: 22,952
Reputation: 178,580

Post » Thu Oct 20, 2011 4:24 pm

Yes, user can pass an instance variable like a number/string in expression.

My plan is that user can assign an instance variable(index) in an action. And the (behavior)plugin will remember which variable need to be log. And then it doesn't need to call log action every tick.

The interface is like the condition in sprite: "Compare instance variable" to get an instance variable(index)rexrainbow2011-10-20 16:28:51
B
97
S
22
G
178
Posts: 4,120
Reputation: 104,047

Post » Thu Oct 20, 2011 5:25 pm

Does varaiable("yournamehere"&loopindex) work?
Image Image
B
161
S
48
G
90
Posts: 7,356
Reputation: 66,767

Post » Fri Oct 21, 2011 12:12 am

I don't know
[code]varaiable("yournamehere"&loopindex)[/code]
exactly means, sorry. Is it a condition with some expressions in event sheet?rexrainbow2011-10-21 00:12:59
B
97
S
22
G
178
Posts: 4,120
Reputation: 104,047

Post » Fri Oct 21, 2011 12:46 am

Like name your instance variables "gun1", "gun2", "gun3", etc.
Then in a system comparison within a loop compare variable("gun"&loopindex) with your other value.
Might need a str() before.
Image Image
B
161
S
48
G
90
Posts: 7,356
Reputation: 66,767

Post » Fri Oct 21, 2011 3:18 am

Ah, sorry for my bad English.
My question is not how to get instance variables in event sheet.

My question is how to get instance variables' name(in engine, the name will be transfered to an index) in plugin, like the condition : "Compare instance variable" does.

More precise, how to get the combox input to select instance variablies in plugin.rexrainbow2011-10-21 03:22:55
B
97
S
22
G
178
Posts: 4,120
Reputation: 104,047

Post » Tue Nov 08, 2011 4:07 am

Sorry for discussing this older topic again.

I thought the GUI of "get instance variables' name" is existed(see the picture upper), so that the function is already existed.

I know Ashley is very busy, could you please release this API for getting instance variables' name at future version?rexrainbow2011-11-08 05:55:19
B
97
S
22
G
178
Posts: 4,120
Reputation: 104,047

Next

Return to How do I....?

Who is online

Users browsing this forum: emoticon, KeetonCat, makkancs, Matthew de and 27 guests