Editing instance variables at runtime

Get help using Construct 2

Post » Sat Jun 16, 2012 12:34 pm

Hi,
I'm looking for a way to check and edit my instances properties at runtime with navigator tools (google inspector for exemple) or something else.

For exemple, i have a spaceship in my game, and it has many properties. Some are object properties (x, y, ... related to sprite type object) some are behavior properties (velocityX... related to the physic behavior), and some are custom properties (life... custom variables i made).
I want to know if there is a way to see those values, and edit them in runtime (if possible), while i'm playing, in order to tweak efficiently my game (no more play/quit/tweak/play... needed).

I'm sorry if the answer has already be given, but I can't find it.
Of course i can do my own "debug edit mode" with textfields and stuff, but i'm looking for an "automated" method, using a navigator tool/custom tool.

Thanks !

Romain
B
11
S
4
G
3
Posts: 13
Reputation: 2,069

Post » Sat Jun 16, 2012 12:45 pm

hmm if you wanna see the properties you can put text object with evnt : everytick -> set text and put the thing you want.

if you want edit maybe you can use textbox i never tried it but the event will be like this :
everytick : global variable = the text on textbox
and put everything on a global variable for example for X position put a global variable called : "player_X"
and so on for everything...


try it and tell us if didn't work ^^
B
48
S
15
G
6
Posts: 795
Reputation: 12,035

Post » Sat Jun 16, 2012 1:02 pm

Thanks zsangerous, this could do the trick indeed.
But I was looking for a more "automated" solution, which doesn't need textbox creation or stuff like that. When I see tools like Google Inspector, or Firebug, i think it may be possible (but i don't know how, and maybe it's a wrong idea).
Of course, if there's no such solutions, I will try the "custom debug mode" with textboxes, and global variables, or create and share a plugin for this :)
B
11
S
4
G
3
Posts: 13
Reputation: 2,069

Post » Sat Jun 16, 2012 2:05 pm

I'm not really sure I understand what you're looking to do. How do you want to edit the variables, can you explain in detail? I haven't seen Google Inspector or Firebug.
B
27
S
8
G
8
Posts: 903
Reputation: 8,452

Post » Sat Jun 16, 2012 2:24 pm

Ok i'm gonna try to explain this more precisely :

what I would like is to access to all my game/instance variables and properties, during the runtime, while i'm in the navigator.
I'd like to access values, read it and rewrite it if possible.
I was talking about Google Inspector as an exemple, because it's already a good tool to check some data about your game :
For exemple, if you try to use google inspector in your game (right click > "inspect" under chrome) you can see a Console, then you can check ressources/SourceCode/Network access...
All these data can be usefull (for exemple you can check the 'Local Storage' in the "Ressource" tab, and see all the key your game have stored, then modify the value if you want to), but I can't find the instance properties on it.
I was wondering if this tool (or a similar tool maybe someone have dicovered) was able to show also the game/instance properties (x,y, velocity...).
The purpose would be to gain a lot of time during the tweaking process :)

Of course, maybe I'm overestimating the tool power, in this case, i'll try a more specific approach (textboxes...).


B
11
S
4
G
3
Posts: 13
Reputation: 2,069

Post » Sat Jun 16, 2012 2:40 pm

i don't think these stuffs work on html5 :P i really don't know these stuffs hehe ^^ try my idea as you have no limit for events ^^
B
48
S
15
G
6
Posts: 795
Reputation: 12,035

Post » Sat Jun 16, 2012 3:21 pm

I think it's totally in the realm of possibilities, but it would require a plugin.
B
60
S
22
G
14
Posts: 1,479
Reputation: 16,346

Post » Sat Jun 16, 2012 3:59 pm

A full blown debugger is something that has been on our todo list for a while, but it is very complicated. So it's not in our immediate plans. Chrome's debugger is very good, but our engine is so complicated it's generally not practical to use it for Construct 2 games. You can find things if you know where to look, but it can take a long time to find them because they're all buried deep in different data structures and in different places. I'm afraid the only way to go for now is roll-your-own. We're aware this is not ideal so hopefully it will be improved in future.
Scirra Founder
B
359
S
214
G
72
Posts: 22,952
Reputation: 178,600


Return to How do I....?

Who is online

Users browsing this forum: 99Instances2Go, Colorfish, zenox98 and 20 guests