producermark's Forum Posts

  • Please contact me.

  • oh,

    Just a quick reminder to those looking at this forum post ( cause I actually forgot after I tried to test the code)....

    Per the manual:

    Random(N) - Returns a random number between 0 and N, not including N

    so in the above example,

    to exclude frame 20

    the code would actually need to be

    choose(int(random(0,20)),int(random(21,39)))

  • thanks for answering

  • korbaach

    Thanks for the answer.

    correct me if I am wrong but I think you meant

    choose(int(random(0,19)),int(random(21,39)))

    just so people visiting this topic don't get confused

  • per korbaach

    solution is:

    choose(int(random(0,20)),int(random(21,39)))

    The original question was:

    So I know how to ::

    choose(0,1,2,3,4,5,6,7,8) to select a certain frame number

    and I know how to

    int(random(0,39)) to randomly select a whole number between 0 and 38.

    but what if I wanted to

    randomly select a frame number between 2 different ranges?

    for example:

    I have 40 frames, and I want to NOT select one of them;

    for example frame 20

    I could do

    choose(0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39)

    but this seems pretty long and time consuming if I had multiple events doing the same thing with a different number, so I was hoping that there was a way to

    do something like this:

    choose(0thru19&21thru39)

    int(random(0,19)&(21,39))

    but these don't work.

    Anyone know a solution?

    is there one?

    -

    -

    -

    per korbaach

    solution is:

    choose(int(random(0,19)),int(random(21,39)))

  • This really should be a tutorial PhoenixNightly

  • Aaron has made a free course at Udemy and has a video to explain this:

    https://www.udemy.com/how-to-create-htm ... DUEfZ2OeZG

    chapter 46 I think

  • LittleStain

    Thanks, for commenting.

    I guess the real question is how much CPU power (time) it takes to read the remaining 39 conditioned events (Groups);

    probably as you say little to none,.

    Anyone else have experience doing this?

  • Hi There,

    How do I decide which to do?

    Say you have numerous groups (in my case 40) in your event sheet and you only need one group at a time to be 'triggered'.

    Do you:

    AC:. Add a Condition to each group to trigger that specific group or

    DG: do you Deactivate all the Groups except the one you want?

    Does anyone have experience in trying both and was there a difference in performance.

    I want to target mobile users.

    My first thought was DG would enhance the performance but I would like opinions from people more experienced than I.

    Thanks for your time.

    What you do and why?

  • Check your code, and if that doesn't work. Check it again. and again. and again.

    Sorry but this is good practice to solve future problems.

  • Per the Manual:

    Loops

    Loops can be stopped with the Stop Loop system action.

  • Hi

    So with permission of korbaach, I have broken down the capx above ( I made a barebone version if you will )

    and made a tutorial

    https://www.scirra.com/tutorials/1440/s ... duplicates

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • korbaach

    Thanks I will take a look.

    Yes that will work.

    Now I just have to figure out Arrays :-p

  • Hi

    I currently have a question/answer game and it is set up as (eg) : Set int(random(0,4)) ,

    ---- obviously the game has more than 5 questions -- but for simplicities sake, ---------

    anyway

    so the game picks one number ( and the game sets the frame, and asks the question. )

    the problem arises when the player is near the end of the game

    and is repeatedly being asked the same questions over and over.

    I would like it so that there is no repeats or duplicates .

    I have been working with a basic capx.

    My thought process is:

    The game would Set a temp_random number and check against a 'line up' of other numbers to test if they

    have already been played (AlreadyRan), and if yes, then 'run again' ( run the Set int(random(0,4)) again )

    but if not 'Already Ran', then set the number and tag that number already played.

    My problem arises when I try to reloop after a duplicate number is detected...

    I have trying to figure it out on a capx but it just doesn't want to work....

    any idea's?

    Thanks for looking and thanks for your help,

    much appreciated.

  • Just in case the capx is lost in space at some time in the future I decided to post a tutorial because I think this info is very useful

    see:

    https://www.scirra.com/tutorials/1436/s ... ndom-order