Event/Action execution trace ...

0 favourites
  • 14 posts
From the Asset Store
Very simple code without excess options (15 events for server and 11 events for client)
  • Hi,

    Is there a way to "switch on" a log for an execution trace -- perhaps some kind of hidden C2 function (@Ashley)

    If not, i think this would be a great help to debugging in particular for complex event, function call interactions. Instead of requiring to instrument all of the code with trace code.

  • Alternatively, in spirit of aspect-oriented programming/meta programming, it would be great to have a system "meta function" that is triggered for every event that fires and every action that gets executed ... while also passing along the meta information -- such as layout name, event expression (and even a unique identifier), action name, etc.

    This could then be customized via event conditions to produce a trace or other interesting features across C2 programs ...

    Dan

  • Here is one example how this could look like in C2. Essentially, the System "plug-in" gets the following additional event conditions.

    System.before any event fire

    System.after any event fire

    System.before any action executed

    System.after any action executed

    And two system variables that hold the string of the event condition that fired, and a string that holds the action executed. Ideally, it would be nice if some event conditions and actions could be tagged, and the tags would show up in a system variable also.

    If one wants to make code further customizable, then there could also be a system action to stop the execution of an action. System.Discard Action. This would make this facility very close to aspect-oriented programming facilities -- i.e. code can be overridden.

    thanks,

    Dan

  • If you want to see the execution trace, why not just open the debugger, set a breakpoint on the first event, then step through each event one by one?

  • Good idea. Didn't know this feature existed ...

    Although a idea of system events for events firing and action execution, could still be interesting in its own right -- although, probably, at a lower priority ...

  • I agree an debug log would be good, although potentially overwhelming considering the fact that event sheets get cycled through so many times (you'd have to be careful what/where you logged). Stepping in the debugger is not quite the same.. and you can't put a breakpoint inside triggered events and loops. The debugger is very useful though.

  • que yo sepa no

  • Hi Ashley,

    I now checked, and now recalled an initial issue.

    Breakpoints can not be placed on trigger events, which reduces the utility of tracing via the debugger. Hence, it seem that reviving my initial idea of having an explicit system event for tracing selected calls, could be quite helpful.

    Dan

  • Actually, there is, you can print to the Chrome console using the Browser object, with the Log function (Opening the console is Ctrl + Shift + J)

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • Thanks!,

    So this means you need to add a browser.print statemement everywhere of interest.

    How about if you could do the following:

    system.oneventfire

    layoutname="L1"

    gameState=1

    browser.print system.eventfired.Name & system.currentAction

  • Some logging info in this thread

  • thanks.

    what if i include such a console message in the runtime.js

  • You can do something quite similar by modifying the Function plugin, making it log each function call.

  • Interesting idea.

    But the log would then only include function calls. It would be nice to have more details -- such as event clauses, action execution, and perhaps even a dynamic watch list -- like during debugging.

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