How do I make a dynamic debugger?

0 favourites
  • 12 posts
From the Asset Store
Create your quiz game! Create unlimited categories. Manage categories and questions
  • 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 !

  • You don't include the "", if you do the textbox will treat it like a string and not like a changing variable

  • 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.

  • 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

  • Try Construct 3

    Develop games in your browser. Powerful, performant & highly capable.

    Try Now Construct 3 users don't see these ads
  • 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!

  • 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?

  • 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.

  • 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.

  • 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.

  • 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.

  • Except you can't access the same stuff you can from C2's expressions.

Jump to:
Active Users
There are 1 visitors browsing this topic (0 users and 1 guests)