How do I correctly use the include event sheet method

0 favourites
  • 8 posts
From the Asset Store
14 amazing sound files of game events like Level Ups, Level Completes, object spawn, object taking etc.
  • Hi

    I am probably misunderstanding what can and cannot be done when using the "include event sheet" method. At the moment my project is getting too big because I am , in each event sheet, loading files in and reading the data via ajax.

    So I thought it would be a good idea to create an event sheet that allowed for the handling of loading files. Then each event sheet would call a function from that included event sheet (say call it B for now) and that function had a parameter to identify each call.

    this all sounded good , I tried it with one call from one sheet to start with. The logic goes as follows :

    On start of layout - Call function from included event sheet (B) with parameter (1)

    (In included event sheet):

    on function call - > if parameter equals 1 - load required file via ajax using unique tag.

    Ajax on unique tag load completed

    -> set variable recordcount(from called event sheet) to tokencount(look for record marker from ajax loadlastdata)

    -> array(from called event sheet) set size (recordcount,1,1)

    -> subevent -> loop through loadlast.data to populate array with data

    -> blank subevent after loop finished - call function from called event sheet to load data to sheet.

    The problem I have is that the final call to the function from the called sub even seems to loop. Now this logic was originally in the event sheet that was calling the included event sheet before the include event sheet even existed so I know this logic works. Also if I enable this code back in the original called event sheet the looping stops.

    I have also tried to call the last function at the end part of on start of layout but this does not work as no data is loaded to screen.

    Any help would be appreciated.

  • Included event sheet acts as its events are in the base sheet.

    You gots to have some logic flaw.

    Maybe you have the 'Ajax on unique tag load completed' as a sub in the function ?

    Or you forgot to reset the parameter in 'if parameter equals 1', so it keeps calling the function until 'load is completed'. Actual executing the 'load' several times in a row ?

  • I just included a sheet (for something totally different, in a sub event. It seems to include anyway, condition true or not.

  • Included event sheet acts as its events are in the base sheet.

    You gots to have some logic flaw.

    Maybe you have the 'Ajax on unique tag load completed' as a sub in the function ?

    Or you forgot to reset the parameter in 'if parameter equals 1', so it keeps calling the function until 'load is completed'. Actual executing the 'load' several times in a row ?

    Does the below screen grabs help to see what I have done wrong ? :

  • Well 4get my previous (dumb) comments.

    Another (maybe dumb) question. I suppose that is not the complete event sheet. Do the other events in the sheet run (showing you results/partial results) before the loading/parsing is complete ?

    It can be partial, because 'on complete' is a trigger. A trigger interrupts, performs its actions/conditions, then the 'tick header' returns there were it was.

  • 99Instances2Go

    The first image is from the main event sheet and yes there are other events there as well. However the other events are called based on functions so until the GetRandomQuestions is called, the others do not start.

    In the second image, this is the entire contents of that sheet and that as you can tell is the sheet I am calling to load the files. I hope this answers your questions

    When I get chance I will post that function (GetRandomQuestions) but I know that it worked when I called it from within the same event sheet

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • Would like to debug the project. Has me puzzled at this point.

    Do you trust me enough to PM me the project?

  • Would like to debug the project. Has me puzzled at this point.

    Do you trust me enough to PM me the project?

    99Instances2Go , well I am either imagining things or in the throws of changing things about , it now appears to be working. So hopefully without any additions to the events just simply re-enabled some of the logic that I disabled which was me just trying things out got it to work. Hmmm will have to watch this carefully next time

    Thanks anyway

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