grossd's Forum Posts

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

  • 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

  • Try Construct 3

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

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

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

  • Indeed. harrio,

    I find the C2 programming approach very appealing, and am wondering how it could be put to use, for other kinds of general purpose programming, such as in developing general purpose chrome extensions, which could of course also include game elements ... -- instead of falling back onto straight Javascript programming only.

  • Thanks for testing Do you think you could provide a link to the project file ... But, thinking theoretically, its hard to conclusively prove with test cases.

    I am trying to instead use call backs and varying secondary conditions (states) to order sequences independent of the layout include sequence; and for critical items I currently duplicate them in the "parent" layout ... (for example for processing that has to happen on end layout)

  • Hi,

    Is it possible to export or otherwise easily wrap a C2 app, as a chrome extension? If yes, are there perhaps any examples?

    thanks,

    Dan

  • Thanks.

    I guess its a bit ambiguous in the manual:

    "Start & end

    On end of layout

    Triggered when the layout is ending. This can happen when the project goes to a different layout or when the project closes."

    I guess it depends what project closing means.

    https://www.scirra.com/manual/124/system-conditions

  • Hi

    I wrote a short test app, to count the duration in seconds from pressing a start button. The app runs in node webkit. Upon closing the browser window, i expected the on layout end to trigger, as per manual. However, the event does not get triggered.

    I am including a link to the test project: https://dl.dropboxusercontent.com/u/102 ... Close.capx

    is this a know issue?

    thanks,

    Dan

  • Thanks,

    What about triggers, such as on start layout triggers are they processed in sequence too.

    In one implementation I had included a second condition to each on start layout, such as layoutState=1, layoutState=2

    like this i tried to ensure that on start layout in a base sheet is only triggered after an on start layout in an include sheet, but this requires a kind of "stickiness" of triggers: the trigger later needs to "wait" until the second condition is true and then fire. But i wasnt sure if this really worked consistently (it seemed to have worked though, i just wasnt sure if its guaranteed, or a fluke).

  • One approach I am trying now to overcome this is to turn all onStartLayout code segments into Functions, and then have only one onStartLayout that calls all functions.,

  • Hi,

    To better structure the code of the game, I am using include event sheets extensively. I have one include event sheet that includes all other event sheets, and that is included in all other layout event sheets. Like this if i want to add event/action behavior across all game layouts in can do so by creating a new "include" event sheet.

    E.g.

    Layout1-Events sheet includes IncludeInAllEventSheets-Events.

    IncludeAllEventSheets-Event includes

    -includeEventSheet1

    -IncludeEventSheet2

    -includeEventSheet3

    etc.

    Now, my question. If I have an onStartLayout trigger in event sheet 1 and event sheet 2 and event sheet 3 and in Layout1-Events, can I assume that the order in which the onStartLayout will be triggered will be according to the include event sheet sequence?

    thanks,

    Dan

    p.s. If no order can be guaranteed, then I would suggest adding a priority/sequence attribute to each Event trigger, which ensures that same triggers are ordered in the event queue. In essence turning them into "nested" events as it were

  • Hi,

    I created 4 levels of nested JSON, using four levels of dictionary, as follows:

    D1 includes (key,value) pairs

    D2 includes (key, D1.asJSON) pairs

    D3 includes (key, D2,asJSON) pairs

    D4 includes (key, D3.asJSON)

    Finally I save D4.asJSON into a text file using webnodekit save function.

    I then used a number of online JSON to XML and JSON to CVS converted, and none was able to parse the nested JSON -- even though a number of converters specifically mentioned nested JSON as input.

    Any idea why this may be the case.

    Dan

  • Sargas,

    I of course again agree with you. And I am again looking at efficiency and self-documentation. Its better to allow families in families, than requiring the developer to readd all object types in a second family. Because, its easier to do, therefore less error prone, and its also more self explanatory, looking at the family in families.

  • Yes, I know. But, its not so useful for comments related to ongoing design thinking.