User Tag List

Page 1 of 2 1 2 LastLast
Results 1 to 10 of 11

Thread: if random(100)>this then do that

  1. #1
    No Products Registered

    Join Date
    Feb 2007
    Location
    USA
    Posts
    81
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    if random(100)>this then do that

    Can someone explain how to set up if ... then situations in combination with a generated random number? For instance - if random(100)>50 then place an object on the screen or go to the next frame - or whatever.

  2. #2
    Clicker Fusion 2.5 DeveloperFusion 2.5 DeveloperiOS Export ModuleMac Export ModuleSWF Export ModuleUnicode Add-on
    Fusion 2.5 (Steam)Fusion 2.5 Developer (Steam)Android Export Module (Steam)HTML5 Export Module (Steam)iOS Export Module (Steam)Universal Windows Platform Export Module (Steam)
    JasonDarby's Avatar
    Join Date
    Jun 2006
    Location
    UK
    Posts
    4,938
    Mentioned
    0 Post(s)
    Tagged
    1 Thread(s)

    Re: if random(100)>this then do that

    You will need to use the system object called Special (which looks like two screens), and then do "Compare two general values"

    You will then get the expression evaluator where you will be able to test the two values

    Jason

  3. #3
    No Products Registered

    Join Date
    Feb 2007
    Location
    USA
    Posts
    81
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Re: if random(100)>this then do that

    im generating the random number - if its <50 i want to subtract 1 from a counter - then stop. the problem is it KEEPS subtracting 1 from the counter without stopping.

  4. #4
    Forum Moderator Fusion 2.5 DeveloperAndroid Export ModuleiOS Export ModuleSWF Export ModuleInstall Creator Pro
    Fusion 2.5 (Steam)Fusion 2.5 Developer (Steam)Fusion 2.5+ DLC (Steam)Android Export Module (Steam)HTML5 Export Module (Steam)iOS Export Module (Steam)Universal Windows Platform Export Module (Steam)

    Join Date
    Jun 2006
    Location
    England
    Posts
    3,546
    Mentioned
    4 Post(s)
    Tagged
    1 Thread(s)

    Re: if random(100)>this then do that

    You could try adding the special condition "only one action when event loops".
    .:::.Joshtek.:::.

  5. #5
    No Products Registered

    Join Date
    Feb 2007
    Location
    USA
    Posts
    81
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Re: if random(100)>this then do that

    does anyone know of a tutorial on the use of the expression editor?

  6. #6
    Forum Moderator Fusion 2.5 DeveloperAndroid Export ModuleiOS Export ModuleSWF Export ModuleInstall Creator Pro
    Fusion 2.5 (Steam)Fusion 2.5 Developer (Steam)Fusion 2.5+ DLC (Steam)Android Export Module (Steam)HTML5 Export Module (Steam)iOS Export Module (Steam)Universal Windows Platform Export Module (Steam)

    Join Date
    Jun 2006
    Location
    England
    Posts
    3,546
    Mentioned
    4 Post(s)
    Tagged
    1 Thread(s)

    Re: if random(100)>this then do that

    Quote Originally Posted by delusan
    does anyone know of a tutorial on the use of the expression editor?
    Press F1 for the electronic help documentation. Under Contents go to The editors->The Expression editor.

    Alternatively, turn to page 59 of the printed user manual.
    .:::.Joshtek.:::.

  7. #7
    Clicker Multimedia Fusion 2 DeveloperiOS Export Module
    Nifflas's Avatar
    Join Date
    Jul 2006
    Posts
    2,613
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Re: if random(100)>this then do that

    im generating the random number - if its <50 i want to subtract 1 from a counter - then stop. the problem is it KEEPS subtracting 1 from the counter without stopping.
    Yeah, of course. If you only have one event that compares if a random number between 0 and 99 is lower than 50, that event will happen during every event loop, just like an "always" condition does. You must add an additional condition that restricts when the event runs. What do you want to use to trigger this event? You can always use "run this event once".

    You could try adding the special condition "only one action when event loops".
    To me, it doesn't sound like that will work though. After all, the first condition will not always be true.

  8. #8
    No Products Registered

    Join Date
    Jun 2006
    Location
    Texas
    Posts
    1,002
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Re: if random(100)>this then do that

    Your problem is probally that you want to have a single random number generated at a time and if this number is greater then a number of your choice then you perform a certain action.

    having "random(100)" in a compare two vaules event will cause a different random number to be generated each time the event is ran.

    You should generate a random number in a different event (like when the user clicks a button for instance) and then store this number in a variable (A counter) so that you can use the value of the counter in the comparison instead (That way the random number will stay the same).

    Of course having the comparison remain true will cause the event to continue to run. So what you need to do is add code that will cause the event to become false when what you wanted to do is done. I normally do this using flags...

  9. #9
    Clicker Multimedia Fusion 2 DeveloperiOS Export Module
    Nifflas's Avatar
    Join Date
    Jul 2006
    Posts
    2,613
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Re: if random(100)>this then do that

    having "random(100)" in a compare two vaules event will cause a different random number to be generated each time the event is ran.
    Which method to use depends on the case I guess. Sometimes I guess it's better to just go like:

    * User press Space Bar
    + random(2)=1

    ...to "maybe" trigger an action when the player press Space Bar.

  10. #10
    No Products Registered

    Join Date
    Jun 2006
    Location
    Texas
    Posts
    1,002
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Re: if random(100)>this then do that

    Yes but the cases for that are rare becuase then you can't use that value anymore... If you store it then you can use it in other comparisons and calculations.

Page 1 of 2 1 2 LastLast

Similar Threads

  1. Random Active Spawn in Random Location in Frame
    By Top_of_the_Temple in forum Multimedia Fusion 2 - Technical Support
    Replies: 5
    Last Post: 20th October 2016, 03:33 AM
  2. Random object spawning random y set x
    By Armiferamortalis in forum Multimedia Fusion 2 - Technical Support
    Replies: 1
    Last Post: 23rd December 2013, 11:47 AM
  3. Make Random Pool not-so-random?
    By UltraHammer in forum Multimedia Fusion 2 - Technical Support
    Replies: 4
    Last Post: 4th April 2013, 02:53 PM
  4. BUG: Random is not random in Flash mode
    By oldkliker in forum SWF/Flash Export Module Version 2.0
    Replies: 1
    Last Post: 11th October 2011, 08:56 PM
  5. Random Speed + Ypos at random times
    By Keehan in forum Multimedia Fusion 2 - Technical Support
    Replies: 2
    Last Post: 14th May 2011, 05:25 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •