Is there an easy way to print an object's instance variables

Get help using Construct 2

Post » Tue Dec 08, 2015 4:29 am

It's cumbersome to manually type out set text = "Variable 1: = "&object.instanceVariableA&newline&"Variable 2: "&object.instanceVariableB each time I want to do so (especially if I add new instance variables or change their names). Is there an easier way to do this?
B
5
G
1
Posts: 10
Reputation: 920

Post » Tue Dec 08, 2015 5:19 am

I usually use the debugger to do that but I have used the function object before to display a bunch of values without having to type out a long equation.

Code: Select all
on function "debug"
repeat function.paramCount times
> text: append text function.param(loopindex)&newline

Then it's simple to just use a function call action and add a parameter per value.
B
94
S
33
G
117
Posts: 5,387
Reputation: 75,335

Post » Tue Dec 08, 2015 5:27 am

I know how to use the debugger but I'm making a strategy game and I need to display the information to the player in game.
B
5
G
1
Posts: 10
Reputation: 920

Post » Tue Dec 08, 2015 5:32 am

In that case you could either use the function object idea or maybe just break the equation up and use multiple append text actions.
B
94
S
33
G
117
Posts: 5,387
Reputation: 75,335


Return to How do I....?

Who is online

Users browsing this forum: Lancifer and 8 guests