generator of random numbers with conditions?

Hiya,

I'm pretty new to Flash so this can be a very easy fix for someone who knows what they are doing...

Here is my code...

the idea is that the player clicks on a button to look out the window and then a 4 options arise randomly, he'll be CHARGED 5 points of energy for the privilege.

LOOKING OUT WINDOW - this section works fine...

trainWINDOW.addEventListener (MouseEvent.CLICK, windowcheck);

function windowcheck(event:MouseEvent):void
{
updateScoreENERGY();
}
function updateScoreENERGY (): void
{
If (scoreENERGY < 5) {}
WINDOWRESULT.text = ' YOU ARE TOO TIRED to DRAG YOURELF until THE WINDOW";} m:System.NET.SocketAddress.ToString ().
on the other

scoreENERGY-= 5;
randomzombieforcast();
energycptext. Text = scoreENERGY.toString ();
}

the section above works fine, I don't think that the 'randomzombieforcast' function works


I think the problem starts here...

function randomzombieforcast()
{
var Results:Number is Math.floor (Math.random () * 4) + 1;.
return results ;}

{If (results == 1)
WINDOWRESULT.text = "there are only a few zombies around (day light)"m:System.NET.SocketAddress.ToString ();
If (results == 2)
WINDOWRESULT.text = "there are a certain number of zombies hidden nearby (average day)"m:System.NET.SocketAddress.ToString (); ".
If (results is 3)
WINDOWRESULT.text = ' there are a lot of zombies LURKING in your street (day) "(heavy) m:System.NET.SocketAddress.ToString;»
If (results is 4)
WINDOWRESULT.text = "I wouldn't look for if I were you! (Revelation) "m:System.NET.SocketAddress.ToString (;})

Any help at all would be greatly appreciated

Thank you!

Try...

function randomzombieforcast()
{
var Results:Number is Math.floor (Math.random () * 4) + 1;.

If (results == 1) {}
WINDOWRESULT.text = "there are only a few zombies autour (day light);

} Else if (results == 2) {}
WINDOWRESULT.text = "there are a number of hidden nearby zombies (medium day);"
} Else if (results == 3) {}
WINDOWRESULT.text = ' there are a lot of zombies in your street TAPI (heavy day);
} Else if (results == 4) {}
WINDOWRESULT.text = "I wouldn't look for if I were you! (apocalypse) » :

}

}

Tags: Adobe Animate

Similar Questions

  • Generator of random numbers with Page break

    Hello

    I was wondering if it is possible to write a JavaScript script that will:

    -generating a random number

    -When a random number is generated, a specific page in the document is loaded.

    For example, when 4 is generated, from 1 to 6, you would jump to page 10, when 5 is built, you

    jump to page 20, etc.

    The idea is that when you press the key which is linked this javascript, you will automatically be

    go to a random page.

    This would be possible at all?

    Thank you!

    Kind regards

    Fabian

    It is possible, but your description is not very clear. What is the relationship between the random number and the page you jump to? Why not just generate a random number between 1 and N (N being the number of pages in the file), and then go to this number?

  • Generating random numbers with format 18XX88YYYYY

    I've been tryig to generate random numbers with
    format 18xx88yyyyy
    here
    18, followed by two random number then 88 followed by five random number. Here 18 and 88 are set to place one, two, five and sixth position.

    but I am unable to get the logic.

    So please help


    Thanx

    Achyot

    Try this:

    SELECT    '18'
           || ROUND (DBMS_RANDOM.VALUE (1, 100))
           || '88'
           || ROUND (DBMS_RANDOM.VALUE (1, 100000))
      FROM DUAL
    

    - - - - - - - - - - - - - - - - - - - - -
    Kamran Agayev a. (10g OCP)
    http://kamranagayev.WordPress.com

  • Generating unique random number with a Boolean signal on an RT target

    Hello, this is my first time asking your question. I apologize if I post this question in the wrong Council.

    [What I'm trying to do]

    I am stable heating and cooling in an experimental space that I (with cRio9024).

    And I'm putting a different experimental condition in space based on the function 'random number '.

    'Different experimental conditions' sense different combinations of Tind, Twat_s and mdot (refer to the attached VI).

    For example, if I get the Boolean TRUE signal.

    I should have a set of [Tind, Twat_s, mdot] = [21,14,0.05], and IS this set of numbers until this Boolean signal goes to FALSE.

    And when the signal passes to the TRUE once again.

    I should have a different set of [Tind, Twat_s, mdot] = [24,16,0.15] for example.

    [I]

    Problem I am with my code is that,

    When the VI is running, the random number remains the same as the Boolean signal is set to TRUE.

    From what I tried so far for the last couple days, using 'the event structure' was the message more concerned that I found,

    However, LabView help tells me that "structure of the event" on the objectives of the RT do not support the events associated with the user interface such as the façade of VI or controls panels.

    I would therefore ask a quick help, since my knowledge of LabView is exhausted at this point.

    This is so the part where I want to generate random numbers, WHEN this structure case is TRUE.

    convert whole numbers, random numbers

    Use them as a table index,

    while I can choose conditions from radom to the given set of conditions.

    Once more, I want to do is,

    generate a SINGLE random number series when the structure above is TRUE.

    Hope I have developed quite clear.

    I'm appreciated for any kind of advice.

    Thank you!

    You just need to store the Boolean from the previous run. Then the logic would be (I'll call her Boolean previous B_prevand current boolean B):

    If B AND B_prev > don't generate new values

    otherwise if B > generate new values

    Edit: to store your Boolean value, you can use a feedback node, or a loop with N = 1 and a registry change.

  • The value of the seed of the generator of random numbers in Matlab node

    Hi all

    I need to use random variables inside a Matlab Labview Commsuite node. I generate with the randn() function. Is it possible to put the seed of the random number generator such as the random numbers are reproducible?

    Hi Steve,.

    You can use randn ('seed', seeds) to initialize the random number generator. The seed must be a positive integer value. For example, randn ('seed', 3). In addition, this seed is global within the entire application. This means that if the randn() function is called MathScript multi-node that could run in parallel, random results are not guaranteed to be the same after you change any part of your code. But you should always get the same results for repeated passages of the same code.

  • Generate a random number with a decimal point

    I searched all over the internet and cannot find how to generate a random number that had a decimal.

    I'm trying to randomly generate numbers between 12.0 and 13.0.

    Here is my code... I know its bad because of Math.round and Math.random, but I can't seem to find something that deals with a decimal...

    addEventListener (Event.ENTER_FRAME, fl_EnterFrameHandler_1);

    function fl_EnterFrameHandler_1(event:Event):void
    {
    Volt.Text = Math.round (Math.random () * (1) + 12) m:System.NET.SocketAddress.ToString ();
    }

    Any suggestions?

    -Pat

    Try this,

    addEventListener(Event.ENTER_FRAME, fl_EnterFrameHandler_1);
    
    function fl_EnterFrameHandler_1(event:Event):void
    {
    
         var rndNum:Number = int(Math.random()*10)/10; // Generate random num with 1 decimal place
         var newVal:Number = newVal + 12;
         volt.text = newVal.toString();
    }
    

    If you want 2 decimal places then replace the 10 per 100.

  • Need a generator of random numbers of Captivate 7 (values from 1 to 6)

    In collaboration with Captivate 7, I am trying to create a game that emulates a single set of in place.  To do this, I need a random number generator which will decrease the number in a user Variable and may be limited to generate numbers from 1 to 6.  Occurs in my goal to make it look like a roll.  I've used a widget in Captivate 5, but it no longer works (I think it was made with JS2 and apparently 7 Captivate does not work with JS2?.)  I don't know NO JS, but everything I've found seems to indicate this is the only way to accomplish what I am trying to do.  Anyone out there have any suggestions?

    AS3 insert as an animation when it is encountered on the updates of the chronology of the variable "throw_1.

    var cpVars = object (parent.parent) .getMovieProps () .variablesHandle;

    cpVars.throw_1 = Math.ceil (Math.random () * 6);

  • How can I generate multiple unique random numbers?

    Hello

    I am trying to generate multiple random numbers between a given set of numbers (1-52) and do not have the same number generated twice within this group. I can compare the numbers of last and next with the function to compare, but how would I go about comparison of all numbers generated without using a huge list of shift registers...

    Any help/ideas are welcome and appreciated.

    Jason

    Solved my problem. IM passing the random number through a registry to offset to each case and build a table every time. I then searches the table for the new random number. If the number is not found I get a value of-1, another thing is an index value of 0-everything. If a comparator greater than (-1) indicates that the same number is in the table and then I can raise this matter until the same number is not found.

    Kind regards

    Jason

  • Random number with no repeat

    Hi, I made a new class to generate a random number with no repeat between the x and the y number. I want to share with all of this. Let me know incase of any problem. while I could change that.

    To call the following class, simply call the class as follows:
    var randomObj: Random = new Random();
    var newArray:Array = randomObj.getRandom ();
    Now this newArray has all the different numbers at each location to its length.

    Hi, I made a new class to generate a random number with no repeat between the x and the y number. I want to share with all of this. Let me know incase of any problem. while I could change that.

    To call the following class, simply call the class as follows:
    var randomObj: Random = new Random();
    var newArray:Array = randomObj.getRandom ();
    Now this newArray has all the different numbers at each location to its length.

  • SQL with conditions

    Hello

    I need to generate a summary table with conditions. Here are the details:

    create the table tb_class (classId number (5), studentNum number (5));

    create table tb_grade (classId number (5), gradeNum number (5)):

    insert into table values tb_class (101, 100);

    insert into table values (201, 102) tb_class;

    insert into table values (102, 103) tb_class;

    insert into table values tb_grade (101, 1);

    insert into table values (102, 1) tb_grade;

    insert into table values (201, 2) tb_gradfe;

    I would like to get the total number of students registed in a specific shade with a SQL, the result is expected as follows:

    GradeNum studentNumRegistered studentNumNonRegisted

    1                         203                                      102

    2                         102                                      203

    Is that what you are looking for?

    WITH subsum AS
     (SELECT tb_grade.gradenum,
             SUM(tb_class.studentnum) AS students
      FROM   tb_class
      JOIN   tb_grade ON tb_grade.classid = tb_class.classid
      GROUP  BY tb_grade.gradenum)
    SELECT subsum.gradenum,
           SUM(subsum.students) AS studentnumregistered,
           SUM(subsum1.students) AS studentnumnonregistered
    FROM subsum
    JOIN subsum subsum1 ON subsum1.gradenum != subsum.gradenum
    GROUP  BY subsum.gradenum;
    
  • I'm trying to generate a table of random numbers 30. After each 5 readings a new vi must open and indicate to the user than 5 readings were made. and continue with the generation of the table again.

    because I don't have a sensor now, I am currently generating a table of random numbers 30. After each 5 readings a warning should be given to the user 5 readngs are completed. This cycle must be repeated. the size of the table is 30.

    Please help me, waiting for response as soon as possible.

    Once I have the transducer, I'll take 30 analog samples and then after each 5 smaples this wraning will be displayed din a new VI

    Use a while loop with a delay time representing your sampling interval.

    Use is equal to the count Terminal to see if 4, then 4th iteration = 5th sample.

    Use a box structure. The real deal will only run on the 4th iteration.

    In the case of true place a Subvi with your message of your choice in the front panel. Go to the properties of the VI window and set ' open the front panel when it is called.

    The condition to closing of attention is not given to your description.

    Consider that rather than usign a Subvi to do this, you can use the "dialog box one/two/three button" or "display message" live in the palette "user interface and dialogue."

    Please try it out and send your own VI. Do not provide us with a working solution.

    Kind regards

  • How the random numbers will be generated

    The "dice" in LabVIEW function is ised to generate random numbers between 0 and 1. If I create a [100000] array with random numbers between 0 and 100, the appearance of 1 to 100 is the same (about 1000 times each), but the appearance of the 0 is only 500.

    So my question is, on the basis of which will be generated random numbers?

    Mitu salvation,

    It is not a problem of the RNG, it's a problem of your function rounded!

    "To U8" allows you to convert the entire random DBL. ToU8 rounds up to the next integer. So all the number of 0-0.5 will get rounded to 0, but all the numbers from 0.5 to 1.5 will get rounded to 1. If you have twice the range of a number rounded to 1 at the beach of rounding to zero - the same goes for your "end of range" with rounding to 100. 100 should be also less likelihood (in your VI) to appear...

    To get the same probability, you should (explicitly) roundpupils before converting in U8!

    BTW. You can also search the forum to get the same answer by searching for "random"...

  • How LabVIEW can generate random numbers according to any pdf or histogram?

    I would like to know if there is a VI that generates a set of random numbers according to any probability density, the probability mass function or the graph histogram (this without explicitly knowing the function).

    Thank you.

    Acoustic wrote:

    I would like to know if there is a VI that generates a set of random numbers according to any probability density, the probability mass function or the graph histogram (this without explicitly knowing the function).

    If you have a given arbitrary distribution, you can simulate random data of thesholding mapping in the integral standard service with a simple random number 0... 1.

    This old post of mine should show you the General procedure and more details. (Is there even an former example). Of course, make sure that the desired function is all positive, of course.

  • RoboHelp 2015 - batch generate with conditional compilation tags broken?

    Hello everyone.

    My company has recently upgraded to Technical Communication Suite 2015 and today we try to generate online help for the first time with RoboHelp 2015. We have been batch generating (rhcl.exe) for about a year with no problems... and today I have problems in conditional tag of major works. I'll try to be as detailed as possible, in the hope that the community can tell me if I'm doing something wrong.

    System: RoboHelp 2015 on Windows 7 64 bit. WebHelp layout. Upgraded project of HR 11 a week ago.


    Setting up a project

    In most of the topics, we have a 'See also' section at the end, with a few links. This section is tagged with the 'Online' CBT (so that we can exclude the PDF output).

    There are 4-5 CBT by module.

    My conditional compilation expression is: NOT print AND NO risk AND NO WIP. The expression is named Test. This conditional compilation expression is stored in a WebHelp SSL called VALUE. The 'Online' tag appears correctly under tags available and it is certainly not excluded.

    The problem

    I use the following command;

    "C:\Program Files (x 86) \Adobe\Adobe RoboHelp 2015\RoboHTML\rhcl.exe ' 'D:\technical_documentation\my_project\my_project.xpj'-l 'Test' o 'D:\help_builds\my_master\mergedProjects\my_project '.

    In the output, all the content that is tagged with Online is not visible, even if the tag was not excluded!

    I tried a few other scenarios and the results are even more confusing to me. I scored some random text with some other tags ('link', 'afds' and 'value') - labeled content 'link' and 'afds' is not visible, but the content labeled 'Value' is... Although none of these tags have been excluded!

    If I generate RoboHelp, not with the lot, everything works fine, without changes in the SSL settings.

    Am I right in thinking this is a new bug? Perhaps rhcl.exe support incorrectly the improvements in tag conditional compilation in HR 2015? I will record a bug if this is the case, but I would like some opinions firstly thank you!

    Adobe have studied this problem and managed to reproduce it.

    I suggest that report you it as a bug so that Adobe can contact you if they need more information.

    Please follow this link.

    http://www.Adobe.com/cfusion/mmForm/index.cfm?name=wishform&product=38

    See www.grainge.org for creating tips and RoboHelp

    @petergrainge

  • How to generate random numbers from 1 to 5

    How to generate random numbers from 1 to 5

    -1110340081

    Thank you I ended up

Maybe you are looking for