We use cookies to ensure that we give you the best experience on our website. If you continue to use this site we will assume that you are happy with it.

Once Finished, Do

Home Forums Puzzles Once Finished, Do

Viewing 12 posts - 1 through 12 (of 12 total)
  • Author
    Posts
  • #43713
    jdhutchinson
    Customer

    Hi,

    The ‘once finished, do’ is really helpful in some puzz;es relating to animate param. How can we apply this logic to other puzzles though? To create flow to all of our puzzle logic?

    #43714
    visualizer
    Customer

    Hi

    Along with your this query I also have the similar suggestion.
    Is there a facility to use “Do nothing”

    Ex. – When some task or puzzle activity is finished is there a provision to insert “do nothing” for “once finished do”… ?

    This do nothing may act as “Relay” which does nothing as active function but plays important role between two functional stages.
    I hope developer team understands what I mean.

    Its very much possible that, such function is already available in puzzles & we do not know it.

    #43909
    xeon
    Customer

    You can create some basic variables…initailize them at project start to true/false 1 or 0… they are just flags.

    Then once you other puzzles finish a particualar function. Swap the flag state and test for that variable condition.

    You can uses this sort of flag method to “do” or “do nothing”.

    Xeon
    Route 66 Digital
    Interactive Solutions - https://www.r66d.com
    Tutorials - https://www.xeons3dlab.com

    #43984
    jdhutchinson
    Customer

    @Visualiser; you can do an in if puzzle and leave the else empty. Is that what you mean?

    Thanks xeon, I’ll try that. Would you provide a screenshot of how you would structure it? Taking the animate param example, apply that to a more vanilla puzzle, how would you add a ‘once finished do’ ability/wrapper.

    #44000
    xeon
    Customer

    Hey there I am without a computer to try these things out until Friday but I will try to layout the concept.

    Procedures & Procedures with return value.

    Now I am sure there are other ways of doing these sort of things but procedures makes recognizing execution completion simple. If you write your code in procedural blocks.. then your main script is just series of procedures that are called. When a procedure is done executing you can have it return a value… this can be used as a flag for a logic statement.

    You can also place global variables that are triggered based on events and then use them for knowing when a task is completed.

    I have found these more reliable than the “ on finish” functions.

    If you specify an animation to play and do something on finish you will get unpredictable results. Let’s say your on finish had changed material from red to blue. There is a good chance that before your animation gets to the last frame the material will change color and the animation may not get to the last frame. This is more noticeable on slower hardware and devices with poor internet connection. So if you are only using the latest and greatest equipment… the on finish works well. The reason for the variability is the request to advance a frame may be delayed while prior frames are drawn. So your on finish puzzle can occur before it actually finishes on screen.

    So to solve this you have poll the scene. Is the objects location where it should be? Is the animation frame the last frame desired? If yes continue if no wait, if wait count greater than x continue.

    By using a procedure you can create a reusable test script for animations and events to ensure things have finished or not.

    Xeon
    Route 66 Digital
    Interactive Solutions - https://www.r66d.com
    Tutorials - https://www.xeons3dlab.com

    #44514
    jdhutchinson
    Customer

    Hi Xeon,

    Thanks for detail. The problem I have is more to do with the sequential nature of puzzles lacking. I have variables which are set at init, and these are checked before doing a function. Then if the function is ran, then I switch the variable at the end.

    I need to set a css rule at the start of a function, and then when the function ends, change it again. So it’s kind of like needing a flag inside of the function which has a flag. It’s hard to explain.

    The problem is since puzzles are executed in parallel rather than sequentially, it’s not like I can just stack them and them run in order.

    I’m thinking that return values might be what I need, but I’m worried about it becoming too complex as it scales up.

    I can falsify it by setting a big timer which I know will survive for the functions running, but it’s just not elegant in the least.

    #44528
    jdhutchinson
    Customer

    Here’s an example of what I want to achieve. On click, set a css rule, run a procedure, once procedure is done, set a css rule which undoes the one I made before.

    PS not sure setting the css rule and then setting it to something different overwrites the previous value or not? Is that how it works? How can we ‘edit’ or ‘set’ a new CSS rule we have created with a puzzle?

    Jon

    Attachments:
    You must be logged in to view attached files.
    #44532
    GLiFTeK
    Customer

    Hi Jon,
    You want to create the rule outside the event once…
    … so that you can change that property inside your event.
    :good:

    #44556
    jdhutchinson
    Customer

    Hey Glif!

    Thanks for the response! Okay I think I get what you’re saying…

    Is there a ‘rule change’ puzzle, or does the ‘create rule’ function as an overwrite if the rule has already been made?

    What I’m still lost for how to do, is changing the value again after i’ve changed it during the procedure? It’s the lack of ‘sequentialness’ that has (excuse this) puzzled me. Rather than thinking of puzzles as line by line.

    #44565
    xeon
    Customer

    puzzles are executed line by line but are more
    more object-oriented than straight linear execution

    As an example you might have three puzzles

    1. global variable x=0

    2. myprocedure (contains a change to variable X so that X will equal 1 and it will take a 1 min to process)

    3. if x=1 text = blue

    The execution of these is linear. Keep in mind line 3 is not waiting for the line 2 procedure to complete during its execution and thus will probably never see a state where x=1.

    To solve this use a procedure with a return and then run the condition based on the return. The code might look like:

    1. global variable x=0
    2. if (my procedure (with return)=1 then text = blue
    this will cause it to wait.

    Procedures with inputs and returns are great but can seem complicated at times.

    Anyway…you might want to try something like the attached. Might be simpler ways

    Xeon
    Route 66 Digital
    Interactive Solutions - https://www.r66d.com
    Tutorials - https://www.xeons3dlab.com

    #44567
    xeon
    Customer

    here ya go

    Attachments:
    You must be logged in to view attached files.

    Xeon
    Route 66 Digital
    Interactive Solutions - https://www.r66d.com
    Tutorials - https://www.xeons3dlab.com

    #44657
    jdhutchinson
    Customer

    See, I thought the attached might have worked, for me to display:none ONLY once the procedure before had finished. But no dice. I seem to be going backwards with it, don’t see why it should be so hard to fade something out just because it’s in the init tab!

    Attachments:
    You must be logged in to view attached files.
Viewing 12 posts - 1 through 12 (of 12 total)
  • You must be logged in to reply to this topic.