How do I make a dynamic debugger?

Get help using Construct 2

Post » Wed Jul 27, 2016 9:44 am

Hello everyone! :)

It has been a while since I posted. I need your help knowing if what I'm trying to achieve can be done.

I have created a simple Input TextBox. and a simple Text. Is there a way for that Text to display the content of the Input TextBox if it is a Variable?

Let's say I do:
- On Every Tick: Set GlobalVariable called "DebugText" to TextBox.Text
- On Every Tick: Set Text.Text to DebugText

I can't figure out how to make this work. If I write Mouse.X in the Input TextBox I'd like the Text object to render the mouse.x coordinates, not "Mouse.X"

I know I could use the Debugger option of Construct 2 but I'd like something lighter and .. on-demand if you see what I mean.

In advance, thank you for your help !
B
17
S
3
G
3
Posts: 89
Reputation: 2,825

Post » Wed Jul 27, 2016 1:18 pm

You don't include the "", if you do the textbox will treat it like a string and not like a changing variable
B
42
S
17
G
17
Posts: 2,247
Reputation: 17,471

Post » Wed Jul 27, 2016 1:24 pm

Thank you for your answer Whiteclaws, however I wish It was that easy.

I think I made a mistake by using the word "Variable" instead of Expression. What I need to do is: Write in InputTextBox: Mouse.X and have TextFrame1 to display: 1453.46787929 or whatever. Do you see what I mean? A way to have an expression in an InputTextBox interpreted somehow and translated by the TextFrame as the result of that expression.
B
17
S
3
G
3
Posts: 89
Reputation: 2,825

Post » Wed Jul 27, 2016 1:33 pm

Ah, I see, Mmmmm, well, one of my ideas would be mapping every known variable in C2 to a number, set the current number when the textbox finishes readimg and run an every tick loop that writes a variable to the text depending on that current number.

I'll tell ya, it's not worth the hassle, if you want a debug console, insert the browser object, run your project in chrome, and ctrl+shift+j to open web console and anytime you do Browser->Log, text is logged in it, it could be a variable, a string or both (with &), you can even log in a loop but that might slow down your app so do it only in debugging

Also, do @whiteclaws, if you want more help
B
42
S
17
G
17
Posts: 2,247
Reputation: 17,471

Post » Wed Jul 27, 2016 1:49 pm

Hahah, I like the way you think! ^^ That would, indeed, be quite a hassle mapping every existing expression of C2.
I guess I will just use the external included Debugger. *sigh* Thank you for your help anyway!
B
17
S
3
G
3
Posts: 89
Reputation: 2,825

Post » Wed Jul 27, 2016 5:53 pm

I'm trying to understand: so you want to be able to type an expression or variable into the input box and have the debugTxt show the value of the typed expression or variable?
ImageImageImage
B
43
S
26
G
11
Posts: 516
Reputation: 10,473

Post » Wed Jul 27, 2016 9:06 pm

badmoodtaylor wrote:I'm trying to understand: so you want to be able to type an expression or variable into the input box and have the debugTxt show the value of the typed expression or variable?


Exactly. I'd like to type in the InputTextBox: ViewportLeft(0) or OriginalWindowHeighth or Mouse.X and have the DebugTxt object display the result.
B
17
S
3
G
3
Posts: 89
Reputation: 2,825

Post » Wed Jul 27, 2016 9:47 pm

I get it and it would be useful. I have to point out there is always the debugger before you put too much work into creating your own. But I will let you know if I find anything useful.
ImageImageImage
B
43
S
26
G
11
Posts: 516
Reputation: 10,473

Post » Thu Jul 28, 2016 6:36 am

It would be very useful, because sometimes when you're simply adding different elements and calculations, you just want to see if what you have in mind corresponds to the right value and not have to run a test each time to correct and adjust things.
B
17
S
3
G
3
Posts: 89
Reputation: 2,825

Post » Thu Jul 28, 2016 2:38 pm

Yeah, I loathe pulling up the debugger. I usually add in console.log or appending to a debug txt while doing anything complicated.

Basically need a way to turn a string into syntax. As anything you type in will be stored in a string and inherently act as if it is surrounded by quotes. Not sure if there is a solution but haven't looked yet.

If you are repeatedly looking for the same attributes you could set it up so you can click on an object and it will list attributes. Not as good as your idea but pretty simple to setup and could be useful.
ImageImageImage
B
43
S
26
G
11
Posts: 516
Reputation: 10,473

Next

Return to How do I....?

Who is online

Users browsing this forum: No registered users and 48 guests