[r95] Every choose(2, 6) Seconds

0 favourites
  • 11 posts
From the Asset Store
This is a Dungeon Master tool & the 1st of 12 Combat Engines from the Building Combat Engines for Browser Games workshop
  • This expression on event Every choose(2, 6) Seconds, it doesn't work, it only works 2 seconds as first value.

  • Not sure what you mean by Every.

    Might try int(tokenAt("2,6",int(random(1)),","))

  • I'm sorry, i forgot to mention "System", there a pic what im talking about

    <img src="http://i.imgur.com/ayahQ.png" border="0" />

  • I think it's expected since the choose(2,6) is evaluated each tick.

    To hold during 6 seconds the choose(2,6) would have to return 6 each tick

    You better do a

    Global number rate = 0
    On Start of layout 
      -> Set rate to choose(2,6)
    Every rate seconds 
      -> Set rate to choose(2,6)
      -> do things
  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • This is sort of a bug, Construct Classic would work as intended, but C2 doesn't. C2 will still evaluate the expression every tick, so it will more or less be "Every 2 seconds". Yann's fix is the workaround. Will see if I can fix in C2 itself.

  • Ashley, choose is very powerful ... i use it in my Compan360 project to generate random messages but i have notice something strange with safari which is not really a bug but a different way to "choose". If i use 2 instances of a same text object (second instance to create a shadow of the first instance object so with the same text) and set text to the object globally using choose("1","2","3") in safari the 2 instances of the text object can take different values on the same tick ! ... so i must put the choose result in a variable first and then associate variable to text to force the same value. This behaviour seems really safari specific ... but perhaps there is a way to embelled this temporary var use in C2 to provide the same way to choose to every browser ?

  • naelian - have you tested other browsers? If it works the same in other browsers, it is not specific to Safari.

  • Yes, i never have to change my code using firefox or chrome or IE ... so i really think only safari do this ;-p ... but perhaps others browsers don't evaluate the choose function for each instances using a global approach on the first tick ... so it's not at all a safari bug but a lack in others browsers ;-p. In fact is not really important so you could "zap", it's just for users don't loosing time if experimenting the same issue.

  • naelian - all browsers have very good standards-compliant javascript support, so this would really surprise me. I actually would think it works identically in all browsers and for some reason you've only spotted it in Safari. Still, if you think it's a bug make a new .capx showing it and make a new thread following the steps in 'how to report bugs' - sounds like a different issue to the one reported here.

  • Ok Ashley i will remove the variable use for safari behaviour and put a link toward this version with details in the good forum section ...

    if i found no different behaviour with last C2 release between browsers i will simply apologize me here ;-p

    I have already report bugs so i know how to do it (and refresh bug in firefox and safari link to invisible bottom layer :http://www.scirra.com/forum/r93-refresh-bug-safari-firefox_topic53120.html ...) ... but it's old bug is now corrected because you are good ;-p

  • Apologize, test with R95 the "safari" behaviour is the good behaviour and same in all browsers tested ... so a variable is needed to have the same choose value for all object instances ... perhaps i've just luck testing this with others browsers and getting the same random value each time for each intances ;-p

    Sorry to speak without testing again ... and sorry to bring attention to me but i'm sure "Yann" answer solve the first problem ;-p

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